From Calculus to Kelly量化數理教科書 Contents and roadmap
A curriculum in 9 volumes

From Calculus
to Kelly

A quantitative curriculum that starts from first-year calculus, statistics and linear algebra, and ends with statistical models, optimized portfolios and growth-optimal leverage you can build and defend yourself.

從大一的微積分、統計學與線性代數開始,一路推進到自建統計模型、投資組合統計最佳化、計算真正的風險報酬,以及在估計誤差下求最適凱利槓桿。內文以英文為主,難懂之處附中文導讀。

Scope 9 volumes · 50 learning modules Published 7 of 50 Data Taiwan & US markets Edition 0.2 License MIT
Start reading: LM1 Exponentials, Logarithms and Compounding →

What you will be able to do

Vol III–V

Build statistical models

Return distributions, regressions and factor models, GARCH volatility, cointegrated spreads — estimated, diagnosed and stated with their uncertainty.

Vol II, VI

Optimize portfolios under estimation error

Mean–variance, risk parity and Kelly portfolios with realistic constraints, shrinkage estimators, and walk-forward evaluation.

Vol IV, VII

Measure true risk and return

Geometric growth instead of arithmetic averages, confidence intervals for Sharpe ratios, Deflated Sharpe, costs and biases removed.

Vol V, VIII

Size positions with Kelly leverage

From the binary bet to multi-asset leverage, with fat tails, parameter uncertainty, margin rules and drawdown limits.

Roadmap

Each volume hands specific tools to the volumes after it. The arrows name what is handed over. Everything converges on Volume VIII, where Kelly leverage needs stochastic calculus for the growth rate, portfolio theory for the multi-asset case, and honest risk statistics for the inputs.

VOL I · LM1–7Calculus for FinanceVOL II · LM8–12Linear Algebra for PortfoliosVOL III · LM13–18ProbabilityVOL IV · LM19–26Statistical InferenceVOL V · LM27–31Stochastic CalculusVOL VI · LM32–36Portfolio OptimizationVOL VII · LM37–40True Risk and ReturnVOL VIII · LM41–46Kelly and Optimal LeverageVOL IX · LM47–50Capstonegradients, Lagrangeintegrals, seriesdistributionsrandom walkswᵀΣwestimated μ, Σsampling errorItô, GBMtangency portfoliouncertainty in μsizing rules
Prerequisite map of the nine volumes. Select a volume to jump to its modules.

How each module works

Every module follows the same architecture, built for self-study with code.

  1. Learning Outcomes with mastery boxes you can tick; your ticks are remembered in this browser.
  2. Learning Module Overview: the main results in a few lines.
  3. Motivating Case: a real market situation the module resolves, with verified data.
  4. Numbered sections, each mapped to an outcome: intuition, definition, derivation, exhibit, worked example, pitfall.
  5. Knowledge Checks inside sections; Practice Problems and full Solutions at the end.
  6. Glossary (English–中文) and References; a companion Jupyter lab reproduces every number.
DefinitionThe precise statement of a term, in English.
ExampleA worked problem with its full solution.
PitfallA common mistake and how to avoid it.
導讀中文導讀:用中文把最難的直覺講清楚。
Deep DiveOptional proofs and rigorous detail, collapsed by default.
Knowledge CheckA short question with a hidden answer.
ExhibitTables and charts, numbered within each module; charts show values on hover.
InteractiveSliders that let you move the parameters of a result.

Notation and conventions

The same symbols mean the same thing in every module. Every approximation is marked and comes with the order of what it neglects; derivations are given in full or the result is labelled as stated without proof, with a reference.

simple (holding-period) return; adds across assets
log return; adds across time
mean and variance of simple returns
log growth rate per period (per year once annualized); what compounding delivers
growth factor over a holding period
periods per year used to annualize, always with its sample (243.1 sessions a year in the book's 0050 sample)
exposure, position value divided by equity (above 1 it is leverage); its growth-maximizing (Kelly) value
Sharpe ratio of a return, per day or annualized (say which)
standard normal density and distribution function
standard Brownian motion (W stays wealth)
exact; approximate with the neglected order stated; defined as

Contents

A module is published after an independent review recomputes its numbers and checks its mathematics; until then it is listed as in review.

Volume ICalculus for Finance

Compounding, approximation and optimization — the language every later volume is written in.

LMModuleStatus
LM1
Discrete vs continuous compounding; simple vs log returns; why logs make time additive.
Available
PDF
LM2
Marginal thinking, the chain rule, elasticity; duration as a derivative.
Available
PDF
LM3
Local polynomial models, error bounds, volatility drag, leveraged-ETF decay, duration–convexity.
Available
PDF
LM4
First- and second-order conditions, concavity, the binary Kelly bet, Newton's method.
Available
PDF
LM5
Areas, accumulation and expectation as an integral; the Gaussian integral.
Available
PDF
LM6
Geometric series, annuities, perpetuities, bond and dividend-discount pricing.
Available
PDF
LM7
Gradients, Hessians, multivariate Taylor, constrained optimization; the two-asset minimum-variance portfolio.
Available
PDF

Volume IILinear Algebra for Portfolios

Portfolios are vectors and risk is a quadratic form; this volume makes that literal.

LMModuleStatus
LM8
Vectors and Matrices
Weights, returns and the dot product; portfolio return as wᵀr.
Planned
LM9
Linear Systems, Inverses and Rank
Solving for weights; singular matrices as perfect collinearity.
Planned
LM10
Quadratic Forms and Covariance Matrices
wᵀΣw, positive (semi)definiteness, matrix calculus.
Planned
LM11
Eigen-decomposition and PCA
Eigen-portfolios of Taiwan sectors; condition numbers and why Σ⁻¹ amplifies error.
Planned
LM12
Cholesky, SVD and Least Squares
Simulating correlated returns; OLS as a projection.
Planned

Volume IIIProbability

Random variables as functions, expectation as the workhorse, and the distributions markets actually produce.

LMModuleStatus
LM13
Probability Foundations and Bayes
Sample spaces, conditional probability, Bayes' rule; a random variable is a function.
Planned
LM14
Random Variables, Expectation and Jensen's Inequality
LOTUS, moments, E[R²] = σ² + μ², and the real reason for volatility drag.
Planned
LM15
Distributions in Finance
Normal, lognormal, Student-t and Poisson, fitted to TAIEX returns.
Planned
LM16
Joint Distributions and Dependence
Covariance, conditional expectation, the multivariate normal, crash correlation.
Planned
LM17
Law of Large Numbers and Central Limit Theorem
Why the median path, not the mean path, is what you live through.
Planned
LM18
Monte Carlo Simulation and the Bootstrap
Random generation, simulation error, variance reduction, resampling.
Planned

Volume IVStatistical Inference and Econometrics

Turning a return series into estimates you can defend, with their uncertainty attached.

LMModuleStatus
LM19
Descriptive Statistics of Returns
Location, dispersion, shape; the √T rule and when it fails.
Planned
LM20
Estimation Theory and Maximum Likelihood
Bias, variance, MSE; why SE(μ̂) = σ/√T ignores sampling frequency.
Planned
LM21
Hypothesis Testing and Multiple Testing
p-values, power, Bonferroni and FDR; the t > 3 hurdle for strategies.
Planned
LM22
Resampling Methods
Block and stationary bootstrap; confidence intervals for Sharpe and Kelly.
Planned
LM23
Linear Regression
From simple to multiple OLS in matrix form; HAC errors; CAPM beta and factor models.
Planned
LM24
Bayesian Inference and Shrinkage
Priors, posteriors, James–Stein; fractional Kelly as a Bayesian answer.
Planned
LM25
Time Series I: ARMA, Unit Roots and Cointegration
Stationarity, mean reversion, the futures–spot basis.
Planned
LM26
Time Series II: Volatility Models
EWMA, GARCH, and realized volatility from 5-second TAIEX data.
Planned

Volume VStochastic Calculus

The continuous-time tools behind GBM, Itô's lemma and the continuous Kelly result.

LMModuleStatus
LM27
From Random Walk to Brownian Motion
Scaling limits, quadratic variation, and what (dB)² = dt really means.
Planned
LM28
The Itô Integral and Itô's Lemma
Itô's lemma derived as a Taylor expansion that keeps its second-order term.
Planned
LM29
Geometric Brownian Motion
Solving the SDE; lognormal prices; mean, median and mode.
Planned
LM30
Beyond GBM
Ornstein–Uhlenbeck spreads, Merton jumps for Taiwan gap days, stochastic volatility.
Planned
LM31
Option Pricing Bridge (Optional)
Black–Scholes by delta hedging; Greeks; TXO and warrants.
Planned

Volume VIPortfolio Optimization

Mean–variance theory, the convex machinery to solve it, and the estimation error that breaks it.

LMModuleStatus
LM32
Portfolio Return and Risk
N-asset portfolio mathematics in matrix form.
Planned
LM33
Mean–Variance Optimization
Lagrangian derivation, global minimum variance, the frontier, tangency and the CML.
Planned
LM34
Convex Optimization in Practice
Quadratic programs, KKT conditions, cvxpy; long-only, leverage and turnover limits.
Planned
LM35
Estimation Error and Robust Portfolios
The 1/N puzzle, Ledoit–Wolf shrinkage, Black–Litterman, resampling.
Planned
LM36
Risk Parity, HRP and Volatility Targeting
Euler risk contributions and risk-based allocation.
Planned

Volume VIIMeasuring True Risk and Return

What a track record really says once compounding, fat tails, costs and selection are accounted for.

LMModuleStatus
LM37
VaR, Expected Shortfall and Drawdown
Parametric, historical and Monte Carlo VaR; ES; drawdown statistics.
Planned
LM38
The Statistics of the Sharpe Ratio
Standard errors (Lo 2002), Probabilistic and Deflated Sharpe, minimum track record.
Planned
LM39
Backtesting Without Fooling Yourself
Survivorship and look-ahead bias, Taiwan taxes and fees, walk-forward, PBO.
Planned
LM40
Stress Testing
Taiwan crash scenarios (2008, 2015, 2020, 2024/8/5, 2025/4/7) and overnight gaps.
Planned

Volume VIIIThe Kelly Criterion and Optimal Leverage

Growth-optimal sizing from the binary bet to multi-asset leverage under uncertainty.

LMModuleStatus
LM41
Discrete Kelly
Binary and general discrete bets; position size vs risk size; sensitivity to p.
Planned
LM42
Continuous-Time Kelly
g(f) by Itô, f* = SR/σ, g* = r + SR²/2, and the 2f* ruin line.
Planned
LM43
Multi-Asset Kelly
f* = Σ⁻¹(μ − r): the tangency portfolio, levered.
Planned
LM44
Fractional Kelly and Drawdown Control
CRRA equivalence, drawdown probabilities, risk-constrained Kelly.
Planned
LM45
Kelly Under Uncertainty and Frictions
Parameter uncertainty, fat tails and jumps, rebalancing, financing costs, bootstrap Kelly.
Planned
LM46
Leverage Instruments in Practice
TX, MTX and TMF futures; 00631L and TQQQ; margin regimes.
Planned

Volume IXCapstone

Everything assembled into working research pipelines on Taiwan and US data.

LMModuleStatus
LM47
The Statistical Modeling Workflow
Data, model, diagnostics, decision — end to end.
Planned
LM48
Capstone A: A Taiwan Core–Satellite Portfolio
Mean–variance vs risk parity vs Kelly, compared walk-forward.
Planned
LM49
Capstone B: Kelly Sizing a Single Strategy
From backtest returns to fractional Kelly on TX futures, uncertainty included.
Planned
LM50
Capstone C: Multi-Strategy Allocation and Monitoring
Constrained multi-strategy Kelly, re-estimation and monitoring.
Planned

Labs, data and environment

Each module ships with a Jupyter notebook that rebuilds its exhibits. Labs are Polars-first and use NumPy, SciPy and Matplotlib; later volumes add statsmodels, cvxpy and arch. Taiwan data come from FinMind and US data from FinMind's US price tables. FinMind's licence does not allow its raw data to be redistributed, so the repository lists every file the book uses with a checksum: download them once with your own FinMind token, and the labs then run offline. The Python environment is managed by uv and pinned in uv.lock.

Shell
git clone https://github.com/Benjamin-Teng/Quant-math-for-beginner.git
cd Quant-math-for-beginner
uv sync                                  # Python 3.13 environment, versions pinned by uv.lock
export FINMIND_TOKEN="your-token"
uv run python data/fetch_finmind.py      # download the raw data and check every file
uv run python data/make_lab_data.py      # build each lab's data/ folder
uv run --with jupyterlab jupyter lab labs/

Edition notes

Edition 0.2 (11 October 2026). Volume I complete: LM1–LM7 with their labs. Each module passed an independent review, a blind solve of every question with a key check, a full audit of its numbers from the raw data and verified revision rounds; LM3 was revised the same way. Wide formulas and tables now fit the printed page, and equation numbers and punctuation no longer collide with formulas.

Edition 0.1 (10 October 2026). Roadmap, contents and conventions, and the sample module LM3 with its lab. Volumes are released in order, starting with Volume I.

A personal study project. Educational material only; nothing here is investment advice. Text and code are released under the MIT License. Market data: FinMind.