strategy/pivotshort: add trendema test case

This commit is contained in:
Andy Cheng 2022-09-11 14:42:05 +08:00
parent 98bd6ca1d2
commit df7d768b94

View File

@ -0,0 +1,21 @@
package bbgo
import (
"testing"
"github.com/c9s/bbgo/pkg/types"
)
func Test_TrendEMA(t *testing.T) {
t.Run("Test Trend EMA", func(t *testing.T) {
trendEMA_test := TrendEMA{
IntervalWindow: types.IntervalWindow{Window: 1},
}
trendEMA_test.last = 1000.0
trendEMA_test.current = 1200.0
if trendEMA_test.Gradient() != 1.2 {
t.Errorf("Gradient() = %v, want %v", trendEMA_test.Gradient(), 1.2)
}
})
}