trading bitcoin and online time series...

19
Seoul Artificial Intelligence Meetup Trading Bitcoin and Online Time Series Prediction Adel SOHBI Seoul Artificial Intelligence Meetup 30th September 2017

Upload: others

Post on 17-Aug-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Trading Bitcoin and Online Time SeriesPrediction

Adel SOHBISeoul Artificial Intelligence Meetup30th September 2017

Page 2: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Article Review

30th June 2017 Trading Bitcoin and Online Time Series Prediction 2

Page 3: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

The Results

30th June 2017 Trading Bitcoin and Online Time Series Prediction 3

Page 4: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Why Trading Bitcoin?

25th June 2017 Trading Bitcoin and Online Time Series Prediction4

Page 5: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Aim of the Article

n Forecasting Bitcoin price changes for algorithmictrading.

n Make scalable and accurate forecasts in real-time, given a live stream of time series data.

30th June 2017 Trading Bitcoin and Online Time Series Prediction 5

Page 6: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

The Problem

n Prediction: For any time t, given the historical pricetime series up to time t, predict the price for future time instances, s ≥ t + 1.

n Trading: For any time t, using current investment and predictions, decide whether to buy new Bitcoins or sell any of the Bitcoins that are in possession.

30th June 2017 Trading Bitcoin and Online Time Series Prediction 6

Page 7: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Simple Trading Strategy

n Focus predictions accuracy. The trading strategy isto demonstrate the utility of predictions.

n Trading Model:

Where h[t] = 1, if we are in possession of a Bitcoin at time t and h[t] = 0, otherwise.

30th June 2017 Trading Bitcoin and Online Time Series Prediction 7

Page 8: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Article Contributions

n Theoretical framework for time series analysis based: stationarity and mixing.

n Simple, scalable, real-time algorithms for predictionand trading that yield high prediction accuracy and highly profitable returns on investment in Bitcoin.

30th June 2017 Trading Bitcoin and Online Time Series Prediction 8

Page 9: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Stationary and Mixing Time Series

n A time series is said to be:• Stationary if its joint probability distribution is time-

invariant. • Mixing if the distribution at a specific time is primarily

dependent on the recent past.

n Classical time series regression algorithm : ARIMA (AutoRegressive Integrated Moving Average) has poor performances.

n Overcome this limitation with a new model.

30th June 2017 Trading Bitcoin and Online Time Series Prediction 9

Page 10: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Bitcoin Data

n OKCoin exchange using their APIs. All prices are reported in Chinese Yuans. The APIs return lists of bid[t] and ask[t] at the time t.

n Several months of data from the exchange in 2014, 2015 and 2016.

n Estimate of price:

30th June 2017 Trading Bitcoin and Online Time Series Prediction 10

Page 11: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Stationarity and Mixing

n Tests reveal that the Bitcoin price time series is not stationary.

n Let y[t] be the time series produced by the first-differences:

n The first-differences of the Bitcoin price time series isstationary and mixing.

30th June 2017 Trading Bitcoin and Online Time Series Prediction 11

Page 12: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Classical Modeling: ARIMA

30th June 2017 Trading Bitcoin and Online Time Series Prediction 12

Page 13: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Stationarity and Mixing

n Stationary and mixing suggest there exist a large enough d such that:

n Stationary:

30th June 2017 Trading Bitcoin and Online Time Series Prediction 13

Page 14: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

The Model

30th June 2017 Trading Bitcoin and Online Time Series Prediction 14

n The model:

n Define a 3-dimensional probability vector:

Page 15: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Method

n Interest is truly in this 3-dimensional.

n The problem effectively reduces to ternary-state classification

n Generate training data as follows:

30th June 2017 Trading Bitcoin and Online Time Series Prediction 15

Page 16: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Method

n The goal is to learn F (·) ∈ [0, 1], using a classification algorithm.

n Choice of classification algorithms:• Random Forest (RF), • Logistic Regression (LR) and • Linear Discriminant Analysis (LDA).

n Learn the transition probability distribution functionP(x[t]|x[t − d : t − 1]).

30th June 2017 Trading Bitcoin and Online Time Series Prediction 16

Page 17: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Method

30th June 2017 Trading Bitcoin and Online Time Series Prediction 17

n We require the model to produce a probabilityassociated with each prediction to give us a sense of confidence in each individual prediction.

n Trading Model:

n Combining multiple predictions:

Page 18: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Experiments and Results

30th June 2017 Trading Bitcoin and Online Time Series Prediction18

Page 19: Trading Bitcoin and Online Time Series Predictionseoulai.com/presentations/Trading_Bitcoin_and_Online... · 2019. 10. 8. · n Forecasting Bitcoin price changes for algorithmic trading

Seoul Artificial Intelligence Meetup

Quick Summary

n Learning framework based on properties such as stationarity and mixing.

n Limitations of classical time series methods likethe ARIMA models.

n Prediction accuracy near 70% with Classification Algorithms.

n High return on average Bitcoin investment (e.g. 6-7x, 4-6x and 3-6x return on investments for tests in 2014, 2015 and 2016),

25th June 2017 Trading Bitcoin and Online Time Series Prediction19