Skip to content

This is a script to help you making DCA when buying bitcoin in foxbit

License

Notifications You must be signed in to change notification settings

yiyisan/foxbit_dca

 
 

Repository files navigation

Foxbit DCA

ATTENTION: This is your money, take a look at the code before using it.

Dollar-cost averaging (DCA) is an investment technique of buying a fixed dollar amount of a particular investment on a regular schedule, regardless of the share price. The investor purchases more shares when prices are low and fewer shares when prices are high. http://www.investopedia.com/terms/d/dollarcostaveraging.asp

This script aims to help you use it to buy BTC using the Brazilian exchange Foxbit.

PS: Python 3 only.

Installation

  1. Clone the repo
  2. Create a virtualenv and activate it.
  3. pip install pipenv
  4. pipenv install
  5. Create a .env file: cp .env.example .env
  6. Edit .env following the Doc section below.

Doc

.env variables:

  • DEBUG: True to use the test blinktrade testnet or False to use production.
  • BLINKTRADE_API_KEY: Your API key from foxbit website.
  • BLINKTRADE_API_SECRET: Your API secret from foxbit website
  • PER_ORDER_IN_REAL: the amount in real each order will be
  • MAX_ACCEPTABLE_PRICE_IN_REAL: the maximum amount you are willing to pay per BTC.

Usage

  1. Make sure you created .env file following Doc section above.
  2. Run the script python buy_btc.py
  3. The script uses the following algorithm:    
    1. Delete pending orders it created on previous runs that didn't complete.
    2. Get the second highest price that someone used in a buy order.
    3. Use the second highest price to place an order with volume as defined in PER_ORDER_IN_REAL
    4. Exit

This script just run once, to use DCA you need to either run it manually at the interval you desire or schedule it with cron or another job scheduler.

About

This is a script to help you making DCA when buying bitcoin in foxbit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%