Predicting the bitcoin price tomorrow with time series feature extraction and machine learning

Connell Gough
7 min readDec 8, 2019

In this post we’re going to see what kind of effect datetime features have on the daily closing price of bitcoin on the coinbase bitcoin exchange and see if we can make some predictions.

Setup:

check out the original post here.

import numpy as np  # to handle matrix
import pandas as pd # to handle data
from matplotlib import pyplot as plt # to visualize
from sklearn.metrics import accuracy_score
import shap
# load JS visualization code to notebook
shap.initjs()
import datetime # to handle time
import xgboost
import arrow
import holidays

We’ll be using daily pricing data from coinbase you can download it in the form of a csv here.

Load the data to a dataframe using pandas and drop all the row’s where the volume is 0 or filled with na

df = pd.read_csv('/Users/connellgough/bitcoinRF/coinbase_recent.csv')

indexNames = df[ df['Volume BTC'] == 0 ].index
df.drop(indexNames, inplace=True)
df.drop(['Symbol'], axis=1, inplace=True)
df.dropna(inplace=True)
df.describe()

--

--