In [1]:
import datetime
import pandas as pd
import numpy as np
from fbprophet import Prophet
In [2]:
dfs = pd.read_html('https://coinmarketcap.com/currencies/ardor/historical-data/?start=20130428&end={}'.format(datetime.datetime.today().strftime('%Y%m%d')))
df = dfs[0]
df.tail()
Out[2]:
In [3]:
df = df.drop(columns=['Open', 'High', 'Low', 'Volume', 'Market Cap'])
df = df.rename(columns={'Date': 'ds', 'Close': 'y'})
df.tail()
Out[3]:
In [4]:
df['y'] = np.log(df['y'])
df.tail()
Out[4]:
In [5]:
m = Prophet()
m.fit(df)
Out[5]:
In [6]:
future = m.make_future_dataframe(periods=365)
future.tail()
Out[6]:
In [7]:
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
Out[7]:
In [8]:
m.plot(forecast)
Out[8]:
In [9]:
m.plot_components(forecast)
Out[9]:
In [ ]: