Simple BTC Trading Bot Gekko - First Impressions

| Servers | 4 seen

The idea of using a bitcoin trading bot comes up just shortly I decided to trade up from 0.03 to 0.05 BTC. In the past, I've been using Coinlend bot to lend free coins on exchanges and earn some little interest.

Doing a quick google search I found a few bitcoin bot traders, most come with a price, but as I wanted to test how these bots actually work I continued my searches and found free bitcoin bot trader - Gekko.  Setting up this bot will be simple for a tech-savvy person, but might be a daunting task for a novice, as bot asks to install nodejs and in fact, it took me some 4 hours to set up this bot, as there were some issues (more on that at the end of this article)

Gekko is a free and open source Bitcoin TA trading and backtesting platform that connects to popular Bitcoin exchanges. It is written in javascript and runs on nodejs.

You can either create your own trading strategy or start with the built-in example strategies. Once you have a strategy you can use Gekko to automatically run it in a few different ways:

  • Backtest: You can start a simulation of the strategy over a historical data period and Gekko will tell you what would have happened (which trades would have been performed as well as overall performance and risk metrics).
  • Paper trader: You can run the strategy in realtime simulate trading (trade with fake money) to see in realtime how profitable your strategy would have been.
  • Tradebot: You can run the strategy in realtime and automatically execute orders based on the signals.

All the above modes can be run from the user interface, this interface will show charts and performance/risk statistics.

Installing Gekko on windows

To get Gekko running on Windows you need to do the following:

  • install nodejs
  • download Gekko
  • install Gekko's dependencies

Learn more about steps here: Installing Gekko on windows 

Issues I faced while tried to setup Gekko on Windows

At the start I had many issues regarding sqlite database, Gekko is powered out of the box after I changed sqlite to postgresql it went smoothly.

If you are experiencing issues related to sqlite database, locate config/general.toml and change to following

# what database should Gekko use?
adapter = 'postgresql'

After switching databases I was able to connect bot to Poloniex exchange and start live trading. But before live trades, I tested my strategies on backtesting

Backtesting on Gekko

​Gekko supports backtesting strategies over historical data. This means that Gekko will simulate running a strategy in realtime against a live market. Backtesting requires having data locally available already. After a backtest Gekko will provide statistics about the market and the strategy's performance.

As I'm not very well educated on technical analysis indicators I did a few backtests with RSI (Relative Strenght Index) for BTC/EXP pair on Poloniex

Backtesting on Gekko

Backtesting on Gekko

Gekko backtests using a very limited datasource (only OHCL candles). This means that Gekko estimates trades (and thus profits), which depending on the liquidity and market depth might be estimated very wrong. By configuring the paper trader's fee and slippage you can better mimic trading at the real market.

In order to backtest with 100% accuracy one would need the exact state of the orderbook (spread and depth) as well as information about orders happening around the time of each advice. With Gekko we made the decision to not store all this information (to simplify importing and storing market data). In voluminous and liquid markets this shouldn't be too much of a problem, but if you are backtesting over a small market (like some altcoins) the estimation will be of poor accuracy.

Live trades

After backtesting, I tried live trades, again in BTC/EXP pair and made a small, but nice profit after couple of hours

Live trades

Live trades

Despite bot said there is a 1.05% profit after the first trade when checked actual data on Poloniex, I saw a negative return (because of the fees), though, after a couple of hours and more trades, both bot and Poloniex reported positive gains.

As you can see from the picture above, the bot is a little bit glitchy, reporting strange values (see the second row in roundtrips, saying 48 years)