Zenbot
No description available
Install / Use
/learn @zahidaliayub/ZenbotREADME

“To follow the path, look to the master, follow the master, walk with the master, see through the master, become the master.” – Zen Proverb
Current Status
Zenbot 4 is functional, but is having trouble reliably making profit. At this point, I would recommend against trading with large amounts until some of these issues can be worked out:
- Many people are reporting losses in live trading even if the simulation results and/or paper trading is positive.
- This is my highest priority right now, since an unprofitable bot is not worth much, but please understand that reliably making profit is hard, and so is making a realistic simulator.
- The losses may be due to the default strategy not working well in sideways (non-trending) market conditions, slippage during limit order execution, or both. Currently I would recommend against using Zenbot on a market that is non-trending or trending generally downwards.
- The limit-order strategy that Zenbot uses to avoid taker fees, is prone to race conditions and delays. A mode for using market-type orders will probably need to be made, which may make frequent-trade strategies less viable due to fees, but more reliable execution overall.
- An upcoming feature will allow Zenbot to use a limited amount of your balance, which will help with experimenting with live trading, but mitigating the possible losses from the issues above.
Zenbot is a hobby project for me and I'm sorry that I can't devote myself full-time to it. Since I'm getting busier, development may slow down a bit from here, so please be patient if issues aren't fixed right away.
Description
Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB. It features:
- Fully-automated technical-analysis-based trading approach
- Full support for GDAX, Poloniex, Kraken, Bittrex, Quadriga, Gemini, Bitfinex, CEX.IO and Bitstamp, work on further exchange support is ongoing.
- Plugin architecture for implementing exchange support, or writing new strategies
- Simulator for Backtesting strategies against historical data
- "Paper" trading mode, operates on a simulated balance while watching the live market
- Configurable sell stops, buy stops, and (trailing) profit stops
- Flexible sampling period and trade frequency - averages 1-2 trades/day with 1h period, 15-50/day with 5m period
Disclaimer
- Zenbot is NOT a sure-fire profit machine. Use it AT YOUR OWN RISK.
- Crypto-currency is still an experiment, and therefore so is Zenbot. Meaning, both may fail at any time.
- Running a bot, and trading in general requires careful study of the risks and parameters involved. A wrong setting can cause you a major loss.
- Never leave the bot un-monitored for long periods of time. Zenbot doesn't know when to stop, so be prepared to stop it if too much loss occurs.
- Often times the default trade parameters will underperform vs. a buy-hold strategy, so run some simulations and find the optimal parameters for your chosen exchange/pair before going "all-in".
Quick-start
Step 1) Requirements
Step 2) Install zenbot 4
Run in your console,
git clone https://github.com/carlos8f/zenbot.git
Or, without git,
wget https://github.com/carlos8f/zenbot/archive/master.tar.gz
tar -xf zenbot-master.tar.gz
mv zenbot-master zenbot
Create your configuration file by copying conf-sample.js to conf.js:
cp conf-sample.js conf.js
- View and edit
conf.js. - It's possible to use zenbot in "paper trading" mode without making any changes.
- You must add your exchange API keys to enable real trading however.
- API keys do NOT need deposit/withdrawl permissions.
If using Docker, skip to section "Docker" below.
Install dependencies:
cd zenbot
npm install
# optional, installs the `zenbot.sh` binary in /usr/local/bin:
npm link
Ubuntu 16.04 Step-By-Step
https://youtu.be/BEhU55W9pBI
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential mongodb -y
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
git clone https://github.com/carlos8f/zenbot.git
cd zenbot
npm install
./zenbot.sh trade --paper
Please note; npm link will not work as forex.analytics is built from source.
Docker (Optional)
To run Zenbot under Docker, install Docker, Docker Compose, Docker Machine (if necessary) You can follow instructions at https://docs.docker.com/compose/install/
After installing (step 2 above),
cd zenbot
docker-compose build
docker-compose up (-d if you don't want to see the log)
If you are running windows use the following command
docker-compose --file=docker-compose-windows.yml up
If you wish to run commands (e.g. backfills, list-selectors), you can run this separate command after a successful docker-compose up -d:
docker-compose exec server zenbot list-selectors
docker-compose exec server zenbot backfill <selector> --days <days>
Selectors
A "selector" is a short identifier that tells Zenbot which exchange and currency pair to act on. Use the form {exchange_slug}.{asset}-{currency}. A complete list of selectors your Zenbot install supports can be found with:
zenbot list-selectors
gdax:
gdax.BTC-EUR (BTC/EUR)
gdax.BTC-GBP (BTC/GBP)
gdax.BTC-USD (BTC/USD)
gdax.ETH-BTC (ETH/BTC)
gdax.ETH-USD (ETH/USD)
gdax.LTC-BTC (LTC/BTC)
gdax.LTC-USD (LTC/USD)
poloniex:
poloniex.AMP-BTC (Synereo AMP/BTC)
poloniex.ARDR-BTC (Ardor/BTC)
poloniex.BCN-BTC (Bytecoin/BTC)
poloniex.BCN-XMR (Bytecoin/XMR)
poloniex.BCY-BTC (BitCrystals/BTC)
...etc
Run a simulation for your selector
To backfill data (provided that your chosen exchange supports it), use:
zenbot backfill <selector> --days <days>
After you've backfilled, you can run a simulation:
zenbot sim <selector> [options]
For a list of options for the sim command, use:
zenbot sim --help
For additional options related to the strategy, use:
zenbot list-strategies
- By default the sim will start with 1000 units of currency. Override with
--currency_capitaland--asset_capital. - Open
sim_result.htmlin your browser to see a candlestick graph with trades.
Screenshot and example result
Zenbot outputs an HTML graph of each simulation result. In the screenshot below, the pink arrows represent the bot buying (up arrow) and selling (down arrow) as it iterated the historical data of GDAX exchange's BTC/USD product.

end balance 2954.50 (195.45%)
buy hold 1834.44 (83.44%)
vs. buy hold 61.06%
110 trades over 91 days (avg 1.21 trades/day)
Zenbot started with $1,000 USD and ended with $2,954.50 after 90 days, making 195% ROI! In spite of a buy/hold strategy returning a respectable 83.44%, Zenbot has considerable potential for beating buy/holders.
- Note that this example used tweaked settings to achieve optimal return:
--enable_profit_stop_pct=10,--profit_stop_pct=4,trend_ema=36, and--sell_rate=-0.006. Default parameters yielded around 65% ROI. - Raw data from simulation
Running zenbot
The following command will launch the bot, and if you haven't touched c.selector in conf.js, will trade the default BTC/USD pair on GDAX.
zenbot trade [--paper] [--manual]
Use the --paper flag to only perform simulated trades while watching the market.
Use the --manual flag to watch the price and account balance, but do not perform trades automatically.
Here's how to run a different selector (example: ETH-BTC on Poloniex):
zenbot trade poloniex.eth-btc
For a full list of options for the trade command, use:
zenbot trade --help
Usage: trade [options] [selector]
run trading bot against live market data
Options:
--conf <path> path to optional conf overrides file
--strategy <name> strategy to use
--order_type <type> order type to use (maker/taker)
--paper use paper trading mode (no real trades will take place)
--manual watch price and account balance, but do not perform trades automatically
--currency_capital <amount> for paper trading, amount of start capital in currency
--asset_capital <amount> for paper trading, amount of start capital in asset
--avg_slippage_pct <pct> avg. amount of slippage to apply to paper trades
--buy_pct <pct> buy with this % of currency balance
--sell_pct <pct> sell with this % of asset balance
--markup_pct <pct> % to mark up or down ask/bid price
--order_adjust_time <ms> adjust bid/ask on this interval to keep orders competitive
--order_poll_time <ms> poll order status on this interval
--sell_stop_pct <pct> sell if price drops below this % of bought price
--buy_stop_pct <pct> buy if price surges above this % of sold price
--profit_stop_enable_pct <pct> enable trailing sell stop when reaching this % profit
--profit_stop_pct <p
