Photo by André François McKenzie on Unsplash

Time series analysis of Bitcoin price in Python with fbprophet ?!

Analyzes the price of Bitcoin in Python using fbprophet?

!pip install coinbase
api_key =  'xpto123'
api_secret = 'xpto123'
from coinbase.wallet.client import Client
client = Client(api_key, api_secret)
import datetime
def price_bitcoin_in_day(date_search):
return float((client.get_spot_price(currency_pair='BTC-BRL', date=date_search)).amount)
import pandas as pd#days = number of days searcheddef
# The first surveyed date is today (December 5, 2020) date_search =

#price is the price in reais found.
price = price_bitcoin_in_day(date_search)
#creating the list with the first values
data = [{'day': date_search, 'price': price}]
# informing the number of days to be searched
for i in range(1, days):
# Previous day's date
date_search = date_search - datetime.timedelta(days=1)
#Researching the price...
price = price_bitcoin_in_day(date_search)
#Added the new values searched and their dates to the list
data = data + [{'day' : date_search, 'price' : price}]

#returned the complete list
return data
dados = data_bitcoin_price_in_days(4015)
df_dados = pd.DataFrame(dados)


!pip install fbprophet
import Prophet
df_dados.rename(columns = {'day':'ds', 'price':'y'}, inplace = True)
m = Prophet(changepoint_prior_scale=0.15, daily_seasonality=True)
future = m.make_future_dataframe(periods=365)
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
from fbprophet.plot import plot_plotly, plot_components_plotly
plot_plotly(m, forecast)

I am sharing my opinion and what little I know of eventually here.

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