Skip to content

Quant Lab · free · 44 modules

Quantitative finance, from first principles.

Quantitative finance from first principles, in Python, on real Indian market data. Each module is one idea: the intuition, the maths, a short program you can run and edit in your browser, and what it shows on real NSE data.

Start with Drawdowns →

Run the code herePython, numpy and pandas run in your browser. Nothing to install. Change a number and run it again.
Real Indian dataEvery module tests the idea on NSE index closes since 2013, which you can download free.
Numbers you can checkEvery figure on a page was printed by its program. If the code doesn't print it, we don't claim it.
Practise itExercises, interview questions and a mini project with a starter notebook in every module.

LEVEL I

Money, Time and Chance

Returns, compounding, present value and the probability every model is built on.

  1. MODULE 1 · SOONReturns: Simple, Log and Annualisedwhy log returns add up over time and simple returns don't; annualising a daily return
  2. MODULE 2 · SOONCompounding and Present Valuefuture value, discounting a cash flow to today, why time beats rate
  3. MODULE 3 · SOONInflation and Real Returnsnominal vs real return, the Fisher relation, what 6% inflation does to a fixed deposit
  4. MODULE 4 · SOONExpected Valueprobability-weighted average outcome; positive-EV bets can still lose; the house edge
  5. MODULE 5 · SOONConditional Probability and Bayes' Ruleupdating beliefs with evidence; why a 90%-accurate signal on a rare event is mostly wrong
  6. MODULE 6 · SOONThe Random Walkprices as a sum of random steps; why charts of random walks look like trends
  7. MODULE 7 · SOONThe Square-Root-of-Time Rulevolatility grows with the square root of the horizon; daily to annual
  8. MODULE 8 · SOONThe Bell Curvemean, standard deviation, the 68-95-99.7 rule, z-scores

LEVEL II

Risk and Reward

Volatility, drawdowns, risk-adjusted returns and the maths of mixing investments.

  1. MODULE 9 · SOONVolatilitystandard deviation of returns, annualising, rolling volatility
  2. MODULE 10DrawdownsThe loss that hurts is measured from the peak, and recovering costs more than the fall.
  3. MODULE 11 · SOONThe Sharpe and Sortino Ratiosreturn per unit of risk; downside-only risk; the risk-free rate in India
  4. MODULE 12 · SOONVolatility Dragarithmetic vs geometric mean; why +50% then -50% loses money; sigma squared over two
  5. MODULE 13 · SOONCovariance and Correlationhow two return series move together; correlation is not causation and is unstable
  6. MODULE 14 · SOONDiversificationportfolio variance with two assets; how low correlation cuts risk
  7. MODULE 15 · SOONThe Efficient Frontierall mixes of a few assets, the minimum-variance portfolio, why estimates make it fragile
  8. MODULE 16 · SOONBeta and the CAPMbeta as a regression slope, expected return under CAPM, alpha

LEVEL III

Bets, Sizing and Bad Days

Simulation, fat tails, Value at Risk and how much to bet.

  1. MODULE 17 · SOONMonte Carlo Simulationsimulating thousands of futures; percentiles of outcomes for a SIP
  2. MODULE 18 · SOONFat Tailskurtosis; how often 4-sigma days happen vs what the bell curve says
  3. MODULE 19 · SOONValue at Risk and Expected Shortfallhistorical and parametric VaR, why expected shortfall is better
  4. MODULE 20The Kelly CriterionHow much should you bet when you have an edge? The answer that maximises long-run growth.
  5. MODULE 21 · SOONRisk of Ruinprobability of losing a set fraction of capital given win rate, payoff and bet size
  6. MODULE 22 · SOONPosition Sizingfixed-fractional and volatility-targeted sizing; the same strategy with different sizes
  7. MODULE 23 · SOONSequence-of-Returns Risksame returns in a different order; why withdrawals make order matter

LEVEL IV

Evidence from Data

Telling skill from luck, and backtests that don't lie to you.

  1. MODULE 24 · SOONEstimates and Error Barsstandard error of a mean return; why years of data give wide error bars
  2. MODULE 25 · SOONLuck or Skill?how many coin-flipping fund managers beat the market by chance; multiple testing
  3. MODULE 26 · SOONFitting a Line to Returnsleast squares, slope and intercept, R squared, residuals
  4. MODULE 27 · SOONMemory in Pricesautocorrelation of returns and of squared returns; trends vs volatility clustering
  5. MODULE 28 · SOONHonest Backtestslook-ahead bias, survivorship bias, costs and out-of-sample testing
  6. MODULE 29 · SOONOverfittingtrying many parameters until one works; in-sample vs out-of-sample decay
  7. MODULE 30 · SOONTrading Costs in Indiabrokerage, STT, exchange charges, GST, stamp duty and slippage on equity and F&O; turnover kills edges

LEVEL V

Bonds and Derivatives

Yields, futures, options and the models that price them, with NSE examples.

  1. MODULE 31 · SOONBonds, Yields and Durationprice as discounted coupons, yield to maturity, modified duration, convexity
  2. MODULE 32 · SOONFutures and the Cost of Carryfair futures price = spot x (1 + r - dividend yield) over time; basis and arbitrage
  3. MODULE 33 · SOONThe Binomial Option Modelreplicating portfolio, risk-neutral probability, pricing a call on a one- and many-step tree
  4. MODULE 34 · SOONBrownian Motion and Stock Price Pathsgeometric Brownian motion, simulating paths, the log-normal distribution of prices
  5. MODULE 35 · SOONBlack-Scholesthe formula for a European call and put, inputs, put-call parity
  6. MODULE 36 · SOONThe Greeks and Hedgingdelta, gamma, theta, vega; delta-hedging an option
  7. MODULE 37 · SOONImplied Volatility and the Smilebacking volatility out of a price with Newton's method; why the smile exists
  8. MODULE 38 · SOONThe Maths of Option Sellinghigh win rate, fat left tail; expected value of a short strangle in a simulation

LEVEL VI

Signals and Portfolios

Momentum, mean reversion, volatility models, factors and regimes.

  1. MODULE 39 · SOONMomentumtime-series momentum; twelve-minus-one; why it works sometimes and crashes
  2. MODULE 40 · SOONMean Reversion and Pairsz-score of a spread, half-life, cointegration intuition
  3. MODULE 41 · SOONVolatility Clustering and GARCHcalm and stormy periods; a GARCH(1,1) recursion by hand
  4. MODULE 42 · SOONFactor Models and PCAa few common drivers explain many assets; principal components of sector returns
  5. MODULE 43 · SOONMarket Regimescalm vs stressed states; a two-state mixture; why regime labels are only clear in hindsight
  6. MODULE 44 · SOONRisk Parity and Risk Budgetingweights that equalise risk contributions instead of capital

Education only. Not investment, tax or trading advice. We never tell you what to buy or sell.