Labs
One lab per part, written on the House library. Each is seeded, runs in seconds on simulated data, checks its own result against the theory it illustrates, and ends with three things to change.
pip install numpy scipy matplotlib numba
python -m videos.quant.labs --list
python -m videos.quant.labs 26 --show
python -m pytest -q tests/test_quant_labs.py
Lab 1 · The Fair GameIs it a random walk, and is it Gaussian?
Lab 2 · The Machinery of MarketsMargin, leverage and the liquidation price
Lab 3 · Value, Accounting and the FirmA DCF, its duration, and the rate a price implies
Lab 4 · Martingales and MeasureThe doubling system against a fair coin
Lab 5 · Stochastic CalculusQuadratic variation, and the order of a simulation scheme
Lab 6 · Financial EconometricsA predictive regression that predicts nothing
Lab 7 · Time Series and VolatilityFit a GARCH, then race the forecasts
Lab 8 · Decisions and ControlHow much to bet: Kelly, half Kelly, double Kelly
Lab 9 · No ArbitrageNo arbitrage is a linear program
Lab 10 · Black–Scholes–MertonManufacture an option by delta hedging
Lab 11 · Trading OptionsGamma against theta: explain a day's P&L
Lab 12 · The Volatility SurfaceFit a smile, read its density, break it
Lab 13 · Stochastic Volatility and JumpsHeston: the smile from a characteristic function
Lab 14 · Rough and Path-Dependent VolatilityRough volatility: estimate H, then price the skew
Lab 15 · Exotics and Structured ProductsBarriers, and what a snowball buyer has sold
Lab 16 · Computing PricesMonte Carlo, variance reduction and Sobol: the race
Lab 17 · Deep Pricing and HedgingLearn a price from payoffs, with and without their derivatives
Lab 18 · Money, Bonds and the CurveDuration, convexity, and three factors from one assumption
Lab 19 · Term-Structure ModelsOne short rate, a whole yield curve
Lab 20 · CreditCorrelation decides who loses: the pool and its tranches
Lab 21 · Counterparty Risk, XVA and ClearingExposure, collateral and CVA on one swap
Lab 22 · FX, Commodities and the BasisCarry: the forward curve and what the roll pays
Lab 23 · Risk and ReturnThe efficient frontier, true and estimated
Lab 24 · FactorsDoes the model price the portfolios? The GRS test
Lab 25 · The Factor ZooThree hundred factors, thirty real: four hurdles
Lab 26 · Backtesting Without Fooling YourselfThe best backtest of nothing, and the deflated Sharpe ratio
Lab 27 · Machine Learning for ReturnsDouble descent, and why returns need the ridge
Lab 28 · Text, LLMs and Alternative DataScreening for the words that carry sentiment
Lab 29 · Alpha Mining and Automated ResearchMining alphas out of noise
Lab 30 · Portfolio ConstructionThe minimum-variance portfolio and its broken promise
Lab 31 · Risk Models, Costs and Trading Through TimeFrom IC to information ratio to capacity
Lab 32 · Systematic Macro and Alternative PremiaWhy trend following has positive skew
Lab 33 · Statistical ArbitrageThe optimal band for a mean-reverting spread
Lab 34 · Inside a Quant FirmHow long does a portfolio manager's seat last?
Lab 35 · Who Trades With WhomWhy there is a spread: Glosten-Milgrom and Kyle
Lab 36 · The Limit Order BookThe next tick from the queues, and clustered order flow
Lab 37 · Market Impact and ExecutionOptimal execution: urgency against impact
Lab 38 · Market Making, ETFs and the Speed RaceThe speed race sets the spread
Lab 39 · Crypto and DeFiAn AMM's liquidity provider: loss versus rebalancing
Lab 40 · Measuring RiskBacktest a risk model
Lab 41 · Leverage, Liquidity and CrisesSpirals and contagion
Lab 42 · Machines in the MarketHerding and the stylized facts
Lab 43 · Can You Beat the Market?Skill or luck? Counting the funds with real alpha