Historical Var
Quick Reference
| Property | Value |
|---|---|
| Dimension | regime |
| Category | volatility |
| Version | v0.9.0 (Beta) |
| Output Column | var_95 |
Historical Value-at-Risk and Expected Shortfall - quantile-based tail risk measures from rolling return distribution
Formula
historical_var(returns, window, confidence)
CDM Inputs
| Column | CDM Table | Description |
|---|---|---|
returns | cdm_* | CDM source table |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
window | integer [20, 2000] | 100 | Window for historical return distribution |
confidence | float [0.8, 0.995] | 0.95 | Confidence level for VaR (e.g., 0.95 = 95%) |
Output
Column: var_95
Historical Value-at-Risk at 95th percentile (worst expected loss)
Market Intuition & Trading Rationale
Historical VaR (Value-at-Risk) estimates the worst expected loss at a given confidence level: historical_var(returns, window, confidence). At 95% confidence, VaR answers: what is the minimum loss I should expect in the worst 5% of scenarios? A VaR of -2% means you should expect to lose at least 2% on 5% of days. The feature uses the empirical quantile of the rolling return distribution — no parametric assumptions (no normal distribution requirement).
The window parameter controls the lookback for the return distribution. Short windows (20–50) adapt quickly but produce noisy estimates. Long windows (500–2000) are stable but slow to reflect regime changes. The confidence parameter sets the tail threshold — 95% is standard for daily risk management; 99% for regulatory capital; 90% for more responsive tactical adjustments.
VaR has known limitations: it doesn't capture the magnitude of losses beyond the threshold (a 95% VaR of -2% tells you nothing about whether the worst 5% of days lose 2.1% or 20%). Expected Shortfall (CVaR) addresses this by averaging losses beyond the VaR threshold, but this FeatureType implements the simpler quantile-based VaR.
Usage Cases
- Position sizing by risk budget: If your daily VaR limit is -2% and VaR_95 = -3%, reduce positions until VaR falls within the limit. This is the standard institutional risk management workflow.
- Regime volatility scaling: Compare current VaR to its historical median. VaR > 2× median → high-risk regime (reduce exposure). VaR near median → normal regime. VaR < 0.5× median → unusually calm (may precede a volatility spike — the "calm before the storm").
- Stop-loss placement: Set stop-loss levels at the VaR threshold. If VaR_95 = -2%, a stop at -2% means you'll be stopped out on approximately 5% of days — acceptable for most strategies.
YAML Definition
name: historical_var
description: Historical Value-at-Risk and Expected Shortfall - quantile-based tail
risk measures from rolling return distribution
category: volatility
version: v0.9.0 (Beta)
dimension: regime
status: Pre-release
required_inputs:
- returns
output_column: var_95
output_description: Historical Value-at-Risk at 95th percentile (worst expected loss)
parameters:
window:
type: integer
description: Window for historical return distribution
required: false
default: 100
constraints:
min: 20
max: 2000
confidence:
type: float
description: Confidence level for VaR (e.g., 0.95 = 95%)
required: false
default: 0.95
constraints:
min: 0.8
max: 0.995
formula: historical_var(returns, window, confidence)