// APPENDIX A · COURSE REFERENCE
Appendix A · Quick-reference formula sheet
Every formula in the course, checked against the primary literature, in a single reference.
How to use this formula sheet. This appendix condenses every operational formula in the course into two dense tables — one per area — using the exact notation of modules 7 through 9. Each row gives the concept, the formula, the symbols to fix before computing, and the usage caution; the most frequently consulted formulas also appear as display blocks, outside the table, so they can be copied at a glance. Global conventions: losses are positive unless stated otherwise; = log return; = tail level (0.01 for 99% VaR); ; = standard normal density and CDF; = weights, = covariances, = vector of ones. And the golden rule of the course: no formula is executed by the LLM — the LangChain agent orchestrates, explains, and alerts; the number is always produced by a deterministic tool.
13.1 Risk and performance
13.1.1 Formula table: delta-normal/historical/Monte Carlo VaR, ES/CVaR (Rockafellar-Uryasev), realized volatility, EWMA λ=0.94, GARCH(1,1), MDD, Sharpe/Sortino/Omega/Calmar/Sterling/Ulcer, beta, TE/IR + Grinold's law, skew/kurtosis, Cornish-Fisher, Component/Marginal VaR (Euler), Kupiec/Christoffersen LR, PSR/DSR
Key formulas for quick reference:
Table A.1 — Risk and performance formula sheet: formula, key symbols, and usage cautions
| Concept | Formula | Key symbols | Usage/caution |
|---|---|---|---|
| Delta-normal VaR (portfolio) | ; single asset: see block | value, weights, daily | Fast and aggregable; fails with fat tails, skewness, and non-linearities (options); the rule requires i.i.d. |
| Historical VaR (HS) | = -th worst loss out of revalued P&L | No distributional assumptions; at 99% with only ~2.5 tail observations; slow to react to regime changes | |
| Monte Carlo VaR / FHS | = empirical CDF of simulated losses | The risk shifts to the generator; FHS: resample residuals from a GARCH; Gaussian MC underestimates tails | |
| ES / CVaR | See block; empirical: mean of the worst losses | tail; confidence | Coherent and subadditive (VaR is not); FRTB: 97.5% ES 99% VaR under normality |
| Rockafellar–Uryasev | ≈ VaR; positive part | Turns CVaR optimization into linear programming (ideal with cvxpy) | |
| Realized volatility | , | evenly spaced intraday observations | Consistent estimator of quadratic variation; with microstructure noise, sample at ~5 min |
| EWMA (RiskMetrics) | See block; expanded form | daily, monthly | Effective memory days; IGARCH with no mean reversion |
| GARCH(1,1) | See block; long run ; forecast | , , persistence | Requires for stationarity; EWMA is the limiting case , |
| Maximum drawdown | (high-water mark) | Asymmetric recovery: (−50% ⇒ +100%); highly sensitive to the window | |
| Sharpe | See block | risk-free, of the excess | Annualize with only under i.i.d.; with autocorrelation it can be overstated by up to 65% (Lo 2002) (Alpha Vantage) |
| Sortino | , | = MAR (0 or ) | Penalizes downside volatility only; sensitive to the choice of |
| Omega | threshold; | Uses the entire distribution with no moment assumptions; sanity check: | |
| Calmar | Typical window: 36 months | A crisis-free track record artificially inflates it; MAR variant over the full history | |
| Sterling | annual return, average of annual max DD | convention ambiguous in the literature: state the one used (Alpha Vantage); modern variant: | |
| Ulcer Index | , | % drawdown from the prior peak | Penalizes depth and duration; UPI |
| Beta | Slope of the regression against the market | Highly sensitive to window, benchmark, and data frequency | |
| TE / IR + Grinold | , , | information coefficient, breadth | Grinold's law assumes independent forecasts; constraints reduce the achievable IR |
| Skew / kurtosis | , , | 3rd and 4th standardized moments | Typical equity: and — the direct reason normal VaR underestimates |
| Cornish–Fisher | See block; | Sample , | Cheap non-Gaussian VaR; invalid if or (non-monotonic quantiles): verify before reporting |
| Marginal / Component VaR (Euler) | , | monetary position, correlation with the portfolio | Exact aggregation: ; mathematical basis of narrative VaR attribution |
| Kupiec POF | See block | exceptions in days, nominal rate | Unconditional frequency only; low power with small (250 days ⇒ ~12.5 expected exceptions at 95%) |
| Christoffersen | , | Detects exception clustering (independence); required in Basel internal-models frameworks | |
| PSR / DSR | See block; | Sample ; ; trials | Operating rule: require DSR > 0.95 (PyPI); a backtest Sharpe without a declared number of trials is not evidence |
Usage notes — risk and performance. When each formula fails: delta-normal VaR systematically underestimates risk under fat tails and negative skewness (, in equity) and does not capture derivative non-linearities; historical VaR relies on a single path and at 99% with 250 days has only ~2.5 tail observations; Monte Carlo shifts the risk to the stochastic generator — the comparative evidence shows that Gaussian MC underestimates tails relative to filtered historical simulation. The rule and Sharpe annualization with are valid only under i.i.d. returns: with serial autocorrelation, Lo (2002) documents annualized Sharpe ratios overstated by up to 65% (Alpha Vantage). Fixed course conventions: daily (0.97 monthly; effective memory ≈ 17 days), per the RiskMetrics Technical Document (Godel Discount); EWMA does not revert to the mean — if reversion is needed, use GARCH(1,1) with . Sterling is the least standardized formula in the literature: the original version adds 10% to the denominator, but variants with or with circulate; always state the convention used (±10% tolerance) (Alpha Vantage). Cornish-Fisher stops being monotonic for or : verify the monotonicity of in before reporting. Kupiec has low power with small and does not detect time clustering — which is why it is complemented with Christoffersen. Calmar and MDD depend on the window: a crisis-free history inflates them. And no backtest Sharpe is evidence without DSR > 0.95 after declaring the trials (PyPI).
13.2 Portfolios and execution
13.2.1 Formula table: Markowitz MVO + GMV + tangency, CAPM, FF3/FF5, Black-Litterman (π=δΣw, posterior, Idzorek ω), Kelly (discrete/continuous/fractional), ERC (Spinu), Ledoit-Wolf δ*, HRP, Almgren-Chriss (trajectory, κ, E(X), V(X)), square-root law, signal cross-sectional z-score
Key formulas for quick reference:
Table A.2 — Portfolio and execution formula sheet: formula, key symbols, and usage cautions
| Concept | Formula | Key symbols | Usage/caution |
|---|---|---|---|
| MVO (Markowitz) | s.a. , ; dual: | risk aversion | "Error maximizer" (Michaud): errors in weigh ~11× those of variances; never with raw sample |
| GMV | See block; | Does not use | The most robust out of sample; long-only + bounds = implicit shrinkage (Jagannathan–Ma) |
| Tangency (max Sharpe) | See block; | With ; tangency point of the CML | Extremely sensitive to ; multivariate Kelly = unnormalized tangency () |
| CAPM | from the previous row; equilibrium | Basis of the Black-Litterman prior; SML: assets above it are undervalued | |
| FF3 / FF5 | Size, value (+ profitability, investment) factors | Factor attribution of alpha; Carhart adds (momentum); data: Ken French Data Library | |
| Black-Litterman | See block; Idzorek: ; | ; prior scale; views | or (Github); views are the auditable entry point for signals (incl. LLM) |
| Discrete Kelly | See block | net odds, win probability, | Growth-optimal capital fraction; at full Kelly the drawdowns are intolerable |
| Continuous / multivariate Kelly | See block | Maximizes (log utility) | coincides with the unnormalized tangency portfolio |
| Fractional Kelly | , | or in practice | 1/2-Kelly ≈ 75% of growth with ~50% of the volatility (Github); protects against overestimated edge |
| ERC (risk parity, Spinu) | See block; s.a. , | risk contribution | No general closed-form solution; sits between and GMV on the diversification-risk spectrum |
| Ledoit–Wolf | , | Sample ; target (constant correlation or ) | Closed-form , no free parameters; mandatory standard before inverting with 10+ assets |
| HRP | ; allocation , | Clustering + seriation + recursive bisection; intra-cluster variance | Diversifies without inverting : robust to ill-conditioning |
| Almgren–Chriss | See block; , ; | permanent impact, temporary, aversion, | ⇒ ≈TWAP; ⇒ front-loaded with half-life ; the naive strategy () is never optimal (Blockchain News) |
| Square-root law | See block; practical: | meta-order, daily volume, daily vol. | Concave in : defines the strategy's capacity; Almgren et al. propose a 3/5 exponent for blocks (🦜️🔗 LangChain) |
| Cross-sectional z-score | signal (e.g., LLM score), mean and standard deviation per date | Winsorize before standardizing; the basis of long-short ranking and of weights ; handle the point mass at "neutral" |
Usage notes — portfolios and execution. The weak link of MVO is not the QP but : errors in means weigh ~11× those of variances (Chopra–Ziemba) and the optimizer systematically maximizes them (Michaud); that is why GMV, ERC, and HRP — which do not use or do not invert — tend to win out of sample, and long-only constraints with bounds act as implicit shrinkage (Jagannathan–Ma). In production, never feed the raw sample : Ledoit–Wolf with closed-form is the standard before any . In Black-Litterman, scales the confidence in the equilibrium prior: institutional practice is or , with calibrated per Idzorek (Github); the views are the auditable entry point for signals, including LLM-generated ones. Full Kelly maximizes growth but with intolerable drawdowns: in practice it is traded fractionally at 1/4–1/2 — half-Kelly retains ≈ 75% of the growth with ~50% of the volatility (Github). In execution: reproduces TWAP; liquidates front-loaded with half-life , and the naive strategy () is never optimal for a risk-averse trader (Blockchain News). The square-root law is concave in — "it costs ~1 day of volatility to move 1 day of volume" (🦜️🔗 LangChain): liquidating shares with , and costs bp. The cross-sectional z-score requires winsorizing the signal by date before ranking; with LLM signals, explicitly handle the point mass in the neutral class.
Appendix A of 3 — LangChain for Quantitative Trading. Data and versions verified as of July 2026; prices and market figures subject to change. LangChain 1.3.14 / langchain-core 1.5.2.