113c6dfd71
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>
38 lines
1.0 KiB
Markdown
38 lines
1.0 KiB
Markdown
---
|
|
name: tick_to_ohlcv
|
|
kind: function
|
|
lang: go
|
|
domain: finance
|
|
version: "1.0.0"
|
|
purity: pure
|
|
signature: "func TickToOHLCV(prices, volumes []float64, timestamps []int64, intervalSecs int64) (open, high, low, close, vol []float64)"
|
|
description: "Agrega datos de ticks en velas OHLCV segun un intervalo de tiempo en segundos."
|
|
tags: [finance, ohlcv, aggregate, tick]
|
|
uses_functions: []
|
|
uses_types: [tick_go_finance, ohlcv_go_finance]
|
|
returns: [ohlcv_go_finance]
|
|
returns_optional: false
|
|
error_type: ""
|
|
imports: []
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "functions/finance/tick_to_ohlcv.go"
|
|
---
|
|
|
|
# tick_to_ohlcv
|
|
|
|
Agrega ticks (precio, volumen, timestamp) en velas OHLCV. Los ticks se agrupan en buckets de `intervalSecs` segundos. Los timestamps deben estar en unix seconds y ordenados cronologicamente.
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
o, h, l, c, v := finance.TickToOHLCV(
|
|
[]float64{100, 101, 99, 102},
|
|
[]float64{10, 20, 15, 25},
|
|
[]int64{1000, 1005, 1055, 1060},
|
|
60,
|
|
)
|
|
// Genera 2 velas: [1000-1059] y [1060-1119]
|
|
```
|