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:
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: sma
|
||||
kind: function
|
||||
lang: go
|
||||
domain: finance
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func SMA(data []float64, period int) []float64"
|
||||
description: "Calcula la media movil simple (SMA) sobre una serie de datos con un periodo dado."
|
||||
tags: [finance, indicator, sma, moving-average]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/finance/sma.go"
|
||||
---
|
||||
|
||||
# sma
|
||||
|
||||
Calcula la media movil simple (Simple Moving Average). Los primeros `period-1` elementos del resultado son 0 ya que no hay datos suficientes para calcular la media.
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
result := finance.SMA([]float64{1, 2, 3, 4, 5}, 3)
|
||||
// result = [0, 0, 2, 3, 4]
|
||||
```
|
||||
Reference in New Issue
Block a user