Drawdown, run-up and realised-volatility arithmetic for a price or equity series.
No market data. No forecasts. No claims about any asset. It computes what follows arithmetically from a series you supply.
Drawdown quoted without its window is close to meaningless, and a crate shipping its own price history would be asserting a window on the caller's behalf. Supply the series; own the window.
Likewise realised_volatility is not annualised, because annualising requires
knowing the sampling period and this crate is not told it.
Recovering a 50 percent drawdown requires a 100 percent advance. Recovering 80
percent requires 400 percent. recovery_required makes that explicit, and it is
the reason drawdown is quoted at all rather than simple return.
use drawdown_stats::{max_drawdown, max_runup, realised_volatility, recovery_required};
let series = [100.0, 120.0, 60.0, 90.0];
max_drawdown(&series); // 0.5
recovery_required(0.5); // 1.0
Worked examples at earlythunder.com.
MIT.