At the start of 2018 we created our first crypto arbitrage bot. We were looking to take advantage of the price difference of ethereum between the Kraken and GDAX exchanges. We took a very simple approach to doing the actual trades. We used the ccxt library to do live comparison of the order books. Whenever this comparison resulted in a profitable trade we would insert a limit order on the one exchange. Upon the filling of that order we then execute a market order on the other exchange. And initiate the transfer of crypto from the cheap exchange to the expensive exchange.  This would make sure that our risk on changing prices would be minimised. At some point all the crypto on the cheap exchange would be depleted and then we would cash out all accumulated euro's from the more expensive exchange. Upon receiving the money from the bank we would deposit it back to the cheap exchange, on which we would buy as much crypto as possible and repeat the cycle.

This was very lucrative for a period of about twelve weeks. After which the price difference evaporated and it became harder to execute profitable trades. By then we decided to abandon this project as sufficient profit had been made.

Stack

We used the following elements in our stack:

  • BUNQ (As it was the only bank with API support back in 2018)
  • Docker
  • PostgreSql (For storing trading data)
  • Chronograph (For storing timeseries and current price data)
  • Flask (for hosting a GUI for the trader)
  • Python (to actually do the trading)
  • CCXT (Trading library to have a unified connection to all exchanges)

We used a stack of postgresql, python, nodeJs and VueJs (for some visualisation) additionally it was our first experiment with a timeseries database (chronograph). Towards the later part of the twelve weeks we were busy with optimising the trading algorithm to only conduct trades when there was significant profit to be made.

Currently we have archived this project but a fully functional git repository is available. If people are interested in a copy, please send us a message and we will make the repository public.