Skip to content
/ trader Public

a ping pong and maker/taker order bot for trading cryptocurrency on Waves Exchange, Poloniex, Bittrex, and Binance

License

Notifications You must be signed in to change notification settings

tryphe/trader

Repository files navigation

Warning: this repo is in a transition phase. Use the code as you wish, but take caution.

What is Trader?

Trader is a bot that makes manual orders for the user, and/or makes automatic ping-pong orders. Trader can execute one-time, fill-or-kill, and maker/taker orders, and simulates these modes on exchanges without direct support. Trader also respects exchange limits like maximum number of orders, minimum price, maximum price, minimum lot size, price ticksize, etc.

License

Trader is released under the terms of the MIT license.

Features

  • Low resource usage. 5MB static binary, 15-20MB ram usage.
  • Runs headless.
  • Supports a large number of build targets. See Qt platform requirements for more details.
  • Order engine is adaptable to any exchange.
  • Runtime sanity testing and fairly extensive order execution simulation for consistency.
  • Uses GMP multi-precision integers. No floating-point instructions are used. How can floats fail?
  • Real-time slippage calculation which prevents local order collision and greatly reduces the frequency of exchange post-only mode collisions.
  • Anti-mistake. Prevents taking a price 10% lower or higher from the current spread(also overridable), and more!
  • Ping-pong using fixed, user-generated positions. Also able to combine positions.
  • Automatic ping-ping (wip)
  • Because trades aren't made using a browser interface, coin theft by withdrawal through browser hijacking is impossible.

Exchanges

  • Bittrex REST support. (deprecated)
  • Binance REST support. (deprecated, partially broken)
  • Poloniex REST and WSS feed support (deprecated)
  • Waves support

TODO

  • Create readme and documentation for new strategy
  • Stats tracker for persistence. (wip)
  • Add more exchanges.
  • GUI (abandoned)
  • WSS notifications (abandoned)

Dependencies: Compiling Qt and installing libgmp (unix/linux)

Trader requires Qt 5.10 or later, built with the core, network, and websockets modules. To build:

  1. Install dependencies: - sudo apt build-dep qt5-default - sudo apt install libgmp-dev
  2. Open your source directory, ie. cd ~/src. If it doesn't exist, run mkdir ~/src first.
  3. Pull any currently maintained Qt source: wget https://download.qt.io/archive/qt/5.13/5.13.1/single/qt-everywhere-src-5.13.1.tar.xz
  4. Extract: tar xf qt-everywhere-src-5.13.1.tar.xz
  5. Go there: cd qt-everywhere-src-5.13.1
  6. Configure Qt. Important: replace username with your username. (Choose only one) - Click here to configure a dynamic build, to run Trader on your machine - Click here to configure a static build, to copy Trader to another machine with the same OS
  7. If there are no errors, run make: make -j (if low on RAM or single CPU, you can skip the -j)
  8. If there are no errors, run make install
  9. Now, run qmake -v prefixed with your install path (type the whole thing): ~/localqt/Qt-5.13.1-minimal/bin/qmake -v ~~~ QMake version 3.1 Using Qt version 5.13.1 in /home/username/localqt/Qt-5.13.1-minimal/lib ~~~ If you are having problems with step 9 and interfering Qt versions, invoke qmake using qtchooser instead.

Compiling

  1. Open your source directory, ie. cd ~/src
  2. Clone this repo: git clone https://github.com/tryphe/trader
  3. Go there: cd trader
  4. Hardcode your API keys into daemon/keydefs.h (choose only one): - Run python generate_keys.py - or: Copy the example keydefs file: cp daemon/keydefs.h.example daemon/keydefs.h then paste your keys in with your favorite editor. - or: (non-hardcoded keys): Create keydefs.h using the example file above, but leave the keys blank or as-is during compile. Then, each time you run the binary, modify the bulk input file <config-directory>/in.txt, adding this line: setkeyandsecret <key> <secret>.
  5. Run qmake: ~/localqt/Qt-5.13.1-minimal/bin/qmake
  6. Compile: make -j, or make -jn where n is the number of simultaneous makes.

Updating

Run git pull to pull the latest code, then repeat step 6 from the Compiling section. You should do this frequently - minor bugfixes are common.

Running the daemon

Sessionize traderd so it stays running: setsid ./traderd

Config directory

~/.config/trader

Tailing the logs (note: CLI output goes to the logs)

Running the daemons and relying terminal output is suboptimal if the terminal closes. It's enabled by default, but can be disabled in daemon/build-config.h. All output is also routed to the logfiles. There's a color log, and a noncolor log. To tail, run: tail -f --lines=200 ~/.config/trader/log.<timestamp>_color.txt.

Commands

Check out the list of commands. (warning: most of these commands are now deprecated)

FAQS

What the bot is NOT

The bot doesn't use common chart indicators, like momentum indicators or standard deviation formulas. Instead, it relies on user-generated ping-pong, and automatic ping-pong based on a cross-market tit-for-tat strategy (coming soon).

What about supporting xyz exchange?

It's fairly easily to integrate the bot with any API, as long as it can read its current orders and get ticker prices. Currently, it would take roughly 1000 lines to add another exchange. If you know of a good exchange, let me know.

Releases

No releases published

Packages

No packages published

Languages