Spaces:
No application file
No application file
Create gc
Browse files
gc
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import matplotlib.pyplot as plt
|
| 2 |
+
|
| 3 |
+
def plot_stock_data(data, model):
|
| 4 |
+
plt.figure(figsize=(12, 6))
|
| 5 |
+
plt.plot(data['Close'], label='Historical Close Price')
|
| 6 |
+
|
| 7 |
+
# Add future predictions (for simplicity, assuming a constant rate)
|
| 8 |
+
future_dates = pd.date_range(start=data.index[-1] + pd.Timedelta(days=1), periods=90)
|
| 9 |
+
future_prices = model.predict(data[['SMA_5', 'SMA_10']].tail(1).values).repeat(90) # simplistic approach
|
| 10 |
+
plt.plot(future_dates, future_prices, label='Predicted Future Price', color='orange')
|
| 11 |
+
|
| 12 |
+
plt.title('Stock Price Prediction')
|
| 13 |
+
plt.xlabel('Date')
|
| 14 |
+
plt.ylabel('Price')
|
| 15 |
+
plt.legend()
|
| 16 |
+
plt.show()
|