Your hands-on workspace for learning quantitative trading from the ground up.
Think of this as your personal research lab where you can explore how professional traders actually think about markets. I've taken three foundational papers from industry legends and turned them into working Python code you can experiment with.
I've implemented three major frameworks that cover the core of quantitative trading:
Learn what actually matters when you're trading with real money. Peter Muller (Morgan Stanley) breaks down:
- Why Sharpe Ratio is king for market-neutral strategies
- The Grinold-Kahn framework (the math behind "more bets vs better bets")
- How transaction costs kill strategies that look great on paper
- Risk management that actually works
Ever wonder how institutions trade millions of shares without moving the market? This shows you:
- The fundamental trade-off: execute fast (high impact) vs slow (high risk)
- How to calculate the optimal execution trajectory
- Why the answer is usually "exponential decay" (trade more upfront, taper off)
Check out the microstructure tools →
Get inside the mechanics of how markets actually work:
- Order flow imbalance (buy pressure vs sell pressure)
- Bid-ask spreads (what you're really paying to trade)
- Price impact (how your trades move the market)
trading-lab/
│
├── papers/ # Paper-based conceptual work
│ ├── muller_proprietary_trading/
│ │ ├── notes.md # Key concepts & insights
│ │ ├── references.md # Citations & links
│ │ └── Muller_Proprietary_trading.pdf
│ │
│ ├── almgren_chriss_execution/
│ │ ├── notes.md # Execution theory
│ │ └── references.md
│ │
│ └── hasbrouck_microstructure/
│ ├── notes.md # Microstructure concepts
│ ├── empirical_notes.md # Data patterns
│ └── references.md
│
├── notebooks/ # Interactive experiments
│ ├── muller_proprietary_trading.ipynb
│ ├── microstructure/ # (future)
│ └── execution/ # (future)
│
├── src/ # Reusable code
│ ├── muller_framework.py
│ ├── portfolio_construction.py
│ ├── microstructure/ # (future)
│ ├── execution/ # (future)
│ └── utils/
│
├── experiments/ # Robustness analysis
│ ├── robustness_tests.md
│ ├── parameter_instability.md
│ └── regime_dependence.md
│
├── data/ # Datasets
│ ├── raw/
│ └── processed/
│
└── references.md # Master reading list
First, grab the Python packages you'll need:
cd quantitative-trading-lab
pip install -r requirements.txtThat's it! You're ready to start exploring.
from src.muller_framework import SharpeRatioCalculator, StrategyEvaluator
import numpy as np
# Calculate Sharpe Ratio
returns = np.random.normal(0.001, 0.02, 252)
calc = SharpeRatioCalculator()
sharpe = calc.calculate(returns)
# Evaluate strategy
evaluator = StrategyEvaluator()
metrics = evaluator.evaluate(returns)from src.execution.almgren_chriss import AlmgrenChrissModel, MarketParams, ExecutionParams
# Define parameters
market = MarketParams(volatility=0.02, lambda_temp=0.01, gamma_perm=0.001)
execution = ExecutionParams(total_shares=100000, num_periods=10, risk_aversion=1.0)
# Calculate optimal trajectory
model = AlmgrenChrissModel(market, execution)
holdings = model.optimal_trajectory()
expected_cost = model.expected_cost()from src.microstructure.order_flow import OrderFlowAnalyzer
from src.microstructure.spread import SpreadAnalyzer
from src.microstructure.impact import PriceImpactAnalyzer
# Order flow analysis
analyzer = OrderFlowAnalyzer()
ofi = analyzer.calculate_ofi(trades, window='1min')
# Spread analysis
spread_analyzer = SpreadAnalyzer()
effective_spread = spread_analyzer.effective_spread(price, bid, ask, direction)
# Price impact
impact_analyzer = PriceImpactAnalyzer()
kyle_lambda = impact_analyzer.estimate_kyle_lambda(price_changes, signed_volumes)jupyter notebook notebooks/muller_proprietary_trading.ipynb
jupyter notebook notebooks/execution/almgren_chriss_simulation.ipynb
jupyter notebook notebooks/microstructure/order_flow_imbalance.ipynbEach paper comes with detailed notes that explain not just what the math says, but why it matters:
- notes.md - The key ideas, explained in plain English
- references.md - Where to go deeper
- empirical_notes.md - What to actually look for when you analyze real data
- Muller's Notes - Start here if you're new to quant trading
- Almgren-Chriss Notes - For when you need to execute large orders
- Hasbrouck Notes - Understand what's happening under the hood
- Experiments Guide - Test your strategies' robustness
- Full Reading List - Papers worth your time
This is the foundation for a series of quantitative trading research projects. I've planned out 10 additional projects that progressively build understanding of market microstructure, execution, and trading systems.
Check out the full ROADMAP for detailed plans including:
Phase 1: Microstructure Foundations
- Limit Order Book Simulator
- Liquidity Regime Lab
- Order Flow & Absorption Diagnostics (optional)
- Execution Cost Model (Almgren-Chriss)
Phase 2: Market Structure & Time Effects
- FX Session Microstructure
- Stylized Facts of FX Markets
Phase 3: Impact, Discovery & Complexity
- Slippage & Market Impact Analyzer
- Price Discovery & Fragmentation Lab
- Market as Complex Adaptive System
Phase 4: Robustness, Failure & Production
- Strategy Failure Modes Library
- Microstructure-Aware Backtesting Engine
Each project includes visual diagrams, core components, and clear learning objectives. The roadmap focuses on mechanism, diagnosis, and execution realism—not alpha chasing.
- Paper-First: Start with academic/industry research
- Understand Deeply: Create detailed notes on concepts and failure modes
- Implement Cleanly: Build modular, well-documented code
- Test Rigorously: Robustness tests, regime analysis, out-of-sample validation
- Document Findings: Track what works, what doesn't, and why
Sharpe Ratio: Primary metric for market-neutral strategies
SR = Annual Excess Return / Annualized Std Dev
Grinold-Kahn Framework: Fundamental Law of Active Management
SR² = N × (IC² / (1 - IC²))
Key Insight: Focus on depth (improving one strategy) over breadth (many weak strategies)
Trade-off: Market impact vs price risk
Optimal Strategy: Balance execution speed with cost minimization
Order Flow: Buy/sell imbalance predicts short-term price moves
Spread Components: Processing costs + adverse selection + inventory costs
- Parameter sensitivity analysis
- Out-of-sample validation
- Regime testing (bull/bear, high/low vol)
- Data quality stress tests
- When do models break?
- Parameter instability detection
- Regime change identification
- Crisis behavior
See experiments/ for detailed frameworks.
| Paper | Notes | Code | Notebooks | Status |
|---|---|---|---|---|
| Muller | ✅ | ✅ | ✅ (1) | Complete |
| Almgren-Chriss | ✅ | ✅ | ✅ (1) | Complete |
| Hasbrouck | ✅ | ✅ | ✅ (3) | Complete |
Total: 3 papers, 7 Python modules, 5 Jupyter notebooks
Muller - Proprietary Trading:
src/muller_framework.py- Sharpe Ratio, risk management, Grinold-Kahnsrc/portfolio_construction.py- Position sizing, portfolio optimizationnotebooks/muller_proprietary_trading.ipynb- Interactive tutorial
Almgren-Chriss - Optimal Execution:
src/execution/almgren_chriss.py- Optimal trajectory, cost analysis, simulationnotebooks/execution/almgren_chriss_simulation.ipynb- Execution strategies
Hasbrouck - Market Microstructure:
src/microstructure/order_flow.py- OFI, trade classification, VAR modelssrc/microstructure/spread.py- Spread decomposition, Roll modelsrc/microstructure/impact.py- Kyle's lambda, impact modelsnotebooks/microstructure/order_flow_imbalance.ipynb- OFI analysisnotebooks/microstructure/bid_ask_spread.ipynb- Spread analysisnotebooks/microstructure/price_impact.ipynb- Impact analysis
Utilities:
src/utils/data_loader.py- Data generation and validationsrc/utils/plotting.py- Visualization utilities
We welcome contributions! Whether you want to:
- Implement a new paper
- Add unit tests
- Improve documentation
- Fix bugs
- Add examples
Check out CONTRIBUTING.md for guidelines.
- New Papers: Fama-French factors, momentum strategies, volatility models
- Tests: Unit tests for core modules
- Examples: Real data analysis, strategy backtests
- Documentation: Clarify concepts, add tutorials
MIT License - See LICENSE
This is a learning tool, not a money-printing machine. Trading is hard, and most people lose money. Use this to understand the concepts, test ideas, and learn—but don't bet your rent money on anything you build here.
Seriously: paper trade first, backtest thoroughly, and never risk more than you can afford to lose.
See references.md for complete reading list.
Core Papers:
Rignesh
Happy trading! 📈
Questions? Found a bug? Want to add a new paper? Open an issue or submit a PR. This is a learning project—let's make it better together.