Skip to content

shuhulx/TitansForecast

Repository files navigation

TitansForecast

14-day stock price forecasting for NIFTY 100 equities using the Titans Memory-as-Context transformer (NeurIPS 2025). 1.98M params, joint training on 98 stocks, walk-forward backtesting against naive and SMA baselines.

Titans MAC uses persistent neural memory that carries forward across the sequence — the model retains regime shifts and trend structure that fixed-window transformers lose.

Installation

git clone https://github.com/shuhulx/TitansForecast.git
cd TitansForecast
pip install -r requirements.txt

Usage

# train on all NIFTY 100 + predict RELIANCE.NS + launch dashboard
python main.py

# backtest only
python backtest.py

# API server
uvicorn api:app --host 0.0.0.0 --port 8000

# docker
docker-compose up --build

Model

dim=128, depth=6, heads=4, window=32, neural memory at layers (2, 4). 8 features: Close, Volume, SMA_20, SMA_50, RSI, Momentum, Sentiment (FinBERT), Volatility. Predictions are autoregressive — each day's output feeds the next day's input.

Scope

  • ✅ Titans MAC with persistent + long-term neural memory
  • ✅ Multi-stock generalist training (~450K sequences)
  • ✅ FinBERT sentiment (inference only; training uses neutral sentiment) + technical indicators
  • ✅ FastAPI + Dash + Docker
  • ✅ Online feedback learning on realized prices
  • ⚠️ Single model for all stocks — no per-stock specialization
  • ⚠️ Backtest omits transaction costs

References

License

MIT

About

NIFTY 100 equity forecasting with Google's Titans Memory- Augmented Transformer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors