Bitcoin Price Forecast

Tadros Salama

4/28/2021

Over the past year the price of bitcoin has risen more than 300%, growth rarely seen in traditional financial markets. Bitcoin is notorious for it’s unpredictable price movements and volatility. So what could be more fun than forecasting the potential price of bitcoin a year out?!

There is close to 19 million bitcoin in circulation with a cap of 21 million bitcoin that can be minted. It’s scarcity, similar to gold, has been one of it’s most appealing qualities too investors. So in this forecast the price of bitcoin, PriceUSD and it’s supply, SplyCur will be the two variables I use.

In this forecast I used historical data from coinmetrics tracking daily data from June 2010 till April 2021.

EDA

## Using `date` as index variable.
## # A tsibble: 6 x 5 [1D]
##   date       PriceUSD   SplyCur NVTAdj logPrice
##   <date>        <dbl>     <dbl>  <dbl>    <dbl>
## 1 2021-04-09   58052. 18678126.   78.3     11.0
## 2 2021-04-10   59652. 18679107.   84.0     11.0
## 3 2021-04-11   59933. 18680014.  127.      11.0
## 4 2021-04-12   59906. 18680914.   68.8     11.0
## 5 2021-04-13   63446. 18681801.   60.2     11.1
## 6 2021-04-14   62869. 18682645.   NA       11.0

#box_cox transofrmation
lambda <- data_btc %>% 
  select(PriceUSD) %>% 
  features(PriceUSD, features = guerrero) %>%
  pull(lambda_guerrero)

data_btc %>%  
  select(PriceUSD) %>%
  autoplot(box_cox(PriceUSD, lambda))

#Log transformation
data_btc %>%
  autoplot(log(PriceUSD))

ARIMA

fit_arima <- btc_log %>%
  model(ARIMA(logPrice))
accuracy(fit_arima)
## # A tibble: 1 x 10
##   .model        .type           ME   RMSE    MAE   MPE  MAPE  MASE RMSSE    ACF1
##   <chr>         <chr>        <dbl>  <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl>   <dbl>
## 1 ARIMA(logPri… Training  -5.80e-5 0.0530 0.0309 -1.71  3.27 0.326 0.362 4.91e-4
fit_arima %>% forecast(h='12 months') %>% autoplot(btc_log)

fit_arima %>% gg_tsresiduals()

glance(fit_arima)
## # A tibble: 1 x 8
##   .model           sigma2 log_lik     AIC    AICc     BIC ar_roots  ma_roots 
##   <chr>             <dbl>   <dbl>   <dbl>   <dbl>   <dbl> <list>    <list>   
## 1 ARIMA(logPrice) 0.00282   5955. -11894. -11894. -11844. <cpl [9]> <cpl [3]>

ETS

fit_ets <- btc_log %>%
  model(
    ses = ETS(logPrice ~ error("A") + trend("N") + season("N")),
    holt = ETS(logPrice ~ error("A") + trend("A") + season("N")),
    damped = ETS(logPrice ~ error("A") + trend("Ad") + season("N")),
    ets1 = ETS(logPrice)
  ) 

fit_ets <- btc_log %>%
  model(ETS(logPrice))

fit_ets %>%
  forecast(h = '12 months') %>%
  autoplot(btc_log)

fit_ets %>%
  gg_tsresiduals()

Nueral Net

nns <- btc_log %>%
  model(NNETAR(logPrice))
nns %>% forecast(h='12 months') %>%
  autoplot(btc_log)