Giter Site home page Giter Site logo

optimal-buy-gdax's Introduction

optimal-buy-gdax

Scheduled buying of BTC, ETH, and LTC from GDAX optimally! Be your own index/hedge fund, and stop paying management fees to someone else!

crypto

What is this?

This is a Python script you can use to automatically buy Bitcoin, Ethereum, and Litecoin using the GDAX API. It buys these 3 currencies, weighted by market cap (as reported by coinmarketcap.com), using a form of dollar cost averaging. according to the following logic:

  1. Check current balances of USD, BTC, ETH, and LTC
  2. If the USD balance is above $100, buy BTC, ETH, and LTC weighted by market cap
  3. If there's enough USD available, place 5 discounted limit orders at the current price minus 0.5% up to 0.55%, each order with 1/5th of the remaining amount to buy for each coin
  4. If there isn't enough USD available, place 1 buy order at 0.5% off the current price
  5. If the USD account balance is below $100, withdraw coins to desired addresses

You can also use the same script to schedule deposits from your bank account periodically, such as when you're paid.

Ideally, this script would help to make sure that when we dip—

dip

we buy.

USE AT OWN RISK

Duh. Not my fault if you lose everything.

Unless you place absolute trust in me, some guy from the Internet, I suggest you clone the repo and build your own container to protect yourself from any sort of funny business.

How do I use it?

  1. Get yourself a hardware wallet, such as a Ledger or TREZOR.

  2. Set up a GDAX account, and link your bank account

  3. Create the necessary API credentials for GDAX, with permissions to manage funds, withdraw without 2FA, and trade

  4. Determine the payment_method_id value by using the GDAX API (you can use your browser's developer toolbar, here's a quick video showing how)

  5. Get a machine somewhere (GCE, EC2, Digital Ocean) with Docker and systemd

  6. Copy systemd files over:

     $ sudo cp optimal-buy-gdax-*.{service,timer} /etc/systemd/system
    
  7. Edit /etc/systemd/system/optimal-buy-gdax-buy.service, /etc/systemd/system/optimal-buy-gdax-buy.timer, /etc/systemd/system/optimal-buy-gdax-deposit.service, and /etc/systemd/system/optimal-buy-gdax-deposit.timer to your liking. Make sure you:

    • Change the BTC, ETH, and LTC deposit addresses to deposit the coins into your wallet (use a Ledger or TREZOR)
    • Put the correct API keys in
    • Check the deposit amount (start with something small, like $150, to make sure it actually works first)
    • Check the timer dates
  8. Enable the systemd units:

     $ sudo systemctl enable optimal-buy-gdax-buy.service
     $ sudo systemctl enable optimal-buy-gdax-buy.timer
     $ sudo systemctl enable optimal-buy-gdax-deposit.service
     $ sudo systemctl enable optimal-buy-gdax-deposit.timer
    
  9. Start the systemd timers: $ sudo systemctl start optimal-buy-gdax-buy.timer $ sudo systemctl start optimal-buy-gdax-deposit.timer

  10. Enjoy!

Caveats/limitations

  • Currently it only supports USD
  • Some values are hardcoded, but if you want to change that feel free to send a PR!
  • If you try to trade manually or using some other bot at the same time, you're probably going to have a bad time
  • You might have a few dollars (<$100) sitting in your account at all times, even when all orders have been filled

Tip jar

If you got some value out of this, please send some kudos my way:

  • BTC: 3EEAE1oKEMnmHGU5Qxibv9mBQyNnes8j8N
  • LTC: 3MxmLzTf4sPsFBGYUnX9MMMbTMeaUSox46

optimal-buy-gdax's People

Contributors

brndnmtthws avatar

Watchers

James Cloos avatar Lee Warnock 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.