mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Fix test case
This commit is contained in:
parent
ca0061856d
commit
f1d88188e8
|
@ -1,6 +1,7 @@
|
|||
package indicator
|
||||
|
||||
import (
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
|
@ -36,7 +37,8 @@ func Test_calculateMACD(t *testing.T) {
|
|||
macd := MACD{IntervalWindow: iw, ShortPeriod: 12, LongPeriod: 26}
|
||||
priceF := KLineClosePriceMapper
|
||||
got := macd.calculateMACD(tt.kLines, priceF)
|
||||
if got != tt.want {
|
||||
diff := math.Trunc((got-tt.want)*100) / 100
|
||||
if diff != 0 {
|
||||
t.Errorf("calculateMACD() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package indicator
|
||||
|
||||
import (
|
||||
"math"
|
||||
"testing"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
|
@ -54,7 +55,8 @@ func Test_calculateVWAP(t *testing.T) {
|
|||
vwap := VWAP{IntervalWindow: types.IntervalWindow{Window: tt.window}}
|
||||
priceF := KLineTypicalPriceMapper
|
||||
got := vwap.calculateVWAP(tt.kLines, priceF)
|
||||
if got != tt.want {
|
||||
diff := math.Trunc((got-tt.want)*100) / 100
|
||||
if diff != 0 {
|
||||
t.Errorf("calculateVWAP() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user