Part IX: Applications and Future Directions
Chapter 35: Industrial Applications

Finance

"My Sharpe ratio was four. My equity curve climbed in a perfect diagonal, my drawdowns were rounding errors, and my backtest report was a thing of beauty. Then someone purged the overlapping labels, embargoed the bars around each test fold, charged me the bid-ask spread, and asked me to predict tomorrow instead of yesterday. Now I am a flat line with fees."

A Trading Signal That Was Profitable Right Up Until It Was Backtested Honestly
Big Picture

Finance is the most demanding application of temporal AI in this book precisely because it is where the signal is weakest, the noise is heaviest, and the cost of self-deception is highest. Asset returns sit near the random-walk floor of predictability we drew in Chapter 1.5: the conditional mean is almost flat, so most of what looks like a forecast is noise dressed as skill. Yet the same series whose mean is nearly unpredictable has a variance that is strongly, reliably predictable, which is why volatility modeling (GARCH, Chapter 6.5) and the risk quantities built on it (Value-at-Risk and Conditional VaR from the probabilistic forecasts of Chapter 19) are where temporal AI actually earns its keep in finance. Execution and portfolio construction are then sequential decision problems, the Markov decision processes and reinforcement learning of Part VI. This section is the payoff for the finance running dataset that threaded through the book. It maps the four finance problems to their temporal nature, states the cardinal discipline that separates real signals from backtest artifacts (leakage, purging, embargo, beating a naive baseline, Chapter 2.6), surveys the modern stack and its honest limits, and builds an end-to-end leakage-safe volatility and VaR pipeline twice: from scratch, then in a handful of library lines, with a calibrated exceedance backtest that checks whether a 99 percent risk band is actually exceeded one percent of the time.

Every preceding part of this book contributed a tool that finance needs. Chapter 6 gave us GARCH for volatility and cointegration for pairs trading; Chapter 8 gave us change-point detection for regime awareness; Chapter 19 gave us calibrated predictive distributions and conformal bands; Part VI gave us the decision-making frame for execution and allocation; and Chapter 2 gave us the leakage discipline without which none of the rest is trustworthy. This section weaves them together on one dataset. We use the unified notation of Appendix A: $r_t$ the log return at time $t$, $\sigma_t$ the conditional volatility, $\mathcal{F}_{t-1}$ the information available at the close of the previous bar, and $\hat{q}_t^{(\alpha)}$ the predicted $\alpha$-quantile of next-period return.

The orientation to hold throughout is unusual for an applications chapter: in finance, the default outcome of any forecasting effort is failure, and the rare success is small and fragile. This is not pessimism, it is the efficient-market null hypothesis taken seriously. A practitioner who internalizes that most apparent signals are noise, that most backtest profit is leakage, and that the honest benchmark is a naive baseline you must genuinely beat, is already ahead of the majority of the field. The competencies this section installs are these: to recognize which finance problems are predictable (variance, yes; mean, barely) and why; to run a backtest that does not lie to you, with purging and embargo around every label; to assemble a leakage-safe risk pipeline; and to validate a risk forecast by its exceedance rate rather than by a pretty equity curve.

A robot at the center of six paths each leading to a different industry vignette, holding one thread that connects finance, health, factory, energy, robotics, and science.
Figure 35.1: One temporal toolkit, six very different industries, all asking the same question about what happens next.

1. The Finance Problems and Their Temporal Nature Beginner

Four problems dominate quantitative finance, and they differ sharply in how much temporal structure they actually contain. Reading them in order of increasing predictability is the single most clarifying thing a newcomer can do, because it inoculates against the most common error: pouring deep-learning firepower into the one problem (return forecasting) that has the least signal, while ignoring the problems (volatility, risk) where temporal modeling genuinely pays.

Return forecasting is the prediction of the next-period return $r_{t+1}$ from past information $\mathcal{F}_t$. It is the glamorous problem and the hardest. Efficient-market theory says that if returns were reliably predictable, the trade that exploits the prediction would move the price until the predictability vanished, so the equilibrium is a series whose conditional mean is nearly flat: a near random walk. In the predictability framework of Chapter 1.5, returns sit close to the entropy-rate ceiling, with a signal-to-noise ratio so low that an $R^2$ of one or two percent out-of-sample is considered excellent and is enough, levered and traded at scale, to build a business on. The temporal structure that does exist is faint and fleeting: short-horizon mean reversion, weak cross-sectional momentum, microstructure effects that decay in milliseconds. The practical consequence is that return forecasting is a low-signal regression where the dominant risk is not model bias but overfitting to noise, which makes the discipline of Section 2 not optional but existential.

Volatility modeling predicts the conditional variance $\sigma_t^2 = \operatorname{Var}(r_t \mid \mathcal{F}_{t-1})$. Here the situation reverses completely. While the sign of tomorrow's return is nearly unpredictable, its magnitude is highly predictable, because volatility clusters: large moves follow large moves and calm follows calm. This is the empirical regularity that the GARCH family of Chapter 6.5 was built to capture. The canonical GARCH(1,1) recursion,

$$\sigma_t^2 = \omega + \alpha\, r_{t-1}^2 + \beta\, \sigma_{t-1}^2, \qquad \omega > 0,\ \alpha, \beta \ge 0,\ \alpha + \beta < 1,$$

says today's variance is a constant plus a piece of yesterday's squared shock ($\alpha$, the news reaction) plus a piece of yesterday's variance ($\beta$, the persistence). The closer $\alpha + \beta$ is to one, the longer volatility shocks persist; for equity indices the sum is typically around $0.95$ to $0.99$, which is exactly the long memory in variance that makes volatility forecastable many steps ahead even when returns are not forecastable one step ahead. This recursion is, structurally, the same exponentially-weighted state update we met as the Kalman filter in Chapter 7: a hidden state (here the variance) carried forward and corrected by each new observation.

Risk turns a volatility forecast into a statement a risk manager can act on. The Value-at-Risk at level $\alpha$ is the quantile of the loss distribution: the loss that is exceeded only with probability $\alpha$. For a return whose conditional distribution has mean $\mu_t$, volatility $\sigma_t$, and standardized $\alpha$-quantile $z_\alpha$,

$$\mathrm{VaR}_t^{(\alpha)} = -\big(\mu_t + z_\alpha\, \sigma_t\big), \qquad \mathrm{CVaR}_t^{(\alpha)} = -\Big(\mu_t + \sigma_t\, \mathbb{E}[Z \mid Z \le z_\alpha]\Big),$$

where VaR is the threshold loss and CVaR (Conditional VaR, also called expected shortfall) is the average loss given that the threshold is breached, the coherent risk measure regulators and the textbook both prefer because it sees the shape of the tail rather than just its edge. Both quantities are nothing but a probabilistic forecast read at its tail, which is why the calibrated predictive distributions and conformal methods of Chapter 19 are the right machinery: a VaR is a quantile forecast, and a quantile forecast is exactly what Chapter 19 teaches us to produce and, crucially, to calibrate.

Execution and portfolio construction are sequential decision problems, not forecasting problems. Executing a large order without moving the market against yourself is a trade-off between trading fast (paying market impact) and trading slow (bearing price risk), a multi-step control problem whose state is the remaining inventory and the order book and whose reward is implementation shortfall. Portfolio construction allocates capital across assets over time under transaction costs and constraints. Both are Markov decision processes, the object that opens Part VI, and both are increasingly attacked with the reinforcement learning of that part, though as Section 3 cautions, the bar for RL to beat a well-tuned classical execution schedule is high.

Key Insight: The Mean Is Unpredictable, the Variance Is Not

The single most important asymmetry in financial time series is that the first moment (the conditional mean of returns) sits near the random-walk floor of Chapter 1.5 and is barely forecastable, while the second moment (the conditional variance) clusters strongly and is highly forecastable. This is why a newcomer's instinct to throw a Transformer at next-day return prediction is usually the worst allocation of effort in the building, and why the durable, profitable applications of temporal AI in finance, volatility trading, risk management, option pricing, position sizing, all live on the variance side of the ledger. Predict what is predictable. The forecastable object is risk, not direction.

Fun Note: The Square Is Forecastable, the Sign Is Not

There is a tidy party trick that captures the whole asymmetry. Take a daily equity-index return series and compute the autocorrelation of the returns $r_t$: it is statistically indistinguishable from zero at every lag, the signature of a near random walk. Now compute the autocorrelation of the squared returns $r_t^2$: it is strongly positive and decays slowly over weeks. Same series, two transforms, two completely different worlds. Squaring throws away the sign (the unpredictable part) and keeps the magnitude (the predictable part). The entire GARCH literature is, in one sentence, the science of forecasting that second autocorrelation function.

2. The Cardinal Discipline: Leakage and Backtest Overfitting Intermediate

A trader robot admires a flattering soaring curve in a funhouse mirror while the flat disappointing real curve sits ignored in its hand.
Figure 35.2: A backtest that leaks the future flatters you in the mirror; the honest out of sample curve is the flat one you were trying not to look at.

If Section 1 says what to predict, this section says how not to lie to yourself about whether you can, and it is the most important section in the chapter. In a domain where the true signal is one or two percent of $R^2$, the gap between an honest backtest and a leaky one is the difference between a real edge and a fantasy, and almost every backtest a beginner produces is the fantasy. The discipline of Chapter 2.6 (temporal data leakage) is not a hygiene footnote in finance: it is the whole game.

Leakage is any way that information from the future, or from the test period, sneaks into the training of a model or the construction of a feature, inflating backtest performance to a level that cannot survive live trading. Finance is unusually rich in leakage channels. Look-ahead bias uses data not yet available at decision time, for example computing a feature from a closing price and trading on it at that same close, or using a quarterly fundamental on its period-end date rather than its later release date. Survivorship bias backtests on the index constituents that exist today, silently excluding the firms that went bankrupt, which flatters every long strategy. Normalization leakage scales features using statistics (mean, variance) computed over the full sample including the test period, leaking the test distribution into training, the exact pitfall Chapter 2.6 warns against for any time series. Overlapping-label leakage, the subtlest, arises when labels are built from multi-bar horizons (a five-day forward return), so a label at time $t$ shares price moves with labels at $t+1, \dots, t+4$; a naive train/test split then puts overlapping labels on both sides of the boundary and the test set is no longer independent of training.

The standard cure, due to López de Prado, is purging and embargo in cross-validation. Purging removes from the training set any sample whose label horizon overlaps the time span of the test set, severing the overlap leakage. Embargo additionally drops a small band of training samples immediately after each test fold, because serial correlation in features can leak test information backward across the boundary even without label overlap. Figure 35.3 shows the purged, embargoed split that replaces the naive one whenever labels span multiple bars.

Purged, embargoed train/test split for multi-bar labels train purge test embargo train time labels overlappingthe test span are dropped serial-correlationleak band dropped
Figure 35.3: The purged and embargoed split. Training samples whose multi-bar labels overlap the test span are purged (gold); a short band of training samples immediately after the test fold is embargoed (purple) to block serial-correlation leakage. Only the remaining blue training samples are used, and the test fold becomes genuinely out-of-sample.

The second half of the discipline is the naive baseline. A forecast is worth nothing until it beats the cheapest sensible alternative on the same honest split. For returns the baseline is the random walk: predict zero (or the unconditional mean) and accept that you almost certainly cannot beat it. For volatility the baseline is a strong one, the exponentially weighted moving average of squared returns (RiskMetrics), which a fancy neural volatility model must outperform to justify itself. For direction the baseline is a coin flip after costs. Reporting a model's metric without its naive-baseline metric, co-computed on the identical split, is the number-by-number audit failure our house rules forbid: the comparison must be construct-matched and computed in one pass. The graveyard of quantitative finance is full of signals that beat nothing.

Numeric Example: How Overlapping Labels Manufacture a Sharpe Ratio

Suppose you label each daily bar with the 5-day forward return and run 5-fold cross-validation with a naive split. Each test label overlaps four training labels on each side, so roughly $2 \times 4 = 8$ of the bars adjacent to every fold boundary share price moves across the split. With about $250$ trading days per year and $5$ folds, the boundary regions touch on the order of $5 \times 8 = 40$ contaminated bars, and because adjacent overlapping labels are correlated near $+0.8$, the effective independent sample size is far smaller than the nominal count, inflating apparent out-of-sample $R^2$ from a true $\approx 0.000$ to an illusory $\approx 0.03$. Levered, that fake $R^2$ can show a backtest Sharpe above $2$. After purging the overlaps and embargoing one week around each fold, the $R^2$ collapses back toward zero and the Sharpe with it. The lesson in one line: the multi-bar label, not the model, was generating the profit.

Key Insight: Beating a Naive Baseline on a Leakage-Free Split Is the Only Evidence That Counts

Two conditions must both hold before any finance result is believable, and they are exactly the two this section installs. First, the evaluation split must be leakage-free: purged and embargoed around every multi-bar label, normalized only on past data, free of survivorship and look-ahead bias. Second, the model must beat a genuinely strong naive baseline (random walk for returns, EWMA for volatility) co-computed on that same split. A result that fails either condition is not a small result, it is no result. Most published and most home-grown trading signals fail one or both, which is why "most signals are noise" is the correct prior.

3. The Modern Stack and What Actually Works Intermediate

Given the brutal signal-to-noise environment, the empirical lesson of the field is sobering and liberating at once: simple, robust, well-regularized models, fit on honest data, beat elaborate ones far more often than the deep-learning enthusiasm of the rest of this book would suggest. Complexity is a liability when the signal is one percent of $R^2$, because every extra parameter is one more thing to overfit the noise. This is the opposite of the regime where Transformers and foundation models shine, and finance is the cautionary counterweight to those chapters.

The 2026 foundation-model frontier in finance is therefore moving toward narrow, decision-linked targets: volatility, spreads, yield changes, portfolio risk, and execution from order-book histories. Limit-order-book data are the missing microstructure layer for many textbook finance forecasts because execution quality depends on queue position, spread, depth, imbalance, and market impact rather than on close-to-close returns alone. A finance TSFM earns attention only when one construct-matched artifact co-computes predictive error, turnover, transaction costs, slippage, drawdown, and net return on the same split, seed, universe, and cost model. Forecast metrics diagnose; economic metrics decide.

On the volatility side, what works is the GARCH family of Chapter 6.5 and its asymmetric extensions (GJR-GARCH and EGARCH, which capture the leverage effect that negative returns raise future volatility more than positive ones of equal size), plus the simple EWMA baseline. Neural volatility models exist and occasionally help at high frequency, but on daily data a carefully specified GARCH with a Student-t innovation is a stubbornly strong benchmark. On the regime side, the change-point detection of Chapter 8 and the hidden-Markov regime switching of Chapter 7 earn their place: markets visibly alternate between calm and turbulent regimes, and a model that knows which regime it is in (or that resets its parameters when a change-point fires) is more robust than one that assumes stationarity. Regime awareness is one of the few places where added structure reliably pays.

On the relative-value side, cointegration and pairs trading from Chapter 6.3 remain a workhorse: while individual prices are non-stationary random walks, a cointegrated pair has a stationary spread that mean-reverts, and trading that spread is one of the more durable classical strategies, subject to the ever-present risk that the cointegration relationship breaks (a regime change the Chapter 8 detector should catch). On the decision side, the reinforcement learning of Part VI is genuinely useful for execution (where the environment, the order book, is closer to a well-defined MDP and the reward, implementation shortfall, is measurable), and far more speculative for end-to-end portfolio allocation (where the non-stationarity and the tiny signal make the RL credit-assignment problem nearly hopeless without heavy structure).

Key Insight: In Finance, Model Capacity Is a Liability, Not an Asset

Across nearly every other application in this book, more capacity (deeper networks, attention, foundation models) buys more performance when data is plentiful. Finance inverts the rule because the signal is so faint relative to the noise that added capacity overwhelmingly fits the noise. The durable finance stack is therefore deliberately humble: GARCH for variance, EWMA as a baseline, cointegration for relative value, change-points for regime awareness, and RL reserved for the execution problems that are closest to a clean MDP. Reach for the heavy machinery of Parts III to VI only where the data is high-frequency enough that the signal-to-noise ratio rises, and even then, benchmark relentlessly against the simple model.

Research Frontier: Temporal Foundation Models Meet Finance (2024 to 2026)

The temporal foundation models of Chapter 15, Chronos (Ansari et al., 2024), Moirai (Woo et al., 2024), TimesFM (Das et al., 2024), and Lag-Llama (Rasul et al., 2024), have been benchmarked zero-shot on financial series, and the honest 2024 to 2026 finding is sobering: they are competitive for volatility and for liquid, lower-noise series, but they do not conjure return predictability that classical methods miss, because there is little to conjure. The more promising frontier is on the risk and uncertainty side: conformal prediction for finance (the adaptive conformal inference of Chapter 19, including ACI and conformal PID) gives VaR bands with finite-sample exceedance guarantees that hold even under the distribution shift that breaks GARCH's parametric assumptions, a genuine advance for risk management. On the decision side, offline reinforcement learning (d3rlpy, Decision Transformer of Chapter 28) is being explored for execution from historical order-book logs, where the chief obstacle is exactly the leakage and distribution-shift discipline of Section 2. The 2026 consensus: foundation models help most where the signal already existed (volatility, risk), and the leakage discipline matters more than the architecture.

4. Worked End-to-End Case: A Leakage-Safe Volatility and VaR Pipeline Advanced

We now build the payoff: a complete leakage-safe risk pipeline on the finance returns series. The plan synthesizes the whole section. We simulate a return series with volatility clustering (so we know the ground truth), fit a GARCH(1,1) by maximum likelihood from scratch, turn its one-step volatility forecast into a 99 percent VaR band, then backtest the band by counting exceedances out-of-sample and checking that the exceedance rate matches the one percent target. Crucially, the volatility is forecast one step ahead using only past information, so there is no look-ahead leakage of the kind Section 2 forbids. Code 35.1.1 is the from-scratch GARCH fit and VaR construction.

import numpy as np
from scipy.optimize import minimize
from scipy.stats import norm

rng = np.random.default_rng(7)

# --- Simulate a return series with volatility clustering (known GARCH ground truth) ---
n = 4000
omega_true, alpha_true, beta_true = 2e-6, 0.08, 0.90   # alpha+beta=0.98: persistent vol
r = np.zeros(n); sig2 = np.zeros(n); sig2[0] = omega_true / (1 - alpha_true - beta_true)
for t in range(1, n):
    sig2[t] = omega_true + alpha_true * r[t-1]**2 + beta_true * sig2[t-1]
    r[t] = np.sqrt(sig2[t]) * rng.standard_normal()    # Gaussian innovations

# --- Leakage-safe split: fit on the PAST, forecast/backtest on the FUTURE ---
split = 3000
r_train, r_test = r[:split], r[split:]

def garch_negloglik(params, x):
    """Negative Gaussian log-likelihood of GARCH(1,1); s2[t] uses only x[= 1:
        return 1e10                                    # enforce stationarity constraints
    s2 = np.empty_like(x); s2[0] = np.var(x)
    for t in range(1, len(x)):
        s2[t] = omega + alpha * x[t-1]**2 + beta * s2[t-1]
    return 0.5 * np.sum(np.log(2*np.pi*s2) + x**2 / s2) # Gaussian NLL

# Fit by maximum likelihood on the training window only.
init = [np.var(r_train)*0.1, 0.05, 0.90]
res = minimize(garch_negloglik, init, args=(r_train,),
               method="Nelder-Mead", options={"xatol":1e-9, "fatol":1e-9, "maxiter":5000})
omega, alpha, beta = res.x
print("fitted omega=%.2e  alpha=%.4f  beta=%.4f  (true 0.08, 0.90)" % (omega, alpha, beta))

# --- One-step-ahead volatility forecast on the test set, using only past returns ---
s2 = np.var(r_train)                                    # carry variance state across the split
var_99 = np.empty(len(r_test)); z99 = norm.ppf(0.01)   # z_{0.01} = -2.326
for t in range(len(r_test)):
    # forecast sigma_t^2 from info available BEFORE observing r_test[t]
    prev_r = r_test[t-1] if t > 0 else r_train[-1]
    s2 = omega + alpha * prev_r**2 + beta * s2          # state update: yesterday -> today
    var_99[t] = -(z99 * np.sqrt(s2))                    # 99% VaR (mu=0): positive loss number

print("mean 99%% VaR over test = %.4f" % var_99.mean())
Code 35.1.1: From-scratch GARCH(1,1) maximum-likelihood fit and one-step-ahead 99 percent VaR. The likelihood and the test-time forecast both compute $\sigma_t^2$ from strictly past returns, so the VaR at bar $t$ uses no information from bar $t$ or later: the leakage discipline of Section 2 is enforced in the indexing itself.
fitted omega=2.07e-06  alpha=0.0791  beta=0.9009  (true 0.08, 0.90)
mean 99% VaR over test = 0.0042
Output 35.1.1: Maximum likelihood recovers the simulated GARCH parameters ($\alpha \approx 0.079$, $\beta \approx 0.901$, against truth $0.08$ and $0.90$), and the mean 99 percent VaR over the test window is about $0.42$ percent of capital per bar.

A VaR forecast is only as good as its calibration, and Section 2's discipline says we judge it by backtesting its exceedances, not by inspecting the model. Code 35.1.2 runs the exceedance backtest: it counts how often the realized loss breached the predicted 99 percent VaR and applies the Kupiec proportion-of-failures test, the standard regulatory check that the observed exceedance rate is statistically consistent with the one percent target.

from scipy.stats import chi2

# --- Exceedance backtest: did the realized loss breach the predicted VaR? ---
loss = -r_test                                          # loss = negative return
breach = loss > var_99                                  # True when VaR was exceeded
x_breaches = breach.sum(); N = len(r_test)
rate = x_breaches / N
print("exceedances = %d / %d   rate = %.4f   target = 0.0100" % (x_breaches, N, rate))

# Kupiec proportion-of-failures (POF) likelihood-ratio test for correct coverage.
p = 0.01                                                # target exceedance probability
LR_pof = -2 * (np.log((1-p)**(N-x_breaches) * p**x_breaches)
               - np.log((1-rate)**(N-x_breaches) * rate**x_breaches))
pval = 1 - chi2.cdf(LR_pof, df=1)
print("Kupiec LR = %.3f   p-value = %.3f   %s"
      % (LR_pof, pval, "PASS (calibrated)" if pval > 0.05 else "FAIL (miscalibrated)"))
Code 35.1.2: The exceedance backtest. We count breaches of the one-step VaR and run the Kupiec proportion-of-failures likelihood-ratio test; a $p$-value above $0.05$ means the observed exceedance rate is statistically consistent with the one percent target, the calibration check that Chapter 19 taught for any quantile forecast.
exceedances = 11 / 1000   rate = 0.0110   target = 0.0100
Kupiec LR = 0.099   p-value = 0.753   PASS (calibrated)
Output 35.1.2: The 99 percent VaR was exceeded 11 times in 1000 test bars, an exceedance rate of $1.1$ percent against the $1.0$ percent target; the Kupiec test $p$-value of $0.75$ comfortably passes, so the risk band is calibrated.
Numeric Example: Reading the Exceedance Rate Against Target

The whole risk pipeline lives or dies on one number: the realized exceedance rate versus the nominal level. We targeted a $99$ percent VaR, so we expect breaches on $1.0$ percent of bars; over $1000$ test bars that is an expected $10$ exceedances. We observed $11$, a rate of $1.1$ percent. Is $11$ versus $10$ a problem? The Kupiec test answers quantitatively: under the null that the true rate is $1$ percent, the number of exceedances is roughly Binomial$(1000, 0.01)$ with mean $10$ and standard deviation $\sqrt{1000 \cdot 0.01 \cdot 0.99} \approx 3.1$, so $11$ is well within one standard deviation and the $p$-value of $0.75$ confirms no evidence of miscalibration. Had we instead seen $30$ exceedances (a $3.0$ percent rate), the band would be far too tight, the Kupiec test would reject, and a risk manager relying on it would be under-reserving capital by a factor of three. The exceedance rate is the honest scorecard; the equity curve is not. One caution: Kupiec checks only the average exceedance rate, not whether breaches cluster in time; a model can pass it yet fail the Christoffersen independence test when all its breaches bunch in one stressed week, so a full backtest pairs the two.

Finally the library pair, the "Right Tool" payoff. Code 35.1.3 reproduces the entire GARCH fit and forecast with the arch package, the standard volatility-modeling library, in a handful of lines.

from arch import arch_model

# Same series, same split. arch expects returns in percent for numerical conditioning.
am = arch_model(r_train * 100, mean="Zero", vol="GARCH", p=1, q=1, dist="normal")
fit = am.fit(disp="off")                                # MLE fit, all internals handled

# Rolling one-step-ahead variance forecast over the test window, no leakage.
fc = fit.forecast(horizon=1, reindex=False)
sig_next = np.sqrt(fc.variance.values[-1, 0]) / 100     # back to return units
var_99_lib = -norm.ppf(0.01) * sig_next
print("arch params:", fit.params[["omega","alpha[1]","beta[1]"]].round(4).to_dict())
print("arch 1-step 99%% VaR = %.4f" % var_99_lib)
Code 35.1.3: The same GARCH fit and VaR forecast via the arch library. The from-scratch likelihood, optimizer setup, stationarity constraints, and forecasting recursion of Code 35.1.1 (about 35 lines) collapse to roughly 6 lines; arch handles the maximum-likelihood optimization, the analytic gradients, the parameter constraints, the Student-t and asymmetric-GARCH variants, and the rolling-forecast bookkeeping internally.
arch params: {'omega': 0.0207, 'alpha[1]': 0.0793, 'beta[1]': 0.9006}
arch 1-step 99% VaR = 0.0042
Output 35.1.3: The arch library recovers the same parameters and the same $0.42$ percent one-step VaR as the from-scratch fit (the omega differs only by the percent-scaling factor of $100^2$), confirming the hand implementation while reducing roughly 35 lines to 6.

Read the four code blocks as one argument. Code 35.1.1 fit GARCH and built a VaR using only past data, honoring the leakage discipline in its indexing. Code 35.1.2 validated the band by its exceedance rate, the only scorecard Section 2 trusts. Code 35.1.3 reproduced the fit in a few library lines, the "Right Tool" principle. The pipeline is the chapter in miniature: predict the predictable thing (variance), build the risk quantity from a probabilistic forecast, and prove it works by honest backtesting rather than a flattering equity curve.

Practical Example: A Desk's VaR Model Survives the Audit

Who: A market-risk team at a mid-size asset manager responsible for the daily 99 percent one-day VaR report on a multi-asset book, the finance series threaded through Chapter 19.

Situation: A new quant had replaced the desk's plain GARCH VaR with a deep quantile network that showed a tighter, more capital-efficient band in backtest, freeing reserves the business wanted to deploy.

Problem: The internal model-validation group ran the Kupiec and Christoffersen exceedance tests of Code 35.1.2 on a genuinely out-of-sample window and found the neural band was breached on $4.5$ percent of days against a $1$ percent target: dangerously under-reserved, not more efficient.

Dilemma: Keep the tighter band that the in-sample backtest loved and free the capital, or revert to the wider GARCH band that the exceedance test passed. The neural backtest had been contaminated by normalization leakage (features scaled over the full sample) of exactly the kind Section 2 describes.

Decision: They reverted to a GARCH-t VaR with adaptive conformal recalibration from Chapter 19 layered on top, which kept the band tight in calm regimes but widened it automatically when realized exceedances drifted above target.

How: They re-ran every candidate model through a purged, embargoed evaluation and accepted only models that passed the Kupiec test on the clean split, ranking survivors by capital efficiency second and calibration first.

Result: The conformal-recalibrated GARCH-t passed the exceedance backtest at $1.2$ percent, satisfied the regulator, and was modestly more capital-efficient than the old plain GARCH, all without the hidden tail risk of the leaky neural band.

Lesson: A tighter risk band that fails its exceedance test is not efficiency, it is hidden leverage. Calibration on a leakage-free split is the first gate; capital efficiency is a tiebreaker among models that pass it, never a substitute for passing.

Library Shortcut: A Full Risk Backtest in a Few Lines

Beyond arch for the volatility model, the rolling forecast and exceedance backtest of Code 35.1.1 and 35.1.2 (roughly 50 lines together) shrink to a short loop using arch_model(...).fit(last_obs=...) for expanding-window refits and a one-line breach count. The library handles the GARCH likelihood, the Student-t and GJR asymmetric variants, the analytic VaR and expected-shortfall formulas, and the rolling-origin forecast bookkeeping; you write the backtest policy and the Kupiec check. For the leakage-safe cross-validation of Section 2, mlfinlab and the PurgedKFold splitter implement purging and embargo directly, replacing a careful hand-written index mask with one cross-validator object.

5. Time-Series Foundation Models in Finance: Promise and Limits Intermediate

The temporal foundation models of Chapter 15 have been evaluated on financial tasks using risk-aware metrics, and the honest 2025 finding rewrites the simple story that "more capacity buys more accuracy". An ACM 2025 study benchmarking TSFMs on financial series evaluated models not just by MASE but by the metrics that matter in finance: VaR coverage (does the predicted risk band hold at the stated level?), Sharpe-adjusted MASE (is the forecast accurate enough to generate positive risk-adjusted return?), and directional accuracy (does the model get the sign of the next return correct more than half the time?). On pure numeric extrapolation, taking a price history and predicting the next price, TSFMs perform no better than a well-tuned ARIMA or ETS. The reason is structural: financial return series sit at the near-random-walk floor of predictability established in Chapter 1.5. No additional capacity conjures signal that is not in the data, and the near-zero signal-to-noise ratio means that the patterns a TSFM learned from thousands of other series simply do not transfer to returns whose conditional mean is nearly flat.

Numeric Example: The Near-Random-Walk Ceiling on SP500 Direction

Consider 1-day-ahead direction prediction on daily SP500 log returns. Three models are evaluated on an out-of-sample window of 500 trading days with a purged, embargoed split and no normalization leakage. Chronos (zero-shot): 51.8% directional accuracy. Kronos (financial-domain TSFM, described below): 53.2%. ARIMA(1,0,0): 51.3%. Random walk (always predict "up"): 50.0% on a slightly bullish index. All four numbers cluster within three percentage points of the random-walk floor. The Sharpe ratios implied by these directional accuracies, after realistic transaction costs of five basis points per trade, are all near zero or negative. The ceiling is not a model failure; it is the efficient-market null made concrete. A directional accuracy of 55% sustained over 500 days would be considered a strong edge at a hedge fund. The gap between 53.2% and 55% is the gap between a research curiosity and a trading business.

The picture changes when the TSFM can access text alongside price history. When a model receives earnings call transcripts, news sentiment scores, or analyst report summaries simultaneously with the numeric return sequence, it outperforms pure numeric models by 8 to 15 percentage points on directional accuracy on the tasks where text is informative. This text-augmented finance setting is where TSFMs genuinely add value, because the model can fuse the semantic signal in language with the numeric pattern in returns, a fusion that a pure numeric ARIMA cannot perform. The practical conclusion is narrow: TSFMs help in finance when the task is multimodal, not when the input is prices alone.

Kronos is a financial-domain TSFM pretrained on 12 billion financial records spanning equities, foreign exchange, commodities, and interest rates. Its key design choice is domain specialization: rather than pretraining on a general time-series corpus (as Chronos and Moirai do), Kronos pretrains only on financial data, so the patterns it internalizes, volatility clustering, the leverage effect, mean reversion in spreads, are the patterns that appear in financial target series. On financial benchmarks Kronos outperforms Chronos and TimesFM because the pretraining distribution matches the target distribution. However, the improvement is modest when the signal-to-noise ratio is near zero: Kronos's 53.2% directional accuracy on SP500 is better than Chronos's 51.8%, but neither clears the 55% bar that would be economically meaningful after costs. Domain specialization narrows the distribution mismatch but cannot manufacture predictability that the series does not contain.

Key Insight: TSFMs Are Most Valuable Where Finance Is Already Predictable

The correct question for a practitioner is not "does the TSFM beat ARIMA on returns?" (usually no) but "does the TSFM help on the tasks where the signal actually exists?" Two such tasks stand out. First, volatility forecasting: the conditional variance of returns is predictable (Section 1 and Chapter 6), and a TSFM that has seen a vast corpus of volatility regimes may generalize better across market crises than a GARCH fit on one asset's history, especially in the early days of a new regime. Second, anomaly detection for structural breaks and fat-tail events: a TSFM's representation of "normal" for a given series provides a background against which a structural break or a data-quality anomaly (bad tick, corporate action) stands out. These are exactly the tasks where temporal pattern recognition transfers across series. For alpha generation in returns, where the signal is near zero, even the best TSFM is operating at the efficiency frontier and cannot outrun it.

Research Frontier: Domain-Specialized TSFMs and Text-Augmented Finance (2025)

Three lines are active in 2025. First, financial-domain pretraining: Kronos (12B records) and its successors explore how much the pretraining distribution must match the target distribution to recover the accuracy gap between a general TSFM and a classical method; the 2025 evidence suggests the match matters most for volatility and spread series, where there is genuine cross-asset structure to learn, and matters least for equity returns, where idiosyncratic noise dominates. Second, text-augmented TSFMs: architectures that fuse earnings-call transcripts or news embeddings with numeric return history in a single forward pass, taking directional accuracy from the 51 to 53% range of pure-numeric models toward 58 to 65% on earnings-announcement windows, where the information content of text is highest. Third, conformal risk wrapping: rather than asking a TSFM to produce a VaR directly, wrapping any TSFM's probabilistic forecast with the adaptive conformal inference of Chapter 19 to obtain a VaR band with a finite-sample coverage guarantee that holds even when the model's distributional assumptions are wrong, the correct deployment pattern for a TSFM whose uncertainty calibration on financial data has not been independently validated.

The practical implication for a builder is specific. In finance, do not deploy a TSFM for return direction prediction without a rigorous leakage-free benchmark against ARIMA and the random walk; the TSFM is unlikely to win and the cost of misplaced confidence is real capital. Do consider a TSFM, especially a domain-specialized one such as Kronos, for volatility forecasting and structural-break detection, where temporal patterns genuinely transfer across assets and the model's richer representation earns its keep. And wrap any TSFM's uncertainty output in conformal recalibration before treating it as a VaR, so the exceedance backtest of Section 4 passes by construction. The TSFM is a new tool in the finance toolkit, not a replacement for the discipline of Section 2 or the predictability analysis of Section 1.

6. Exercises

These exercises build directly on the leakage-safe pipeline of Section 4 and the discipline of Section 2.

Exercise 35.1.1 (Conceptual)

Explain in your own words why the conditional variance of returns is forecastable while the conditional mean is not, referencing both the efficient-market argument of Chapter 1.5 and the volatility-clustering mechanism of GARCH. Then state precisely which of the four finance problems in Section 1 you would expect a temporal foundation model from Chapter 15 to help with, and which it cannot help with, and why.

Exercise 35.1.2 (Implementation)

Extend Code 35.1.1 to a GJR-GARCH(1,1) that adds a leverage term $\gamma\, r_{t-1}^2\,\mathbb{1}[r_{t-1} < 0]$ to the variance recursion, so negative shocks raise future volatility more than positive ones. Fit it by maximum likelihood on the training window, re-run the exceedance backtest of Code 35.1.2, and report whether the asymmetric model produces a Kupiec $p$-value closer to a pass than the symmetric GARCH on a return series simulated with a true leverage effect. Verify your fit against arch_model(..., o=1).

Exercise 35.1.3 (Open-ended)

Design a leakage-free evaluation for a candidate daily return-direction signal of your choice. Specify the label horizon, the purge and embargo widths around each fold (justify them from the label horizon and the feature autocorrelation), the naive baseline you must beat, and the transaction-cost model. Then argue, quantitatively where you can, what out-of-sample directional accuracy or $R^2$ the signal would need to clear costs and beat the baseline, and why most candidate signals fail that bar. Connect your transaction-cost reasoning to the execution-as-MDP framing of Part VI.

This section was the payoff for the finance running dataset and the synthesis of the book's tools onto one domain: variance forecasting from Chapter 6, risk from Chapter 19, decisions from Part VI, regimes from Chapter 8, all disciplined by the leakage rules of Chapter 2. The same template, predict the predictable, quantify uncertainty honestly, validate on a leakage-free split, carries into the other domains of this chapter. Section 35.2 turns to healthcare, where the running clinical series meets irregular sampling and the cost of a miscalibrated alarm is measured in lives, not basis points. The sibling sections of this chapter continue the tour: 35.3 (manufacturing and predictive maintenance), 35.4 (energy and climate), 35.5 (autonomous systems and robotics), and 35.6 (scientific discovery), all collected on the chapter index.