Rough Bitcoin Prediction with Time Series Forecasting

Time Series Forecasting, what exactly does it mean ?

Example of sales time series forecasting between 2017 February & 2018 April graph

How to build the dataset ? Which preprocessing method we used ?

  • The start time of the time window in Unix time
  • The open price in USD at the start of the time window
  • The high price in USD within the time window
  • The low price in USD within the time window
  • The close price in USD at end of the time window
  • The amount of BTC transacted in the time window
  • The amount of Currency (USD) transacted in the time window
  • The volume-weighted average price in USD for the time window
  • We first cleaned the raw data, we only wanted the close price in USD at the end of the time window so we extract only this column.
  • After that, we proceeded with the curation step that consist of converting the format of our data, we switch from minutes to hours in order build the correct time windows.
  • Third step was to divide the dataset into training dataset and testing dataset, we’ve split the data into 80 % of the data into training data and 20 % into testing data.
  • As we had our training dataset and testing dataset, we needed to preprocess it before giving it to our model. We applied the standardization method (following formula) using the mean and standard deviation of the data in order to scale our data between 0 and 1 respectively.
Standardization (or Z-score normalization) Formula
  • After that we build our time windows to keep only the last 24 hours, and we called the tf.keras.preprocessing.timeseries_dataset_from_array() that creates the dataset of sliding windows over the provided time series.
  • And we have now a functional training dataset and testing dataset that can be used with our models !

How to setup the dataset as a tensorflow dataset ?

Chosen architecture : The Long Short-Term Memory (LTSM) architecture

Simple LTSM version

Deep LTSM version

Deeper LTSM version

Models performance and results

Raw Data Graph

Simple LTSM version

Simple LSTM Architecture Loss Performance
Simple LSTM Architecture Predictions

Deep LTSM version

Deep LSTM Architecture Loss Performance
Deep LSTM Architecture Predictions

Deeper LTSM version

Deeper LSTM Architecture Loss Performance
Deeper LSTM Architecture Predictions

Conclusion

Co-authored by

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store