Skip to content

pawiromitchel/ftx-dca-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple DCA script for FTX

A simple script to automate the buying or selling process.
Just run the script on your desired server and forget about it 💤

Made with

Installing

  1. clone and install the npm packages
git clone https://github.com/pawiromitchel/ftx-dca-bot
cd ftx-dca-bot
npm install
  1. request a API from your FTX account
  2. create a .env file based on the .env.example
  3. 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
  1. run the script
node app.js

Limit orders

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

Cron syntax cheatsheet

Releases

No releases published

Packages

No packages published