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,17 @@
|
||||
package finance
|
||||
|
||||
// NormalizeOHLCV ajusta slices de precios OHLCV multiplicando por un factor.
|
||||
func NormalizeOHLCV(open, high, low, close []float64, factor float64) ([]float64, []float64, []float64, []float64) {
|
||||
n := len(open)
|
||||
nOpen := make([]float64, n)
|
||||
nHigh := make([]float64, n)
|
||||
nLow := make([]float64, n)
|
||||
nClose := make([]float64, n)
|
||||
for i := 0; i < n; i++ {
|
||||
nOpen[i] = open[i] * factor
|
||||
nHigh[i] = high[i] * factor
|
||||
nLow[i] = low[i] * factor
|
||||
nClose[i] = close[i] * factor
|
||||
}
|
||||
return nOpen, nHigh, nLow, nClose
|
||||
}
|
||||
Reference in New Issue
Block a user