@@ -37,6 +37,25 @@ On August 17, 1998, Russia defaulted on its domestic debt. What LTCM's models pr
3737- Federal Reserve orchestrated a $3.6B bailout by 14 banks
3838- Spreads that "always" converged took ** months** to revert, not days
3939
40+ ``` mermaid
41+ timeline
42+ title LTCM Collapse Timeline - When Stationarity Broke
43+ section 1994-1997
44+ 1994 : Fund Launch : $1.25B capital : Nobel laureates join
45+ 1995-1996 : Glory Years : 40%+ annual returns : $7B under management
46+ 1997 : Peak Performance : 17% return : Models validated
47+ section 1998 Crisis
48+ Jan-Jul 1998 : Warning Signs : Asia crisis : Volatility rising : Models still profitable
49+ Aug 17 : Russian Default : 3-sigma event : Spreads widen 300%
50+ Aug 17-21 : Week 1 : $550M loss (12%) : Mean reversion expected
51+ Aug 24-28 : Week 2 : $750M loss (20%) : Correlations collapse
52+ Sep 1-15 : Acceleration : Daily 5-sigma events : Liquidity vanishes
53+ Sep 23 : Bailout : $400M remains (91% loss) : Fed orchestrates $3.6B rescue
54+ section Aftermath
55+ 1999-2000 : Liquidation : Positions unwound over months : Spreads finally converge
56+ 2000 : Lessons : Liquidity risk recognized : Tail risk management born
57+ ```
58+
4059### What Went Wrong: Three Fatal Statistical Assumptions
4160
4261** 1. Stationarity Assumption**
@@ -837,6 +856,21 @@ By using both tests, we get four possible outcomes:
837856| ✓ (Stationary) | ✓ (Unit root) | ** Trend-stationary** (detrend first) |
838857| ✗ (Unit root) | ✗ (Stationary) | ** Inconclusive** (increase sample size) |
839858
859+ ``` mermaid
860+ quadrantChart
861+ title Stationarity Test Decision Matrix
862+ x-axis "ADF: Non-Stationary" --> "ADF: Stationary"
863+ y-axis "KPSS: Stationary" --> "KPSS: Non-Stationary"
864+ quadrant-1 "⚠️ TREND-STATIONARY<br/>Detrend before modeling"
865+ quadrant-2 "✓ STATIONARY<br/>Safe to model (BEST)"
866+ quadrant-3 "? INCONCLUSIVE<br/>Increase sample size"
867+ quadrant-4 "✗ NON-STATIONARY<br/>Difference or abandon"
868+ SPY Returns: [0.85, 0.15]
869+ SPY Prices: [0.15, 0.85]
870+ BTC Returns: [0.80, 0.20]
871+ GDP: [0.20, 0.80]
872+ ```
873+
840874** Worked Example: SPY Returns**
841875
842876** ADF Test:**
@@ -1786,6 +1820,57 @@ Where $R_t'$ is the differenced series.
17861820
17871821George Box and Gwilym Jenkins (1970) developed a 3-step procedure for ARIMA model building:
17881822
1823+ ``` mermaid
1824+ stateDiagram-v2
1825+ [*] --> LoadData: Raw Time Series
1826+ LoadData --> CheckStationarity: Visual Inspection
1827+
1828+ CheckStationarity --> Difference: ADF p > 0.05<br/>(Non-stationary)
1829+ CheckStationarity --> IdentifyOrders: ADF p < 0.05<br/>(Stationary)
1830+ Difference --> CheckStationarity: d = d + 1
1831+
1832+ IdentifyOrders --> PlotACF_PACF: Examine Patterns
1833+ PlotACF_PACF --> SelectModel: ACF/PACF Analysis
1834+
1835+ SelectModel --> EstimateAR: PACF cuts off<br/>ACF decays
1836+ SelectModel --> EstimateMA: ACF cuts off<br/>PACF decays
1837+ SelectModel --> EstimateARMA: Both decay
1838+
1839+ EstimateAR --> Diagnostics: MLE/OLS
1840+ EstimateMA --> Diagnostics: MLE
1841+ EstimateARMA --> Diagnostics: MLE
1842+
1843+ Diagnostics --> LjungBox: Test Residuals
1844+ LjungBox --> PassedDiagnostics: p > 0.05<br/>(White noise)
1845+ LjungBox --> SelectModel: p < 0.05<br/>(Try different p,q)
1846+
1847+ PassedDiagnostics --> OutOfSample: Walk-forward test
1848+ OutOfSample --> DeployModel: RMSE_test ≈ RMSE_train
1849+ OutOfSample --> SelectModel: RMSE_test >> RMSE_train<br/>(Overfitting)
1850+
1851+ DeployModel --> [*]: Production Ready
1852+
1853+ note right of CheckStationarity
1854+ Use ADF + KPSS
1855+ d=0 for returns
1856+ d=1 for prices
1857+ end note
1858+
1859+ note right of PlotACF_PACF
1860+ Look for patterns:
1861+ - Sharp cutoff
1862+ - Exponential decay
1863+ - Significance bounds
1864+ end note
1865+
1866+ note right of Diagnostics
1867+ Check:
1868+ 1. Ljung-Box (residuals)
1869+ 2. Jarque-Bera (normality)
1870+ 3. AIC/BIC (parsimony)
1871+ end note
1872+ ```
1873+
17891874** STEP 1: IDENTIFICATION**
17901875* Goal: Determine orders p, d, q*
17911876
@@ -2406,6 +2491,30 @@ Interpretation:
24062491- High turnover → need low transaction costs
24072492```
24082493
2494+ ``` mermaid
2495+ ---
2496+ config:
2497+ themeVariables:
2498+ xyChart:
2499+ backgroundColor: transparent
2500+ ---
2501+ xychart-beta
2502+ title "ETH/BTC Spread Mean Reversion (2023)"
2503+ x-axis [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
2504+ y-axis "Spread ($)" -80 --> 100
2505+ line "Spread" [5, -15, 45, 75, 35, -10, 25, 60, 85, 40, -5, 15]
2506+ line "Mean (0)" [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
2507+ line "+2σ (Entry)" [47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47]
2508+ line "-2σ (Entry)" [-47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47]
2509+ ```
2510+
2511+ ** Chart Interpretation:**
2512+ - ** Blue line (Spread):** ETH - 0.0621×BTC oscillates around zero
2513+ - ** Red line (Mean):** Long-run equilibrium at $0
2514+ - ** Green lines (±2σ):** Entry thresholds at ±$47
2515+ - ** Pattern:** Clear mean reversion - spread crosses +2σ in Mar, Aug, Sep → SHORT signals
2516+ - ** Half-life (3.4 days):** Visible in rapid reversions after peaks
2517+
24092518** STEP 5: Backtest (Simplified)**
24102519
24112520``` lisp
@@ -3017,6 +3126,21 @@ Out-of-sample validation: RMSE_test ≈ RMSE_train (within 10%)
30173126- ✓ Low transaction costs (<0.05% per leg)
30183127- ✓ Fast mean reversion (half-life < 10 periods)
30193128
3129+ ``` mermaid
3130+ quadrantChart
3131+ title Time Series Strategy Selection Matrix
3132+ x-axis "Weak Pattern (|φ| < 0.1)" --> "Strong Pattern (|φ| > 0.2)"
3133+ y-axis "Slow Reversion (τ > 20d)" --> "Fast Reversion (τ < 5d)"
3134+ quadrant-1 "🚀 HIGH FREQUENCY<br/>Momentum + Quick Scalp<br/>BTC hourly, limit orders"
3135+ quadrant-2 "✓ PAIRS TRADING<br/>ETH/BTC cointegration<br/>Best risk/reward"
3136+ quadrant-3 "✗ AVOID<br/>Weak + Slow<br/>Not tradeable"
3137+ quadrant-4 "⚠️ POSITION TRADING<br/>Weekly equity momentum<br/>High cost risk"
3138+ ETH/BTC Pairs: [0.75, 0.80]
3139+ BTC Hourly AR: [0.65, 0.25]
3140+ SPY Weekly: [0.35, 0.15]
3141+ Random Walk: [0.10, 0.50]
3142+ ```
3143+
30203144** Success Examples:**
30213145- ** Pairs trading:** ETH/BTC, equity sector pairs (XLE/XLF)
30223146- ** Spread trading:** Futures calendar spreads, cash-futures basis
0 commit comments