Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit 3aae9ed

Browse files
authored
fix broken precision value test (#729)
1 parent 10994b1 commit 3aae9ed

1 file changed

Lines changed: 13 additions & 20 deletions

File tree

plugins/ccxtExchange_test.go

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package plugins
22

33
import (
44
"fmt"
5+
"github.com/stretchr/testify/require"
56
"log"
67
"math"
78
"strconv"
@@ -572,8 +573,8 @@ func TestGetOrderConstraints_Ccxt_Precision(t *testing.T) {
572573
// }, {
573574
exchangeName: "binance",
574575
pair: &model.TradingPair{Base: model.XLM, Quote: model.USDT},
575-
wantPricePrecision: 5,
576-
wantVolPrecision: 1,
576+
wantPricePrecision: 4,
577+
wantVolPrecision: 4,
577578
}, {
578579
exchangeName: "binance",
579580
pair: &model.TradingPair{Base: model.XLM, Quote: model.BTC},
@@ -588,27 +589,19 @@ func TestGetOrderConstraints_Ccxt_Precision(t *testing.T) {
588589
}
589590

590591
for _, kase := range testCases {
592+
593+
epf := getEsParamFactory(kase.exchangeName)
594+
591595
t.Run(kase.exchangeName, func(t *testing.T) {
592-
testCcxtExchange, e := makeCcxtExchange(
593-
kase.exchangeName,
594-
nil,
595-
[]api.ExchangeAPIKey{emptyAPIKey},
596-
[]api.ExchangeParam{emptyParams},
597-
[]api.ExchangeHeader{},
598-
false,
599-
getEsParamFactory(kase.exchangeName),
600-
)
601-
if !assert.NoError(t, e) {
602-
return
603-
}
596+
testCcxtExchange, e := makeCcxtExchange(kase.exchangeName, nil, []api.ExchangeAPIKey{emptyAPIKey},
597+
[]api.ExchangeParam{emptyParams}, []api.ExchangeHeader{}, false, epf)
598+
599+
require.NoError(t, e)
604600

605601
result := testCcxtExchange.GetOrderConstraints(kase.pair)
606-
if !assert.Equal(t, kase.wantPricePrecision, result.PricePrecision) {
607-
return
608-
}
609-
if !assert.Equal(t, kase.wantVolPrecision, result.VolumePrecision) {
610-
return
611-
}
602+
603+
assert.Equal(t, kase.wantPricePrecision, result.PricePrecision)
604+
assert.Equal(t, kase.wantVolPrecision, result.VolumePrecision)
612605
})
613606
}
614607
}

0 commit comments

Comments
 (0)