mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
strategy/pivotshort: add trendema test case
This commit is contained in:
parent
98bd6ca1d2
commit
df7d768b94
21
pkg/bbgo/trend_ema_test.go
Normal file
21
pkg/bbgo/trend_ema_test.go
Normal 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)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user