tribeca.js
is a very low latency cryptocurrency market making trading bot with a full featured web client, backtester, and supports direct connectivity to several cryptocoin exchanges. On modern hardware, it can react to market data by placing and canceling orders in under a millisecond.
Runs on the latest node.js (v6 or v7). Persistence is achieved using mongodb. Installation via Docker is supported, but manual installation in a dedicated fresh unix-like instance is recommended.
with Post-Only Orders support | without Post-Only | |
---|---|---|
without Maker fees | Coinbase GDAX | OKCoin.com, OKCoin.cn |
with Maker and Taker fees | Bitfinex | HitBTC |
All currency pairs are supported, otherwise please open a new issue to easily include any missing currency that you would like.
See dist/Dockerfile section if you use winy or mac.
-
Ensure your target machine has installed g++ compiler (
g++ -v
), node v6 or v7 (nodejs -v
) and mongoDB v3 or greater (mongo --version
). -
Run
git clone ssh://git@github.com/ctubio/tribeca
in any location that you wish. -
Copy
etc/tribeca.json.dist
toetc/tribeca.json
and modify the configuration options, see configuration section. Point the instance towards the running mongoDB instance (usually justmongodb://localhost:27017/tribeca
). -
Run
npm start
in the toplevel path of the git cloned repository. This will runtribeca.js
in the background using forever. But before, it will install all local dependencies innode_modules
folder and will compile TypeScript insrc
folder to CommonJS inapp
folder if it was not already done before.
Optional:
-
Install the system daemon script
dist/tribeca-init.sh
(to make use ofservice tribeca start
from anywhere instead ofcd path/to/tribeca && npm start
) see dist folder. -
Replace the certificate at
etc/sslcert
folder with your own, see web ui section. But, the certificate provided is a fully featured default openssl, that you may just need to authorise in your browser. -
Set environment variable TRIBECA_CONFIG_FILE to full path of
tribeca.json
if you run the app manually from other locations withnodejs path/to/tribeca.js
. The environment variable is not needed if the working directory is the root folder wheretribeca.js
is located.
See etc folder.
Feel free anytime to check if there are new modifications with npm run diff
.
Once you decide that is time to upgrade, execute npm run latest
to download and install the latest modifications in your remote branch (or directly npm run reinstall
to skip the display of the new commit messages).
After install the latest version, all running instances will be restarted.
Please note, an "instance" is in fact a config file under etc
folder; using a single machine and the same source folder, you can run as many instances as config files you have in etc
folder (limited by the available free RAM).
You can list the current instances running anytime with npm run list
.
Simple commands like npm start
, npm stop
or npm restart
(without any config file defined) will use the default config file etc/tribeca.json
.
To run multiple instances using a collection of config files:
-
Create a new config file with
cp etc/tribeca.json etc/Xibeca_party_time.json
(with any name but.json
extension).-
Edit the value of
WebClientListenPort
in the new config file to set a new port, so all applications have a unique port to display the UI. -
Edit the value of
MongoDbUrl
in the new config file to set a new database name, so all applications have a unique database to save the data. You dont need to modify the host:port because a single database host can have multiple databases inside. -
Edit the values of
TRIBECA_MODE
,EXCHANGE
andTradedPair
in the new config file as you alternatively desire.
-
-
Run the new instance with
npm start --tribeca:config=Xibeca_party_time.json
, also the commandsnpm stop
andnpm restart
allow the parameter--tribeca:config=
, the value is simply the filename of the config file underetc
folder that you want to run; this value will also be used as theuid
of the process executed byforever
. -
Open in the web browser the different pages of the ports of the different running instances, or display the UI of all instances together in a single page using the MATRYOSHKA link in the footer and the config option
MatryoshkaUrl
.
After multiple config files are setup under etc
folder, to control them all together instead of one by one, the commands npm run startall
, npm run stopall
and npm run restartall
are also available, just remember that config files with a filename starting with underscore symbol "_" will be skipped.
-
Open your web browser to connect to HTTPS port
3000
(or value ofWebClientListenPort
) of the machine running tribeca. If you're running tribeca locally on Mac/Windows on Docker, replace "localhost" with the address returned byboot2docker ip
. -
Read up on how to use tribeca and market making in the manual.
-
Set up trading parameters to your liking in the web UI. Click the "BTC/USD" button so it is green to start making markets.
Once tribeca
is up and running, visit HTTPS port 3000
(or value of WebClientListenPort
) of the machine on which it is running to view the admin view. There are inputs for quoting parameters, grids to display market orders, market trades, your trades, your order history, your positions, and a big button with the currency pair you are trading. When you're ready, click that button green to begin sending out quotes. The UI uses a healthy mixture of socket.io and angularjs observed with reactivexjs.
If you want to generate your own certificate see SSL for internal usage.
In case you really want to use plain HTTP, remove the files server.crt
and server.key
inside etc/sslcert
folder.
Tribeca also exposes a REST API of all it's data. It's all the same data you would get via the Web UI, just a bit easier to connect up to via other applications. Visit http://localhost:3000/data/md
for the current market data, for instance.
The metrics are not saved anywhere, is just UI data collected with a visibility retention of 6 hours, to display over time:
- Market Fair Value with High and Low Prices
- Trades Complete
- Target Position for BTC currency (TBP)
- Target Position for Fiat currency
- EWMA values for Quote Protection and APR
- Amount available in wallet for buy
- Amount held in open trades for buy
- Amount available in wallet for sell
- Amount held in open trades for sell
- Total amount available and held at both sides in BTC currency
- Total amount available and held at both sides in Fiat currency
Feel free to run npm test
anytime.
To rebuild the application with your modifications, please run npm install
or directly npm run postinstall
.
To rebuild the C++ shared objects with your modifications, please run node-gyp rebuild
.
To pipe the output to stdout, execute the application in the foreground with nodejs tribeca.js
.
To ignore the output, execute the application in the background with forever start tribeca.js
or with the alias npm start
.
To debug the server code with chrome-devtools, attach the node debugger with nodejs --inspect tribeca.js
(from your local, you can open a ssh tunnel to access it with ssh -N -L 9229:127.0.0.1:9229 user@host
).
Passing a config filename as a parameter after tribeca.js
is also allowed, like nodejs tribeca.js Xibeca_party_time.json
.
Added nodejs7, typescript2, angular4 and reactivexjs.
Added cleanup of bandwidth, source code, dependencies and installation steps.
Added support for multiple instances/config files with nested matryoshka UI.
Added npm scripts, david-dm, travis-ci, coveralls and codacy.
Added historical charts to replace grafana.
Added C++ math functions.
Updated OKCoin API (since https://www.okcoin.com/t-354.html).
Added Bitfinex API v2.
Added new quoting styles PingPong, Boomerang, AK-47.
Added cleanup of database records, memory usage and log recording.
Added audio notices, realtime wallet display, and grafana integration.
Added https, dark theme and new UI elements.
Added a bit of love to Kira.
see the upstream project michaelgrosner/tribeca.
nope, this project doesn't have maintenance costs. but you can donate to your favorite developer today! (or tomorrow!)
or see the upstream project michaelgrosner/tribeca.
or donate your time with programming or financial suggestions in the topical IRC channel ##tradingBot at irc.domirc.net on port 6697 (SSL), or 6667 (plain) or feel free to make any question, but questions technically are not donations.