Drawdown and Maximum Drawdown
Install and import#
npm install fintech-algorithmsimport { drawdownAndMaximumDrawdown } from "fintech-algorithms/financial-mathematics-statistics-and-data-foundations/financial-risk-and-performance-statistics/drawdown-and-maximum-drawdown";Signature#
drawdownAndMaximumDrawdown(input)Worked example#
verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.
Input#
{
"returns": [0.01, -0.02, 0.015, -0.01, 0.03],
"benchmark": [0.008, -0.01, 0.012, -0.006, 0.02],
"frequency": 252,
"target": 0,
"confidence": 0.8,
"riskFree": 0.0001,
"weights": [0.6, 0.4],
"covarianceMatrix": [
[0.04, 0.01],
[0.01, 0.09]
]
}Call#
drawdownAndMaximumDrawdown(input)Returns#
object with 2 fields: drawdowns, maximumDrawdown
{
"drawdowns": [0, -0.020000000000000018, -0.0053000000000001934, -0.015247000000000233, 0],
"maximumDrawdown": -0.020000000000000018
}Diagrams#
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- Expected Shortfall — Basel Framework MAR33
- Mutual Fund Performance — William F. Sharpe
- Measures of Scale — NIST/SEMATECH e-Handbook
- Historical-example decision