A simple script to automate the buying or selling process.
Just run the script on your desired server and forget about it 💤
- ftx-api-rest-extended, for interacting with the FTX Exchange
- node-cron, for the scheduler
- dotenv, for parsing the configurations within .env file
- clone and install the npm packages
git clone https://github.com/pawiromitchel/ftx-dca-bot
cd ftx-dca-bot
npm install
- request a API from your FTX account
- create a
.env
file based on the.env.example
- modify the parameters in the
app.js
This example will convert 100 USD into BTC every Tuesday
# ftx api creds
KEY=key1
SECRET=secret1
SUBACCOUNT=subaccount1
# settings
FROM=USD
TO=BTC
ORDERSIZE=100
# cron schedule (https://crontab.guru/examples.html)
SCHEDULE=0 0 * * 2
- run the script
node app.js
There's a sample code in the app.js
you can check out how to place a limit order 5%
below the market price
const pair = `${_to}/${_from}`; // this will create the pair BTC/USD for example
const priceReq = await FTX_INSTANCE.getPrice(pair);
const price = priceReq.price * (95 / 100); // place order 5% under market price
const sizeInX = _size / price; // convert the usd to x
const placeOrder = await FTX_INSTANCE.createOrder(sizeInX, pair, "buy", "limit", price);
Market orders have a minimum size (around $3), you can't swap cents like OTC