From e0049d3fa2d2a46eb1f14463a28cae673ac337df Mon Sep 17 00:00:00 2001 From: anywhy Date: Sat, 23 Mar 2024 16:29:26 +0800 Subject: [PATCH] update indicator adx test case --- pkg/indicator/v2/adx_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/indicator/v2/adx_test.go b/pkg/indicator/v2/adx_test.go index 4b56e60585..2dadca83c8 100644 --- a/pkg/indicator/v2/adx_test.go +++ b/pkg/indicator/v2/adx_test.go @@ -9,6 +9,22 @@ import ( "github.com/c9s/bbgo/pkg/types" ) +/* +import pandas as pd +import pandas_ta as ta + + data = { + "high": [40145.0, 40186.36, 40196.39, 40344.6, 40245.48, 40273.24, 40464.0, 40699.0, 40627.48, 40436.31, 40370.0, 40376.8, 40227.03, 40056.52, 39721.7, 39597.94, 39750.15, 39927.0, 40289.02, 40189.0], + "low": [39870.71, 39834.98, 39866.31, 40108.31, 40016.09, 40094.66, 40105.0, 40196.48, 40154.99, 39800.0, 39959.21, 39922.98, 39940.02, 39632.0, 39261.39, 39254.63, 39473.91, 39555.51, 39819.0, 40006.84], + "close": [40105.78, 39935.23, 40183.97, 40182.03, 40212.26, 40149.99, 40378.0, 40618.37, 40401.03, 39990.39, 40179.13, 40097.23, 40014.72, 39667.85, 39303.1, 39519.99,39693.79, 39827.96, 40074.94, 40059.84] + } + +high = pd.Series(data['high']) +low = pd.Series(data['low']) +close = pd.Series(data['close']) +result = ta.adx(high, low, close, length=7) +print(result) +*/ func Test_ADX(t *testing.T) { var bytes = []byte(`{ "high": [40145.0, 40186.36, 40196.39, 40344.6, 40245.48, 40273.24, 40464.0, 40699.0, 40627.48, 40436.31, 40370.0, 40376.8, 40227.03, 40056.52, 39721.7, 39597.94, 39750.15, 39927.0, 40289.02, 40189.0],