95959f713c
Agrega funciones Python reutilizables organizadas por dominio: - core: composicion funcional (pipe, compose, map, filter, reduce, etc.) - cybersecurity: analisis de amenazas y puertos - datascience: estadisticas y deteccion de outliers - finance: indicadores tecnicos y analisis financiero
876 B
876 B
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| max_drawdown | function | py | finance | 1.0.0 | pure | def max_drawdown(values: list) -> tuple | Calcula el maximo drawdown y los indices de inicio y fin del peor periodo. |
|
false | false | python/functions/finance/finance.py |
Ejemplo
portfolio = [100, 110, 105, 95, 102, 108, 90, 95]
dd, start, end = max_drawdown(portfolio)
# dd = 0.1818..., start = 1, end = 6 (de 110 a 90)
Notas
Retorna tupla (max_dd, start_idx, end_idx) donde max_dd es fraccion (0.0 a 1.0). start_idx es el indice del pico previo, end_idx es el indice del valle. Retorna (0.0, 0, 0) si la lista tiene menos de 2 elementos.