Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pairs Trading Strategy – Indian Equities

Overview

This project implements a statistically driven pairs trading strategy for Indian equities using cointegration and mean reversion.

Methodology

  1. Pair selection via correlation + Engle Granger cointegration
  2. Structural filtering using half life of mean reversion
  3. Z-score calibration on 2020–2024 daily data
  4. Out of sample simulation on 2025 data
  5. Capital aware execution with stop loss and cooldown rules

Folder Structure

  • data/raw: input datasets
  • data/generated: reproducible outputs
  • src: full research and execution pipeline

Pipeline Overview

  1. Pair Selection (2020–2024)

    • Same sector filtering out of Nifty 100
    • Correlation screening
    • Engle Granger cointegration
    • Hedge ratio estimation
  2. Structural Validation

    • Mean reversion half life estimation
    • Spread stability checks
  3. z-Score Calibration

    • Rolling z-score using daily data
    • Entry / Exit threshold optimization
    • Drawdown-aware scoring
  4. Trading Engine (2025 Simulation)

    • Daily execution
    • Symmetric entry / exit / stop logic
    • Integer share sizing (Indian market compliant)
    • INR PnL accounting
    • Cooldown after stop loss
  5. Interactive Dashboard

    • Capital adjustable PnL
    • Pair wise trade breakdown
    • Cumulative performance visualization

How to Run

python src/Ppair_selector.py
python src/Pair_analysis 20-24.py
python src/z_backtest.py
python src/Engine_1d.py
streamlit run src/dashboard.py

About

An end to end python based quantitative pairs trading framework , built to replicate institutional style statistical arbitrage workflows from pair discovery and structural validation to signal calibration, execution logic, and performance visualization.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages