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>
This commit is contained in:
2026-03-28 02:23:31 +01:00
parent 16e34a806e
commit 113c6dfd71
31 changed files with 830 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
---
name: ema
kind: function
lang: go
domain: finance
version: "1.0.0"
purity: pure
signature: "func EMA(data []float64, period int) []float64"
description: "Calcula la media movil exponencial (EMA) sobre una serie de datos con un periodo dado."
tags: [finance, indicator, ema, moving-average]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
tested: false
tests: []
test_file_path: ""
file_path: "functions/finance/ema.go"
---
# ema
Calcula la media movil exponencial (Exponential Moving Average). Se inicializa con la SMA de los primeros `period` elementos. El multiplicador es `2 / (period + 1)`.
## Ejemplo
```go
result := finance.EMA([]float64{10, 11, 12, 13, 14, 15}, 3)
// result[2] = SMA de los primeros 3 = 11.0
// result[3] en adelante usa suavizado exponencial
```