cfdf515228
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
42 lines
1.3 KiB
Markdown
42 lines
1.3 KiB
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, pendiente-usar]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: ""
|
|
imports: [math]
|
|
params:
|
|
- name: returns
|
|
desc: "lista de retornos diarios o periodicos (ej: [0.01, -0.005, 0.008]). Valores en rango [-1, 1] tipicamente."
|
|
- name: periods_per_year
|
|
desc: "numero de periodos por año (252 para datos diarios, 12 para mensuales, 52 para semanales)"
|
|
output: "volatilidad anualizada en forma decimal (ej: 0.15 para 15% de volatilidad anualizada)"
|
|
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.
|