Quantitative Finance with Python

Build quant finance from scratch: returns, bonds, portfolios, risk, options, the Greeks, and a backtester.

10 projects, 250 hands-on levels, run in your browser.

Syllabus

  • Financial Foundations: Everything in quantitative finance is built on returns: how much an investment gained or lost. Build simple and log returns, chain them into cumulative growth, compound money forward and discount it back, and turn a price history into annualized performance. By the end you analyze a real price series end to end.
  • The Time Value of Money: A dollar today is worth more than a dollar tomorrow, and putting cash flows on a timeline is how finance values everything. Build present and future value of cash-flow streams, annuity and perpetuity formulas, net present value with its accept/reject rule, and the internal rate of return found by root-finding. The capstone evaluates a real investment project.
  • Fixed Income and Bonds: Bonds are the largest market in the world, and they are pure time-value-of-money: a price is the present value of coupons and principal. Build bond pricing, the yield to maturity found by root-finding, and the two key risk measures, duration and convexity, that quantify how a bond's price moves when interest rates change. The capstone prices a bond and estimates its response to a rate shock.
  • Risk and Statistics: Return is only half the story; risk is the other half. Build the statistics of uncertainty: variance and volatility, the normal and lognormal distributions that model returns, covariance and correlation between assets, and Value at Risk with its tail-loss cousin CVaR. The capstone turns a return series into a complete risk report.
  • Portfolio Theory: Markowitz showed that risk and return are managed not asset by asset but at the portfolio level, where diversification reshapes the trade-off. Build portfolio return and risk from weights and a covariance matrix, the two-asset frontier and its minimum-variance point, the efficient frontier by simulation, and the maximum-Sharpe (tangency) portfolio. The capstone optimizes a real multi-asset portfolio.
  • Stochastic Models of Prices: Prices move randomly, and modeling that randomness is the foundation of derivatives pricing and risk simulation. Build the random walk, scale it into Brownian motion, turn that into geometric Brownian motion (the standard model of stock prices), and run Monte Carlo simulations of thousands of price paths. The capstone is a Monte Carlo price-simulation engine.
  • Options Pricing: Options are the right, not the obligation, to buy or sell, and pricing them is the crown jewel of quantitative finance. Build option payoffs and moneyness, the put-call parity that links them, the binomial tree that prices by risk-neutral valuation, and the celebrated Black-Scholes formula. The capstone prices an option three ways and recovers its implied volatility.
  • The Greeks and Hedging: The Greeks are the sensitivities of an option's price to its inputs, the quantities every options desk lives by. Build delta (sensitivity to price), gamma (its rate of change), vega (sensitivity to volatility), theta (time decay), and rho (sensitivity to rates), then use them to delta-hedge a position. The capstone builds a full risk dashboard and a delta-hedged portfolio.
  • Time Series and Trading Signals: Systematic trading turns price history into buy and sell decisions. Build the moving averages and exponential filters that smooth prices, rolling and EWMA volatility estimates, autocorrelation that distinguishes momentum from mean reversion, and the signals (crossover and z-score) that generate positions. The capstone is a complete signal pipeline from prices to strategy returns.
  • Capstone: Backtesting a Strategy: The capstone of the track: turn a trading signal into a rigorously evaluated strategy. Build the equity curve and drawdown, the performance metrics (annualized return, volatility, Sharpe, Calmar), a buy-and-hold benchmark to beat, transaction costs that erode returns, and finally a complete backtesting engine. This assembles every tool from the whole track into one system.

Key concepts

  • Black-Scholes: A model pricing European options from the spot, strike, time, rate, and volatility, assuming lognormal prices.
  • Compounding: Earning returns on prior returns; value grows as principal*(1+r)^n, the exponential engine of long-term growth.
  • Convexity: The curvature of the price-yield relationship; a second-order correction to duration that matters for large rate moves.
  • Duration: The sensitivity of a bond's price to interest rates: the price-weighted average time to its cash flows. Longer duration means more rate risk.
  • Portfolio variance: The variance of a portfolio's return, which depends on each asset's variance and the covariances between them; diversification lowers it.
  • Present value: Today's worth of a future cash flow, discounted by a rate: PV = CF / (1+r)^n. The basis of all valuation.
  • Return: The gain or loss on an investment over a period, as a fraction of the starting value. Log returns add over time.
  • Sharpe ratio: Excess return per unit of volatility, the standard risk-adjusted performance measure. Higher is better.
  • The Greeks: Sensitivities of an option's price: delta (to spot), gamma (to delta), vega (to volatility), theta (to time), rho (to rates). Used to hedge.
  • Value at Risk (VaR): The loss not expected to be exceeded at a given confidence over a horizon (e.g., 95% 1-day VaR). Parametric VaR uses the normal distribution.
  • Volatility: The standard deviation of returns, a measure of risk. Scales with the square root of time.