Spaces:
No application file
No application file
| import matplotlib.pyplot as plt | |
| def plot_stock_data(data, model): | |
| plt.figure(figsize=(12, 6)) | |
| plt.plot(data['Close'], label='Historical Close Price') | |
| # Add future predictions (for simplicity, assuming a constant rate) | |
| future_dates = pd.date_range(start=data.index[-1] + pd.Timedelta(days=1), periods=90) | |
| future_prices = model.predict(data[['SMA_5', 'SMA_10']].tail(1).values).repeat(90) # simplistic approach | |
| plt.plot(future_dates, future_prices, label='Predicted Future Price', color='orange') | |
| plt.title('Stock Price Prediction') | |
| plt.xlabel('Date') | |
| plt.ylabel('Price') | |
| plt.legend() | |
| plt.show() | |