Giter VIP home page Giter VIP logo

binance-bot's Introduction

Binance-bot

Python bot for trading on the Binance cryptocurrency exchange.

There are two strategies, cross-pair arbitrage and breakout trend trading.

Cross-pair arbitrage:

Files:
  • mult_arbit.py
  • price_monitor.py
  • run_mult_arbit.py
Status:

The point is to turn altcoins into more altcoins. In optimal conditions it can cycle multiple times a minute. It only works in a very specific context:

  • You have to be in a low-fee environment. Any fee above 0.1% kills it, it works on a 0.5% margin trigger over three trades.
  • The altcoin you're going for has to trade against two base coins that also trade against each other.

So if you're doing XLM on Binance examples are:

  • XLM->ETH->BTC->XLM
  • XLM->BNB->ETH->XLM

WARNING: This strategy is super risky. It works best when all three pairs are trading sideways or trending gently. The bot knows nothing about market status other than current price ratios; rapid price swings can easily leave you mid-cycle holding a bag you don't want. rockfish icon long flip Like this strategy? Check out Rockfish, which implements a similar strategy for the Stellar Decentralized Exchange.

Breakout trend trading:

Files:
  • turtle_trade.py
  • run_turtle.py
Status:

This strategy looks for X period high/low breakouts and bets with the break direction. It's inspired by the turtle traders who did commodities in the 1980s (http://www.tradingblox.com/originalturtles/). They were trading on 10-day breakouts, which is far too slow for cryptocurrency exchanges, so the bot is set to X hours, not days. Problem is that according to my testing it barely breaks even (or goes negative) on all breakout ranges I've tested.

WARNING: As this strategy currently stands it does not profit. If you want to try it backtest it hard!

Both strategies need these files:

  • api.py
  • data_checks.py
  • excepts.py
  • log.py

(Standard disclaimer saying this isn't investment advice and bots can lose your money real fast. No warranties, etc. etc.)

Install instructions as requested in an issue:

There is no fancy install; you set up a local Python virtual environment as you would any other, drop the .py files into the directory, revise the parameter sections that refer to certain coins and the rules for them, and run the desired executor file (run_mult_arbit.py or run_turtle.py). You need to create an API key on your Binance account and add the key and secret where indicated near the top of the files as [API key] and [API secret]. The log text files will generate into the directory.

Binance's rules for trading pairs (min amount, etc.) are here: https://support.binance.com/hc/en-us/articles/115000594711-Trading-Rule

For my developer environment I use PyCharm: https://www.jetbrains.com/pycharm/. There are many other IDEs, or you can do it on the command line as explained at https://packaging.python.org/guides/installing-using-pip-and-virtualenv/.

If you're new to crypto trading I strongly recommend you acclimate with some manual trading; if you just run the bot without context knowledge you'll have a bad time.

binance-bot's People

Contributors

reidmcc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

binance-bot's Issues

There appear to be some issue with the API system used here

I’ll leave the code trace back here:
`thk@ubuntu2004vncheroku-s-1vcpu-1gb-sgp1-01:~/binance-test$ python3 run_mult_arbit.py
<traceback object at 0x7faef1b3c480> Open order request failed try again
<traceback object at 0x7faef1700b80> Open order request failed try again
<traceback object at 0x7faef1700a40> Open order request failed try again
<traceback object at 0x7faef184be80> Open order request failed try again
<traceback object at 0x7faef25f9280> Open order request failed try again
<traceback object at 0x7faef1708c80> Open order request failed try again
^CTraceback (most recent call last):
File "/home/thk/binance-test/mult_arbit.py", line 1082, in get_open_ords
open_ords = client.openOrders(pair)
File "/home/thk/binance-test/api.py", line 315, in openOrders
return self._get('v3/openOrders?', p)
File "/home/thk/binance-test/api.py", line 84, in _get
return self._request(endpoint, param, "get")
File "/home/thk/binance-test/api.py", line 78, in _request
raise MalformedRequest(r.text)
excepts.MalformedRequest

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run_mult_arbit.py", line 31, in
a = tr.get_open_ords('XLMBNB')
File "/home/thk/binance-test/mult_arbit.py", line 1088, in get_open_ords
time.sleep(1)
KeyboardInterrupt
`

I removed some of the client.get_offset() function, because they always cause error when I run them, maybe the API changed?

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.