Yield Curve Intelligence
An original implementation that combines yield-curve inversion diagnostics, Nelson-Siegel factor decomposition, and equity-stress overlays from live yfinance data.
Executive Summary
This report studies whether daily Treasury curve shape can be converted into an interpretable macro-risk signal. The framework combines inversion diagnostics, Nelson-Siegel factor decomposition, and an equity-stress overlay to classify market states. The objective is not point-forecasting recessions at a specific date, but building a transparent, reproducible monitoring system that captures when fixed-income pricing and risk assets jointly indicate elevated macro fragility.
Data and Scope
Input series are daily Treasury proxies from Yahoo Finance: ^IRX (3M), ^FVX (5Y), ^TNX (10Y), ^TYX (30Y), plus SPY for equity drawdown context.
Sample window covers the latest 10 years with synchronized business-day alignment and short-gap forward fill where needed.
The analysis is intentionally daily and medium-horizon; it is designed for regime monitoring and macro risk interpretation rather than intraday trading.
Research Questions
RQ1: Does curve inversion persistence provide a stable warning signal beyond one-day noise?
RQ2: Do Nelson-Siegel factors add explanatory structure relative to simple spreads alone?
RQ3: Does combining term-structure information with equity stress produce more actionable regime labels?
Methodological Framework
Curve-shape layer: 10Y-3M slope, 10Y-2Y proxy slope, 30Y-10Y long-end steepness, and 10Y/3M ratio.
Factor layer: daily Nelson-Siegel decomposition into level, slope, curvature, and decay parameter lambda.
Risk-conditioning layer: 252-day SPY drawdown is used to separate benign curve flattening from broader risk-off episodes.
State-classification layer: interpretable labels (Steep Growth, Neutral, Inversion Watch, Inversion + Risk-Off) summarize joint fixed-income and equity behavior.
Calculation Theory
Term-spread signal: \(S_{10,3m,t} = y_{10y,t} - y_{3m,t}\). Inversion begins when \(S_{10,3m,t} < 0\). A secondary confirmation uses \(S_{10,2p,t}\), where the short-end proxy is constructed from 3M and 5Y to avoid dependence on a single tenor.
Curve ratio: \(R_t = y_{10y,t}/y_{3m,t}\). Ratios below one indicate a short-end yield premium over the long end, consistent with inversion dynamics.
Nelson-Siegel representation: \(\hat y_t(\tau)=\beta_{0,t}+\beta_{1,t}L_1(\tau,\lambda_t)+\beta_{2,t}L_2(\tau,\lambda_t)\), where \(L_1=(1-e^{-\lambda\tau})/(\lambda\tau)\) and \(L_2=L_1-e^{-\lambda\tau}\).
Interpretation: \(\beta_0\) approximates long-run level, \(\beta_1\) captures short-end slope pressure, and \(\beta_2\) captures medium-tenor curvature (hump).
Estimation objective: \(\min_{\theta_t}\sum_i(y_{i,t}-\hat y_t(\tau_i;\theta_t))^2\) with \(\theta_t=(\beta_0,\beta_1,\beta_2,\lambda)\) and \(\lambda>0\). Bounded nonlinear optimization is solved daily to obtain a factor time series.
Risk regime mapping: recession-risk indicator \(I_t=1\) when both primary and proxy slope are negative; otherwise \(I_t=0\). Final regime labels are assigned from \(I_t\), factor slope sign/magnitude, and SPY rolling drawdown thresholds.
Empirical Results
The results section reports spread trajectories, yield-level evolution by tenor, Nelson-Siegel factor dynamics, ratio/lambda behavior, regime frequency, and recession-flag timeline behavior.
Across the full sample, inversion episodes are persistent rather than isolated single-day events, supporting the use of frequency and duration metrics in addition to point-in-time sign checks.
Factor behavior generally aligns with intuition from the literature: flattening and inversion periods coincide with weaker slope factors, while steep-growth phases coincide with positive spread regimes.
A notable insight from the latest window is that long-end steepness (30Y-10Y) can re-expand even while short-end inversion pressure remains elevated. This divergence matters because it often reflects term-premium normalization rather than a full macro-risk reset.
The SPY drawdown-conditioned regime layer reduces false comfort from curve-only normalization: several episodes show partial spread recovery while equity drawdown remains materially negative, indicating risk repricing is not yet fully resolved.
Discussion and Interpretation
A pure spread signal can produce early warnings but may also remain inverted for extended periods. Conditioning with equity drawdown helps separate cautionary flattening from broad market stress.
Nelson-Siegel factors provide a compact way to track structural shape shifts in the term structure without requiring many maturity points.
Regime labels are intended as decision-support context for macro risk monitoring, not as deterministic recession timing calls.
From a portfolio-construction perspective, the level/slope/curvature split is more useful than a single inversion flag: level shocks often dominate duration risk, while slope shocks are more informative for cyclical positioning and cross-asset beta budgeting.
Operationally, the most actionable output is persistence, not one-day sign flips. Monitoring consecutive inversion days, rolling inversion share, and slope-factor momentum provides a cleaner escalation framework for risk committees.
Limitations
Yahoo Finance Treasury symbols are market proxies and can differ from official constant-maturity Treasury series.
Daily frequency may include micro noise around holidays and thin sessions; monthly aggregation can improve robustness for some use cases.
Rule-based regime thresholds are interpretable but still parameter choices; sensitivity checks are recommended before production use.
References and Originality
The project is conceptually inspired by four references: alecontuu/ml_for_finance (yield-curve prediction notebook), tomasrubin/yield-curve-forecasting (Nelson-Siegel fitting), ahgperrin/PyCurve (curve-tooling patterns), and skasim/yield-curve (inversion-focused recession framing).
This page and code are newly written for this repository. The approach, structure, data flow, equations usage, and narrative are consolidated and re-authored to avoid copy-paste duplication.
Where the external work is helpful, it is treated as methodological context rather than reused textual or code content.
Reproducibility
From repository root: `python engine/src/yield_curve_intelligence.py`.
The process fetches market data, estimates daily factors, computes regime diagnostics, and writes refreshed outputs under `data/yield-curve/` and `public/data/yield-curve/`.
Results are deterministic for a given data snapshot and can be rerun as new market observations arrive.