Skip to content

RudraDudhat2509/OptiQuant

Repository files navigation

📈 OptiQuant

Quantitative Alpha Generation · Ensemble ML · Real-Time Backtesting


Python Streamlit Docker AWS LightGBM CatBoost


OptiQuant is an end-to-end quantitative trading intelligence platform — built to do what hedge funds do: engineer signals, blend models, eliminate lookahead bias, and surface alpha.


🔴 Live Demo →


🧭 What Is This?

Most stock prediction tools are toy projects. OptiQuant is not.

It's a full quantitative research pipeline — from raw OHLCV data → feature engineering → ensemble signal generation → backtesting with institutional-grade metrics. Deployed on AWS EC2. Containerized with Docker. Built for real analysis, not vibes.


🏗️ System Architecture

          ┌──────────────────────────────────────────┐
          │            RAW OHLCV DATA                │
          │  (CSV Upload or Live Manual Input)       │
          └─────────────────┬────────────────────────┘
                            │
                            ▼
          ┌──────────────────────────────────────────┐
          │         DataPreprocessing.py             │
          │  ┌────────────────────────────────────┐  │
          │  │  Feature Engineering (12+ signals) │  │
          │  │  • Momentum (1d, 5d, 20d returns)  │  │
          │  │  • Volatility (rolling std)        │  │
          │  │  • RSI (14-period)                 │  │
          │  │  • Risk-Adjusted Metrics           │  │
          │  │  • Lookahead-BiasFree Construction │  │
          │  └────────────────────────────────────┘  │
          └─────────────────┬────────────────────────┘
                            │
                            ▼
          ┌──────────────────────────────────────────┐
          │          ENSEMBLE MODEL LAYER            │
          │                                          │
          │   LightGBM ──┐                           │
          │   CatBoost ──┼──► Weighted Blend ──►     │
          │   RandomForest┘     Signal Score         │
          └─────────────────┬────────────────────────┘
                            │
                            ▼
          ┌──────────────────────────────────────────┐
          │         SIGNAL REFINEMENT                │
          │  • Volatility normalization              │
          │  • Smoothing function                    │
          │  • Daily cross-sectional ranking         │
          └─────────────────┬────────────────────────┘
                            │
                            ▼
          ┌──────────────────────────────────────────┐
          │        STREAMLIT DASHBOARD               │
          │  • Backtesting engine + metrics          │
          │  • Live prediction mode                  │
          │  • Interactive performance charts        │
          └──────────────────────────────────────────┘

✨ Core Features

🤖 Ensemble ML Engine

Three powerful models blend their predictions via weighted averaging — not just picking one winner. This reduces variance and improves signal stability across different market regimes.

Model Role
LightGBM Fast gradient boosting; excels at large-scale tabular features
CatBoost Handles categorical splits natively; robust to outliers
Random Forest Decorrelated trees; strong regularization via bagging

📐 Feature Engineering (Lookahead-Bias-Free)

All features are constructed using only past data, no future values leak into predictions. This is one of the most common and fatal mistakes in quantitative research. OptiQuant handles it correctly.

Engineered signals include:

  • Rolling momentum (1d, 5d, 20d returns)
  • Historical volatility (rolling standard deviation)
  • Relative Strength Index (14-period RSI)
  • Risk-adjusted return metrics
  • Volume-weighted signals

📊 Backtesting Engine

Upload any CSV with historical stock data and instantly evaluate the strategy's historical performance.

⚡ Live Prediction Mode

Input a single stock's current market data and receive a real-time signal score — ranked against the model's expected universe.


📈 Performance Metrics Explained

Metric What It Measures Why It Matters
Sharpe Ratio Risk-adjusted excess return The gold standard — penalizes volatility
Calmar Ratio Return ÷ Max Drawdown Performance during the worst periods
CAGR Compound Annual Growth Rate Annualized wealth accumulation rate
Max Drawdown Largest peak-to-trough loss Worst-case scenario exposure
Win Rate % of profitable days Consistency of positive returns

🖼️ Screenshots

Main Dashboard

UI Screenshot

Performance Metrics & Cumulative Return vs. Benchmark

Metrics Screenshot


🛠️ Tech Stack

Layer Technology
ML Models LightGBM, CatBoost, Scikit-learn (RandomForest)
Data Processing Pandas, NumPy
Frontend Streamlit
Deployment Docker + AWS EC2
CI/CD GitHub Actions
Serialization Joblib (.joblib model artifacts)

🚀 Getting Started

Option 1 — Run Locally

# Clone the repo
git clone https://github.com/RudraDudhat2509/OptiQuant.git
cd OptiQuant

# Install dependencies
pip install -r requirements.txt

# Launch the app
streamlit run app.py

Option 2 — Docker

# Build the image
docker build -t optiquant .

# Run the container
docker run -p 8501:8501 optiquant

Then open http://localhost:8501 in your browser.


📂 Project Structure

OptiQuant/
│
├── app.py                    # Streamlit frontend — all UI logic
├── DataPreprocessing.py      # Feature engineering pipeline
│
├── model_lgbm.joblib         # Trained LightGBM model artifact
├── model_cat.joblib          # Trained CatBoost model artifact
├── model_rf.joblib           # Trained RandomForest model artifact
│
├── notebooks/                # Research & training notebooks
├── data/                     # Sample datasets
│
├── Dockerfile                # Container definition
├── requirements.txt          # Python dependencies
├── .github/workflows/        # CI/CD pipeline (GitHub Actions)
└── .gitignore

📋 CSV Format for Backtesting

Your uploaded CSV must contain the following columns with at least 60 trading days per stock for reliable signal generation:

date, open, high, low, close, volume, Name
Column Type Description
date YYYY-MM-DD Trading date
open float Opening price
high float Daily high
low float Daily low
close float Closing price
volume int Shares traded
Name string Ticker or stock name

⚠️ Disclaimer

This tool is built for educational and research purposes only. It does not constitute financial advice. Past backtested performance does not guarantee future results. Always do your own due diligence before making investment decisions.


🔮 Roadmap

  • Add SHAP explainability — show which features drove each prediction
  • Support real-time data ingestion via Yahoo Finance / Alpha Vantage API
  • Portfolio-level backtesting with position sizing and rebalancing
  • Sector-neutral signal construction to remove market-wide bias
  • Export detailed backtest reports as PDF

Built with Python, gradient boosting, and a healthy obsession with avoiding lookahead bias.

🔴 Try the Live Demo · Report an Issue

About

AI-powered quantitative trading platform — ensemble ML (LightGBM + CatBoost + RF), backtesting engine, and live signal scoring. Deployed on AWS EC2 fornerly, now deployed on streamlit cloud

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors