Skip to content

RaresBares/QuantAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Financial Modeling Framework

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).

Features

  • 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

Neural Models

  • 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.

Classical Estimators

  • 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.

Aggregation

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.

Usage Example

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)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages