• Piatra Engineering, Erskineville NSW, AUSTRALIA

post-image

Algorithmic Crypto Trading

Project Overview

This project consumes API data from financial sources, currency data and the buy/sell orders from a bitcoin API from a crypto (Bitcoin) exchange.

These metrics are normalised and fed into a TensorFlow machine learning neural network along with eventual price movements either up or down. Once the network has been trained for long enough, the program then runs attempting to identify preconditions for strong upwards or downwards movements in the Bitcoin price.

When confidence is high enough, the program will then access the trading platform secure API to automatically execute Buy or Sell trades, limited by available funds or holdings.

Implementation

The project is implemented in Python and TensorFlow. The Python requests library is used to access web-based data. The crypto broker provides relatively time resolved snapshots not just of crypt prices but also the entire buy and sell order book. This establishes the depth of unfilled buy and sell orders, in order to capture current price and sentiment. There are also broad signals used to capture an indication of wider market sentiment such as the DXY US dollar exchange or relative movement in Gold price for the day.

We are trying to avoid adding in signals that are uncorrelated to price fluctuations (obviously) since they either introduce noise or are at best ignored and down weighted by the machine learning model. We also need to have signals that capture rather abstract quantities - such as market risk appetite, etc. This means trying to include quantities not extrinsically related to the price of bitcoin.

The size of orders on the book is as important as the price. The price points of orders on the book is normalised to the current price. Orders most likely to be filled (since they are close to market price) are more significant that wild orders far from the current price. Prices are normalised to the current bitcoin price. Volumes are normalised to current trading volumes. This results in an array of 256 normalised inputs fed into the TensorFlow model.

The Learning stage is not performed in real time, but rather some time after input data is collected (say 1 hour) so that the model output is trained against actual price movements after a period of time.

The Trading stage runs within preset trading limits based on risk appetite and to limit potential losses. This stage is hosted on a Heroku cloud server.

Notes

  • Limited trading volume based on balance
  • Can run in virtual mode without actually trading
  • Strong indicators of movement can be notified to user via SMS or similar
  • Trades Bitcoin or other volatile assets with large short term fluctuations
  • Conceptual demonstration only