mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-29 15:10:37 +00:00
Indicators: Add support for correlation coefficient (#519)
* Add support for correlation coefficient code * Bump ta depends * Bump gct-ta depends version
This commit is contained in:
15
gctscript/examples/ta/correlation.gct
Normal file
15
gctscript/examples/ta/correlation.gct
Normal file
@@ -0,0 +1,15 @@
|
||||
fmt := import("fmt")
|
||||
exch := import("exchange")
|
||||
t := import("times")
|
||||
cc := import("indicator/correlationcoefficient")
|
||||
|
||||
load := func() {
|
||||
start := t.date(2017, 8 , 17 , 0 , 0 , 0, 0)
|
||||
end := t.add_date(start, 0, 6 , 0)
|
||||
ohlcvDataBTC := exch.ohlcv("binance", "BTC-USDT", "-", "SPOT", start, end, "1d")
|
||||
ohlcvDataETH := exch.ohlcv("binance", "ETH-USDT", "-", "SPOT", start, end, "1d")
|
||||
ret := cc.calculate(ohlcvDataBTC.candles, ohlcvDataETH.candles, 20)
|
||||
fmt.println(ret)
|
||||
}
|
||||
|
||||
load()
|
||||
Reference in New Issue
Block a user