helloadhavan/Stock-pile
Viewer • Updated • 5.39M • 144 • 1
This model was trained on the Stock-Pile dataset. It is a custom LSTM architecture with a learned ticker embedding, trained on about 5 million rows of daily stock data covering hundreds of companies across US, European and Asian markets. Given the previous 30 trading days, it predicts the next day's Open, High, Low, Close and log-Volume. It is a learning and experimentation project, not financial advice.
| File | Purpose |
|---|---|
loader.py |
Model, Normalizer and load_model |
config.json |
Ticker ids, per-ticker normalization statistics and training logs |
stock_predictor/model.pth |
Trained weights |
MODEL_CARD.md |
Architecture, data, evaluation and limitations |
Download the repo by running:
huggingface-cli download helloadhavan/stock-LSTM
import torch
from .stock-LSTM.loader import load_model, Normalizer
model = load_model("stock_predictor/model.pth", "config.json")
normalizer = Normalizer("config.json")
window = {
"Open": open_t,
"High": high_t,
"Low": low_t,
"Close": close_t,
"Volume": torch.log1p(volume_t),
}
x = normalizer(window, "AAPL")
ticker_id = normalizer.ticker_ids["AAPL"]
ids = torch.full((x.shape[0], 1), float(ticker_id))
inputs = torch.cat([x, ids], dim=-1).unsqueeze(0)
with torch.no_grad():
prediction = model(inputs)
result = normalizer.denormalize(prediction[0], "AAPL")
result["Volume"] = torch.expm1(result["Volume"])
Each tensor in window has shape (30,). denormalize returns a dict of prices and log-Volume, so apply torch.expm1 to get raw volume.
log1p-transformed before normalizing.config.json are supported.