From 3d86330428825498d7de2dd284d1da10bba848be Mon Sep 17 00:00:00 2001 From: zenix Date: Fri, 22 Apr 2022 19:11:07 +0900 Subject: [PATCH] fix: python test code in indicator --- pkg/indicator/dema_test.go | 2 +- pkg/indicator/hull_test.go | 2 +- pkg/indicator/tema_test.go | 2 +- pkg/indicator/till_test.go | 2 +- pkg/indicator/zlema_test.go | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/indicator/dema_test.go b/pkg/indicator/dema_test.go index f98f5c31d..c58429672 100644 --- a/pkg/indicator/dema_test.go +++ b/pkg/indicator/dema_test.go @@ -13,7 +13,7 @@ import ( python: import pandas as pd -s = pd.Series(([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) +s = pd.Series([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) ma1 = s.ewm(span=16).mean() ma2 = ma1.ewm(span=16).mean() result = (2 * ma1 - ma2) diff --git a/pkg/indicator/hull_test.go b/pkg/indicator/hull_test.go index a6a5cb99b..95f883cd8 100644 --- a/pkg/indicator/hull_test.go +++ b/pkg/indicator/hull_test.go @@ -13,7 +13,7 @@ import ( python: import pandas as pd -s = pd.Series(([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) +s = pd.Series([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) ma1 = s.ewm(span=8).mean() ma2 = s.ewm(span=16).mean() result = (2 * ma1 - ma2).ewm(span=4).mean() diff --git a/pkg/indicator/tema_test.go b/pkg/indicator/tema_test.go index d36c6a530..641153f40 100644 --- a/pkg/indicator/tema_test.go +++ b/pkg/indicator/tema_test.go @@ -13,7 +13,7 @@ import ( python: import pandas as pd -s = pd.Series(([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) +s = pd.Series([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) ma1 = s.ewm(span=16).mean() ma2 = ma1.ewm(span=16).mean() ma3 = ma2.ewm(span=16).mean() diff --git a/pkg/indicator/till_test.go b/pkg/indicator/till_test.go index 1c2c96e69..4615a5dbe 100644 --- a/pkg/indicator/till_test.go +++ b/pkg/indicator/till_test.go @@ -13,7 +13,7 @@ import ( python: import pandas as pd -s = pd.Series(([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) +s = pd.Series([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) ma1 = s.ewm(span=16).mean() ma2 = ma1.ewm(span=16).mean() ma3 = ma2.ewm(span=16).mean() diff --git a/pkg/indicator/zlema_test.go b/pkg/indicator/zlema_test.go index a209d3b65..4b0e546ab 100644 --- a/pkg/indicator/zlema_test.go +++ b/pkg/indicator/zlema_test.go @@ -13,8 +13,8 @@ import ( python: import pandas as pd -s = pd.Series(([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) -lag = int((16-1)/2) +s = pd.Series([0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9]) +lag = int((16-1)/2 + 0.5) emadata = s + (s - s.shift(lag)) result = emadata.ewm(span=16).mean() print(result)