mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
bbgo: add TestIndicatorSet_EWMA test
This commit is contained in:
parent
ea1025d790
commit
a3a1586e24
|
@ -37,7 +37,7 @@ func TestIndicatorSet_closeCache(t *testing.T) {
|
||||||
assert.Equal(t, close1m, close1m2)
|
assert.Equal(t, close1m, close1m2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIndicatorSet_rsi(t *testing.T) {
|
func TestIndicatorSet_RSI(t *testing.T) {
|
||||||
indicatorSet := newTestIndicatorSet()
|
indicatorSet := newTestIndicatorSet()
|
||||||
|
|
||||||
rsi1m := indicatorSet.RSI(types.IntervalWindow{Interval: types.Interval1m, Window: 7})
|
rsi1m := indicatorSet.RSI(types.IntervalWindow{Interval: types.Interval1m, Window: 7})
|
||||||
|
@ -46,3 +46,13 @@ func TestIndicatorSet_rsi(t *testing.T) {
|
||||||
rsiLast := rsi1m.Last(0)
|
rsiLast := rsi1m.Last(0)
|
||||||
assert.InDelta(t, 80, rsiLast, 0.0000001)
|
assert.InDelta(t, 80, rsiLast, 0.0000001)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIndicatorSet_EWMA(t *testing.T) {
|
||||||
|
indicatorSet := newTestIndicatorSet()
|
||||||
|
|
||||||
|
ema1m := indicatorSet.EWMA(types.IntervalWindow{Interval: types.Interval1m, Window: 7})
|
||||||
|
assert.NotNil(t, ema1m)
|
||||||
|
|
||||||
|
emaLast := ema1m.Last(0)
|
||||||
|
assert.InDelta(t, 19424.224853515625, emaLast, 0.0000001)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user