Algo-trading Cryptocurrency – Research

I was having this strategy in my mind for a while, but because algorithmic trading with stocks, forex and other classic instruments is not really straight-forward and you need quite big funds to start I have never made it to the production. With crypto its different — you are able to start trade with few bucks in pocket and few lines of code.


So before I hit the start button, I would like to know how my strategy performed in the past and also to be able to plug’n’play the strategy from staging to production. So I have created following structure, which will allow me to replace the Account and the Runner in production.

Crypto Algo trading - backetesting

I also would like to be able to hit stop button, when in production. So I have set it up as Node.JS express project. That will allow me create control interface in the future, that will be accessible from anywhere.



Coinbase has an endpoint for historical data, but it has a limit for 300 items. So you have to do multiple calls to obtain required time span. Below is my util function that downloads all the data for Bitcoin.

Watson Strategy

Here is my strategy. That follows long term mood with EMA. It has 3 variables — buy ratio, sell ratio and stop-loss. And basically watch two patterns:

  1. the long term mood – if it is bullish then prefer going long;  if it is bearish prefer going short.
  2. short term oscillation – if a candle ends below open -> buy; if candle ends above open -> sell

here is how it looks in code, that may be more descriptive.


Backtesting from 2019/01/01 to 2019/11/15 (11,5 months)

Algo-trading Cryptocurrency - Research - Watson 2019

Backtesting from 2016/01/01 to 2019/11/15 (~4 years)

Algo-trading Cryptocurrency - Research - Watson 2016 - 2019


You can download or fork the repo here


I didn’t have much time to test it yet so it may contain some bugs.

Buy me a coffeeOut of coffee 😱, please help!