From 30547452222b3e7e200e9659dc0ec250e064a3be Mon Sep 17 00:00:00 2001 From: sandeshsk12 <68961973+sandeshsk12@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:38:01 +0530 Subject: [PATCH] Forecast code added with comments --- forecast_code.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 forecast_code.py diff --git a/forecast_code.py b/forecast_code.py new file mode 100644 index 0000000..b9f63ef --- /dev/null +++ b/forecast_code.py @@ -0,0 +1,21 @@ +# import pmdarima as pm + +arima_model=pm.auto_arima(eth_vwap_close,seasonal=False,stepwise=True,supress_warnings=True) + + +#Forecast the next 5 periods +n_periods=5 +forecast,conf_int = arima_model.predict(n_periods=n_periods,return_conf_int=True) + + +trace1 = go.Scatter(x=list(range(1, len(eth_vwap_close)+1)), y=eth_vwap_close, mode='lines+markers', name='close') + +# create a trace for the 'forecast' data with NaN for missing values + +trace2=go.Scatter(x=list(range(len(eth_vwap_close)+1, len(eth_vwap_close)+len(forecast)+1)),y=forecast, mode='lines+markers',name='forecast') + +fig2=go.Figure(data=[trace1,trace2]) + +#create the plotly figure +# show the plot +fig2.write_html('forecast_chart.html')