Module 12VaR & ESLesson 4 of 724 min
Historical VaR
Empirical quantile of PnL.
Steps
- Collect PnL history
- Sort ascending
- VaR_α = -quantile_α (positive loss convention)
Caveats
Needs enough history; regime changes; no guarantee for tomorrow.
Challenge
Try alpha=0.1 and interpret.
Tips
- partial_cmp for f64 sort
- Sign convention: positive loss
- Need many days for 99%
Try it live
Historical VaRRust 2021
Loading editor…
Output
Press Run to compile and execute.