Spaces:
Running
Running
changes
Browse files- pages/stock_prediction.py +0 -53
pages/stock_prediction.py
CHANGED
@@ -106,56 +106,3 @@ st.dataframe(df_1.style.set_properties(**{'font-size': '20px'}),width=1000)
|
|
106 |
forecast = pd.concat([rolling_price,forecast])
|
107 |
|
108 |
|
109 |
-
# def Moving_average_forecast(forecast):
|
110 |
-
# # Ensure enough data exists
|
111 |
-
# if len(forecast) <= 30:
|
112 |
-
# return "Not enough data to plot."
|
113 |
-
|
114 |
-
# # Convert index to datetime if needed
|
115 |
-
# if not isinstance(forecast.index, pd.DatetimeIndex):
|
116 |
-
# forecast.index = pd.to_datetime(forecast.index)
|
117 |
-
|
118 |
-
# fig = go.Figure()
|
119 |
-
|
120 |
-
# # First trace: Past close prices
|
121 |
-
# if len(forecast.index[:-30]) > 0:
|
122 |
-
# fig.add_trace(go.Scatter(
|
123 |
-
# x=forecast.index[:-30],
|
124 |
-
# y=forecast['Close'].iloc[:-30],
|
125 |
-
# mode='lines',
|
126 |
-
# name='Close Price',
|
127 |
-
# line=dict(width=2, color='blue')
|
128 |
-
# ))
|
129 |
-
# else:
|
130 |
-
# st.warning("No data available for past close prices.")
|
131 |
-
|
132 |
-
# # Second trace: Future close prices
|
133 |
-
# if len(forecast.index[-31:]) > 0:
|
134 |
-
# fig.add_trace(go.Scatter(
|
135 |
-
# x=forecast.index[-31:],
|
136 |
-
# y=forecast['Close'].iloc[-31:],
|
137 |
-
# mode='lines',
|
138 |
-
# name='Future Close Price',
|
139 |
-
# line=dict(width=2, color='red')
|
140 |
-
# ))
|
141 |
-
# else:
|
142 |
-
# st.warning("No data available for future close prices.")
|
143 |
-
|
144 |
-
# fig.update_layout(
|
145 |
-
# title="Moving Average Forecast",
|
146 |
-
# xaxis_title="Date",
|
147 |
-
# yaxis_title="Close Price",
|
148 |
-
# height=500,
|
149 |
-
# plot_bgcolor='white',
|
150 |
-
# paper_bgcolor='#E1EFFF',
|
151 |
-
# legend=dict(yanchor='top', xanchor='right')
|
152 |
-
# )
|
153 |
-
|
154 |
-
# return fig
|
155 |
-
|
156 |
-
# # Plot with debug checks
|
157 |
-
# fig = Moving_average_forecast(forecast.iloc[150:])
|
158 |
-
# if isinstance(fig, str):
|
159 |
-
# st.warning(fig)
|
160 |
-
# else:
|
161 |
-
# st.plotly_chart(fig, use_container_width=True)
|
|
|
106 |
forecast = pd.concat([rolling_price,forecast])
|
107 |
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|