This repository implements a modular system for financial time series prediction, combining deep learning models and classical technical estimators.
Each model predicts short-term market movements based on rolling windows of historical data and engineered features (e.g., price, volume, RSI, SMA, MACD).
- Unified interface for all estimators (
fit,predict,save,load) - Deep learning models built with PyTorch
- Classical rule-based estimators for technical signals
- Simple integration and ensemble aggregation via
aggregator.py
- CNN1D_Price: Uses 1D convolutions to extract local temporal features from price sequences.
- LSTM_Price: Captures sequential dependencies in time series using LSTM cells.
- Transformer_Price: Models long-range relationships between features with attention layers.
- MLP_Features: A fully connected model for aggregated feature inputs.
All neural models inherit from TorchEstimator, which manages preprocessing, training loops, and inference.
- SMA_Crossover: Generates signals from the relationship between fast and slow moving averages.
- RSI: Detects overbought or oversold conditions based on the relative strength index.
- MACD: Uses the divergence between MACD and its signal line to estimate trend shifts.
- VolatilityBreakout: Reacts to abnormal price movements exceeding recent volatility thresholds.
aggregator.py introduces EndAI, a meta-model that learns to combine the predictions from multiple estimators into a unified signal.
It can be trained directly on historical signals and targets to optimize portfolio-level decisions.
from models.cnn1d import CNN1DPrice
from models.sma import SMAEstimator
from models.aggregator import train_endai, predict_endai
# Train individual models
cnn = CNN1DPrice("AAPL").fit(df)
sma = SMAEstimator("AAPL").fit(df)
# Combine outputs into an ensemble
history = df.join(cnn.predict(df), rsuffix="_cnn").join(sma.predict(df), rsuffix="_sma")
endai = train_endai(history)
signals = predict_endai(endai, history)