Becoming a Mathematical Expert on the Desk Read Logic
A 12-month, ~1β3 hr/week program that takes you from applied/self-taught to genuinely expert on the mathematics behind fp-terminal β by using your own system as the lab. Balanced: every concept is derived by hand, then built on your own NQ data.
How to use this file: work top-to-bottom. Each module has a Goal, the Concepts, a π Derive task (paper/whiteboard), a π» Build task (code against your data), a Primary resource, and a β Milestone that proves you've got it. Check the boxes. Don't rush β mastery at 2 hrs/week is a marathon. One module every ~3β4 weeks is the target.
The map β every Desk Read number, and the math that makes it
| Desk Read component | Where in code | The math underneath |
|---|---|---|
| Gamma walls / flip / cage | lib/uw.ts (getNqLevels), computeGamma |
BlackβScholes, the Greeks (Ξ, Ξ), dealer gamma exposure (GEX), delta-hedging feedback |
openBias P(up 5m) |
lib/openBias.ts |
Logistic regression, log-odds, MLE, feature standardization, calibration |
Expected range a+bΒ·VIX |
lib/openingRange.ts |
OLS regression, implied vs realized vol, βt scaling, RΒ²/residuals |
| Econ-surprise range widen | lib/econSurprise.ts |
z-scores, event studies, t-tests, regime analysis |
| Accuracy tracker | lib/scoreBrief.ts |
Sampling distributions, hypothesis testing, overfitting, expectancy, R-multiples |
| POC / value area | market profile | Volume-weighted distributions, kernel density |
| Cross-asset factors (VXN, rates, USD) | lib/openBias.ts, lib/snapshot.ts |
Correlation, covariance, multiple regression, multicollinearity |
Keep this table taped to your monitor. The whole point is that by the end you can look at any number the terminal prints and know exactly what estimator produced it, what its assumptions are, and where it can lie to you.
Phase 0 β Orientation & lab setup (Week 1)
Goal: see the whole machine, and set up the environment you'll use all year.
- [ ] Install a Python + Jupyter/notebook lab (you have
/opt/anaconda3). Libraries:numpy,pandas,scipy,statsmodels,matplotlib,scikit-learn. - [ ] Pull one week of NQ 1-min RTH bars via your existing Databento path (
scripts/backtest-range.mjsalready caches these underscripts/.cache/β reuse them). - [ ] Open
lib/openingRange.ts,lib/openBias.ts,lib/scoreBrief.tsand just read them. You won't understand the math yet β that's fine. Note every symbol you can't explain. - π» Build: reproduce one Desk Read number from raw data by hand in the notebook β e.g. take a day's VIX and compute the m15 expected range using the current
MODELcoefficients, and confirm it matches what the email printed. - β Milestone: you can state, in one sentence each, what all 7 rows of the map table do β even if not yet why.
Phase 1 β Foundations you'll actually use (Weeks 2β13)
Applied/self-taught means we build the real foundation β but only the parts the Desk Read uses.
Module 1 β Probability & distributions
Goal: the language of uncertainty; why prices are ~lognormal and returns ~normal.
Concepts: random variable, PMF/PDF, expectation & variance, the Normal and Lognormal, the 68-95-99.7 rule, conditional probability, Bayes' theorem.
- π Derive: show that if log-returns are Normal(ΞΌ, ΟΒ²), price is Lognormal; compute E[price] and why it's not e^ΞΌ.
- π» Build: histogram NQ 1-min open returns for 200 days; overlay a fitted Normal; measure the fat tails (kurtosis). This is why the range model uses Ο and why extreme opens happen more than "normal" predicts.
- π Blitzstein & Hwang, Introduction to Probability (ch. 1β5) + StatQuest videos.
- β
Milestone: compute P(NQ moves > 100 pts in the first 5 min) two ways β empirically from the tape and analytically from a fitted Normal β and explain the gap.
Module 2 β The calculus of sensitivity
Goal: derivatives are rates of change β and gamma is a second derivative.
Concepts: derivative as slope, partial derivatives, the gradient, Taylor expansion (1st + 2nd order), finite-difference approximation.
- π Derive: Taylor-expand an option's value in the underlying: dV β ΞΒ·dS + Β½ΞΒ·dSΒ². That single line is the entire reason dealer gamma moves markets β sit with it.
- π» Build: take any option-price formula (you'll implement BlackβScholes in M8; for now use a library), and get Ξ and Ξ numerically by finite differences. Plot Ξ vs strike.
- π 3Blue1Brown, Essence of Calculus (all 12 short episodes).
- β
Milestone: explain "long gamma dampens, short gamma amplifies" using only the Β½ΞΒ·dSΒ² term.
Module 3 β Statistics, estimation & significance
Goal: tell a real edge from noise β the skill that saved the range model from a bad "fix."
Concepts: estimator, sampling distribution, standard error, Central Limit Theorem, confidence intervals, hypothesis testing, p-values, t-statistics.
- π Derive: the standard error of a proportion β(p(1βp)/n); use it to compute how many sessions you need before a 55% hit-rate is distinguishable from a coin flip.
- π» Build: take the accuracy tracker's bias hit-rate and put a 95% confidence interval on it. Re-examine the "+71% range error on 6 days" β show numerically it was small-sample noise (this is the exact reasoning that stopped us widening the model).
- π Practical Statistics for Data Scientists (Bruce & Bruce), ch. 1β3.
- β
Milestone: given any backtest stat, state its standard error and whether n is large enough to trust it.
Module 4 β Linear algebra & least squares
Goal: the machinery behind every regression in the system.
Concepts: vectors & dot products, matrices as linear maps, the design matrix, the normal equations Ξ² = (Xα΅X)β»ΒΉXα΅y, projections.
- π Derive: get the OLS slope/intercept for y = a + bΒ·x by minimizing squared error (set the two partial derivatives to zero β ties back to M2).
- π» Build: hand-code OLS with numpy (no statsmodels) and re-fit the range model range% = a + bΒ·VIX; confirm you reproduce MODEL.m15 in lib/openingRange.ts (a=-0.064, b=0.029 from the 485-session refit).
- π 3Blue1Brown, Essence of Linear Algebra (episodes 1β9).
- β
Milestone: your from-scratch OLS matches statsmodels and matches the deployed coefficients to 3 decimals.
Phase 2 β Volatility & the range model (Weeks 14β21)
Module 5 β Volatility: implied, realized, and the βt rule
Goal: understand what VIX is and why range scales the way it does.
Concepts: realized vol, implied vol, VIX construction (variance swap intuition), annualization, variance is additive over time β Ο scales with βt, why the model has separate 1m/5m/15m rows.
- π Derive: from "variance adds over independent periods," show the expected range over t minutes scales like βt. Then explain why the fitted coefficients (M4) don't perfectly obey βt (microstructure, opening auction, mean-reversion).
- π» Build: convert a VIX level to an expected 1-min NQ move from first principles (annual Ο β per-minute Ο β points); compare to MODEL.m1. Explain the gap as the intercept a.
- π Sinclair, Volatility Trading (ch. 1β3); Natenberg, Option Volatility & Pricing (vol chapters).
- β
Milestone: derive an expected-range number from VIX with zero fitted parameters, then explain what the fitted a, b are correcting for.
Module 6 β Regression done right (and how it lies)
Goal: OLS assumptions, diagnostics, and the overfitting trap that backtests fall into.
Concepts: OLS assumptions, RΒ² and what it doesn't say, residual plots, heteroskedasticity, in-sample vs out-of-sample, regularization intuition, regime dependence.
- π Derive: why RΒ² always rises when you add regressors (β why you need out-of-sample validation).
- π» Build: fully reproduce scripts/backtest-range.mjs in Python: fit on 2024β2025, test on 2026; show the full-sample fit is stable but the recent-120 fit collapses (rβ0.11) β i.e., diagnose the overfit yourself.
- π An Introduction to Statistical Learning (ISLR β free PDF), ch. 3.
- β
Milestone: you can look at a regression and list three ways it could be fooling you.
Phase 3 β Options & dealer gamma: the cage (Weeks 22β33)
Module 7 β Random walks β Brownian motion β ItΓ΄ (intuition, no measure theory)
Goal: the stochastic model prices are built on.
Concepts: random walk, scaling limit β Brownian motion, geometric Brownian motion (GBM), volatility as diffusion, ItΓ΄'s lemma as a Taylor expansion where dSΒ² doesn't vanish (ties straight back to M2's Ξ term).
- π Derive: informally get ItΓ΄'s dV = (βV/βt + Β½ΟΒ²SΒ²Β·βΒ²V/βSΒ²)dt + β¦ by Taylor-expanding and keeping dSΒ² = ΟΒ²SΒ²dt. The βΒ²V/βSΒ² is gamma β the whole story rhymes.
- π» Build: Monte-Carlo 10,000 GBM NQ paths; price a call as e^{-rT}Β·mean(payoff); watch it converge.
- π Wilmott, Paul Wilmott Introduces Quantitative Finance (Brownian/ItΓ΄ chapters) β friendliest treatment.
- β
Milestone: simulate NQ paths and explain, physically, what Ο and drift do.
Module 8 β BlackβScholes & the Greeks
Goal: the closed form, and what each Greek means for hedging. Concepts: the BS formula, N(dβ)/N(dβ), the BS PDE as a hedging argument, Ξ Ξ Ξ Ξ½ Ο; where Ξ peaks (ATM, near expiry) β the key to walls. - π Derive: get Ξ = N(dβ) and sketch why the BS PDE says "a delta-hedged option earns theta = pays for gamma." - π» Build: implement BS + all Greeks in Python; validate against your Monte-Carlo price (M7). Plot Ξ(S) and confirm it spikes ATM and blows up into expiry β this is why 0-DTE walls are sharp. - π Hull, Options, Futures, and Other Derivatives (the Greeks chapters); Natenberg for intuition. - β Milestone: your BS price matches Monte-Carlo to <0.5%; you can explain the gamma-theta trade-off out loud.
Module 9 β Dealer Gamma Exposure (GEX): building the cage
Goal: aggregate the Greeks across the chain into the flip, walls, and cage the terminal draws.
Concepts: market-maker inventory & delta-hedging feedback, net GEX = Ξ£ (dealer Ξ Γ OI Γ contract-multiplier Γ SΒ²), the flip point (net dealer gamma = 0), long-Ξ³ (dampening/mean-revert) vs short-Ξ³ (amplifying/trend), call wall / put wall as gamma peaks.
- π Derive: show why a long-gamma dealer sells rallies / buys dips (stabilizing) and a short-gamma dealer does the opposite (destabilizing) β from dΞ = ΞΒ·dS and "hedge back to delta-neutral."
- π» Build: pull a real NDX/QQQ option chain (UW or CBOE), compute per-strike gamma with your M8 code, aggregate to net GEX, and locate the flip and walls. Compare to what lib/uw.ts getNqLevels produced that day. Reproduce the "cage."
- π SqueezeMetrics, The Implied Order Book white paper (the canonical GEX reference); SpotGamma primers.
- β
Milestone: independently compute the gamma flip for a given day and match the terminal's level within a few points β and explain the regime it implies.
Phase 4 β Probability models & the openBias (Weeks 34β43)
Module 10 β Logistic regression from scratch
Goal: rebuild the exact model behind P(up 5m).
Concepts: odds & log-odds, the sigmoid, the logit link, maximum-likelihood estimation, gradient descent, feature standardization (z-scoring), calibration (does 60% mean 60%?), classification metrics (log-loss, AUC).
- π Derive: write the Bernoulli log-likelihood for logistic regression and take its gradient β see why there's no closed form (unlike OLS) and you iterate.
- π» Build: re-fit openBias on your factor data (VXN fear-shift, overnight rates, overnight dollar) across your session history; reproduce the deployed coefficients and P(up 5m); draw a calibration curve; confirm the "coin-flip when factors disagree" logic falls out of the model.
- π ISLR ch. 4 (logistic regression); StatQuest logistic-regression series.
- β
Milestone: your from-scratch logistic reproduces lib/openBias.ts's probability for a given day, and you can read its calibration honestly.
Module 11 β Multivariate factors & why "more signals" β "more edge"
Goal: correlation, covariance, and the multicollinearity that kept econ-surprise out of the model. Concepts: correlation vs covariance, the covariance matrix, multiple regression, multicollinearity & variance inflation, a first taste of PCA, redundancy vs orthogonality. - π Derive: show how two correlated regressors split/inflate their coefficients (why adding a redundant factor can hurt). - π» Build: compute the correlation matrix of your factors (VXN, rates, USD, econ-surprise); demonstrate numerically that surprise is largely spanned by rates+dollar at the 9:30 horizon β reproducing the finding that it didn't earn a slot in openBias. - π ISLR ch. 3.3β3.5, 6.3 (PCA); Practical Statistics for Data Scientists correlation chapter. - β Milestone: decide, with evidence, whether a proposed new factor adds independent signal or just noise+collinearity.
Phase 5 β Inference, backtesting & edge (Weeks 44β52)
Module 12 β Backtest statistics & the ways they deceive
Goal: the discipline that separates a real edge from a curve-fit ghost.
Concepts: sampling distribution of a backtest, multiple-testing / data-snooping, the deflated Sharpe, look-ahead & survivorship bias, regime shift, out-of-sample & walk-forward, the Probability of Backtest Overfitting.
- π Derive: show how testing N strategies inflates the best one's apparent Sharpe (Bonferroni intuition) β why "I found a great backtest" is usually a lie.
- π» Build: audit lib/scoreBrief.ts + the accuracy tracker: put confidence intervals on the win rate and total P&L; simulate the null (random entries) to get a p-value for the best-play edge.
- π Bailey & LΓ³pez de Prado, The Probability of Backtest Overfitting; LΓ³pez de Prado, Advances in Financial ML (the pitfalls chapters).
- β
Milestone: produce an honest, CI-bounded statement of the Desk Read's edge β and how many more sessions you need to confirm it.
Module 13 β Position sizing, expectancy & Kelly
Goal: turn a probabilistic edge into optimal risk.
Concepts: R-multiples, expectancy E = pΒ·W β (1βp)Β·L, variance of returns, the Kelly criterion f* = edge/odds, fractional Kelly, risk of ruin, geometric vs arithmetic growth.
- π Derive: get the Kelly fraction by maximizing expected log-wealth; explain why full Kelly is too aggressive for a fat-tailed, uncertain edge.
- π» Build: from the accuracy tracker's win rate and average R, compute the best-play's expectancy and Kelly fraction; Monte-Carlo the equity curve at full/half/quarter Kelly to see drawdown vs growth.
- π Poundstone, Fortune's Formula (narrative); Thorp's Kelly papers; Sinclair, Volatility Trading (sizing).
- β
Milestone: state the mathematically-justified size for the best-play and defend the fraction of Kelly you'd actually use.
Module 14 β Capstone: ship a validated model
Goal: prove mastery by extending the system correctly. - π» Build: design, derive, implement, and out-of-sample validate one new component β e.g. a GARCH/EWMA volatility term that improves the range model's βt behavior, a second openBias factor that survives the collinearity test (M11), or a regime classifier for the gamma environment. Wire it into the terminal only if it beats the current model out-of-sample with a defensible p-value. - β Final milestone: you added real, statistically-validated math to fp-terminal β and can defend every assumption, estimator, and failure mode.
Reference shelf (buy/borrow in this order)
- Blitzstein & Hwang β Introduction to Probability (free PDF) β probability done right, gently.
- ISLR β An Introduction to Statistical Learning (free PDF) β regression, logistic, PCA, cross-validation. The single best value here.
- 3Blue1Brown β Essence of Calculus + Essence of Linear Algebra (free videos) β intuition you'll keep forever.
- Sinclair β Volatility Trading β a quant trader's volatility bible.
- Natenberg β Option Volatility & Pricing β the practitioner's Greeks reference.
- Hull β Options, Futures, and Other Derivatives β the standard academic text; use as a lookup.
- Wilmott β Paul Wilmott Introduces Quantitative Finance β friendliest Brownian/ItΓ΄/BS path.
- SqueezeMetrics β The Implied Order Book (free white paper) β the GEX foundation.
- LΓ³pez de Prado β Advances in Financial Machine Learning β backtest pitfalls (advanced; skim the relevant chapters).
Rules of the program
- Every module ends in code against your own tape. No exercise is done until it runs on real NQ data.
- Derive before you import. Hand-derive the estimator once, then use the library.
- Distrust every backtest. Ask "what's the standard error?" before "what's the number?"
- Tie it back. After each module, re-read the matching line of the map table and the matching source file β you should now understand it.
- ~2 hrs/week, ~1 module/month. Slow is fine. Consistency is the whole game.