Files
fn_registry/functions/finance/max_drawdown.md
T
egutierrez 113c6dfd71 feat: 15 funciones finance — indicadores, riesgo e IO de mercado
11 funciones puras con implementación real:
SMA, EMA, RSI, BollingerBands, VWAP, LogReturn, AnnualizedVolatility,
SharpeRatio, MaxDrawdown, NormalizeOHLCV, TickToOHLCV

4 funciones impuras (stubs):
FetchOHLCV, StreamTicks, WriteOHLCVToParquet, LoadOHLCVFromDuckDB

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 02:23:31 +01:00

33 lines
875 B
Markdown

---
name: max_drawdown
kind: function
lang: go
domain: finance
version: "1.0.0"
purity: pure
signature: "func MaxDrawdown(values []float64) (maxDD float64, start, end int)"
description: "Calcula el maximo drawdown de una curva de equity, retornando la magnitud y los indices pico-valle."
tags: [finance, drawdown, risk, metric]
uses_functions: []
uses_types: [drawdown_result_go_finance]
returns: [drawdown_result_go_finance]
returns_optional: false
error_type: ""
imports: []
tested: false
tests: []
test_file_path: ""
file_path: "functions/finance/max_drawdown.go"
---
# max_drawdown
Calcula el maximo drawdown (caida maxima desde un pico hasta un valle) como fraccion del pico. Retorna la magnitud (0 a 1) y los indices de inicio y fin.
## Ejemplo
```go
dd, s, e := finance.MaxDrawdown([]float64{100, 120, 90, 110, 80})
// dd = (120-80)/120 = 0.3333, s = 1, e = 4
```