Skip to content

Commit

Permalink
strategy/pivotshort: add trendema test case
Browse files Browse the repository at this point in the history
  • Loading branch information
andycheng123 committed Sep 11, 2022
1 parent 98bd6ca commit df7d768
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/bbgo/trend_ema_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
})
}

0 comments on commit df7d768

Please sign in to comment.