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.
Trader is released under the terms of the MIT license.
- 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.
- Bittrex REST support. (deprecated)
- Binance REST support. (deprecated, partially broken)
- Poloniex REST and WSS feed support (deprecated)
- Waves support
- Create readme and documentation for new strategy
- Stats tracker for persistence. (wip)
- Add more exchanges.
- GUI (abandoned)
- WSS notifications (abandoned)
Trader requires Qt 5.10 or later, built with the core, network, and websockets modules. To build:
- Install dependencies:
-
sudo apt build-dep qt5-default
-sudo apt install libgmp-dev
- Open your source directory, ie.
cd ~/src
. If it doesn't exist, runmkdir ~/src
first. - 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
- Extract:
tar xf qt-everywhere-src-5.13.1.tar.xz
- Go there:
cd qt-everywhere-src-5.13.1
- 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 - If there are no errors, run make:
make -j
(if low on RAM or single CPU, you can skip the-j
) - If there are no errors, run
make install
- 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.
- Open your source directory, ie.
cd ~/src
- Clone this repo:
git clone https://github.com/tryphe/trader
- Go there:
cd trader
- Hardcode your API keys into
daemon/keydefs.h
(choose only one): - Runpython 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): Createkeydefs.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>
. - Run qmake:
~/localqt/Qt-5.13.1-minimal/bin/qmake
- Compile:
make -j
, ormake -jn
wheren
is the number of simultaneous makes.
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.
Sessionize traderd so it stays running: setsid ./traderd
~/.config/trader
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
.
Check out the list of commands. (warning: most of these commands are now deprecated)
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.