GithubHelp home page GithubHelp logo

dca-ftx's Introduction

Warning Nowadays FTX has declared in bankruptcy, check for latest information. This repo is currently kept as public for learning purposes and possible reusability in other exchanges or projects to conduct DCA. Please don't put any money in any exchange if you don't trust and keep save your crypto preferably in hot or cold wallets!

dca-ftx

It is a small script to do dollar cost averaging of a pair in FTX exchange using cron.

  1. Get your API key and API secret from FTX
  2. Create a .env file to configure your DCA. YOu can use as example: example.env
  3. Create a cron with the following to buy everyday
# m     h       dom             mon     dow     command
0       1       *               *       *       node dca-ftx/index.js dca-ftx/btc.env >> /var/log/dca-ftx-example-log.txt 2>/var/log/dca-ftx-example-error.txt

Tips to configure .env file (what is less percentage?)

The script takes into account the current price of the pair you want to buy. It is an option to buy below the current price. Some tools like deltabadger have a similar option for premium users. If the price has gone down (in last 24h) more than LESS_PERCENTAGE, it buys with a market order. Otherwise, it applies a discount, depending on how it has gone down or not. For example, if you set LESS_PERCENTAGE=0.01, it will try to buy with a 1% of discount if the price has gone up. If it has gone down less than 1%, it will apply a smaller discount to get the lower price possible (up to 1%). If in the latest 24 hours, the price has gone down more than 1%, it will buy it directly with a market order. Looking at bitcoin volatility (which is around 2% in a day) I have set my discount in 0.01, to make sure that most of my orders will be bought. Depending on the coin, which has more volatility, you can place a higher LESS_PERCENTAGE. If you set LESS_PERCENTAGE to 0 it will apply a simple DCA, with no discounts, at the current time where you set your cron. For more details, please check the index.js file. If you have any improvement for this algorithm, you can open a PR.

dca-ftx's People

Contributors

haritzmedina avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.