eaed99e52c
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
36 lines
930 B
Markdown
36 lines
930 B
Markdown
---
|
|
name: annualized_volatility
|
|
kind: function
|
|
lang: py
|
|
domain: finance
|
|
version: "1.0.0"
|
|
purity: pure
|
|
signature: "def annualized_volatility(returns: list, periods_per_year: float) -> float"
|
|
description: "Calcula la volatilidad anualizada de una serie de retornos."
|
|
tags: [finance, volatility, risk, python]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: ""
|
|
imports: [math]
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "python/functions/finance/finance.py"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```python
|
|
daily_returns = [0.01, -0.005, 0.008, 0.003, -0.002, 0.006, 0.004]
|
|
vol = annualized_volatility(daily_returns, 252.0)
|
|
# Volatilidad anualizada (std * sqrt(252))
|
|
```
|
|
|
|
## Notas
|
|
|
|
Formula: std_muestral(returns) * sqrt(periods_per_year).
|
|
Usa desviacion estandar muestral (n-1) para ser consistente con la practica financiera.
|
|
Retorna 0.0 si hay menos de 2 retornos o periods_per_year es menor o igual a cero.
|