Downloads · 30 days
127
14% of all-time downloads
Karthikeya1233444/trademind-lstm
trademind-lstm is a machine learning model from Karthikeya1233444. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for keras. The card lists the license as mit.
LSTM-based stock price forecasting model trained on 2 years of daily OHLCV data.
Downloads · 30 days
127
14% of all-time downloads
All-time downloads
891
Public
Repo size
13.2 MB
Likes
0
Public
Click a slice to open those files.
.keras13.2 MB · 100%
From the Hugging Face model README
LSTM-based stock price forecasting model trained on 2 years of daily OHLCV data.
AAPL, TSLA, NVDA, MSFT, AMZN, GOOGL, META, AMD, JPM, NFLX
import pickle
import pandas as pd
from tensorflow.keras.models import load_model
import numpy as np
# Load model and scaler
model = load_model("AAPL_lstm.keras")
with open("AAPL_scaler.pkl", "rb") as f:
scaler = pickle.load(f)
# Prepare your DataFrame with columns: close, returns, ma5, ma20, volatility, rsi, macd
# df = your_dataframe (at least 60 rows)
features = ["close", "returns", "ma5", "ma20", "volatility", "rsi", "macd"]
data = df[features].values
scaled = scaler.transform(data)
seq = scaled[-60:].reshape(1, 60, len(features))
pred_scaled = model.predict(seq)[0]
dummy = np.zeros((5, len(features)))
dummy[:, 0] = pred_scaled
predicted_prices = scaler.inverse_transform(dummy)[:, 0]
print("5-day forecast:", predicted_prices)
This model is for educational and research purposes only. Not financial advice. Past performance does not guarantee future results.