feat: funciones Python para core, cybersecurity, datascience y finance
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
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: max_drawdown
|
||||
kind: function
|
||||
lang: py
|
||||
domain: finance
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "def max_drawdown(values: list) -> tuple"
|
||||
description: "Calcula el maximo drawdown y los indices de inicio y fin del peor periodo."
|
||||
tags: [finance, drawdown, risk, performance, python]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/finance/finance.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
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.
|
||||
Reference in New Issue
Block a user