backtest: fix tests for fee

This commit is contained in:
c9s 2022-09-02 14:31:04 +08:00
parent db622fbb55
commit 3a225fe7c7
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -249,7 +249,8 @@ func TestSimplePriceMatching_LimitBuyTakerOrder(t *testing.T) {
assert.Equal(t, fixedpoint.NewFromFloat(100.0).Add(createdOrder.Quantity).String(), btc.Available.String()) assert.Equal(t, fixedpoint.NewFromFloat(100.0).Add(createdOrder.Quantity).String(), btc.Available.String())
usedQuoteAmount := createdOrder.AveragePrice.Mul(createdOrder.Quantity) usedQuoteAmount := createdOrder.AveragePrice.Mul(createdOrder.Quantity)
assert.Equal(t, usdt.Available.String(), fixedpoint.NewFromFloat(1000000.0).Sub(usedQuoteAmount).String()) assert.Equal(t, "USDT", trade.FeeCurrency)
assert.Equal(t, usdt.Available.String(), fixedpoint.NewFromFloat(1000000.0).Sub(usedQuoteAmount).Sub(trade.Fee).String())
} }
func TestSimplePriceMatching_StopLimitOrderBuy(t *testing.T) { func TestSimplePriceMatching_StopLimitOrderBuy(t *testing.T) {
@ -497,7 +498,6 @@ func TestSimplePriceMatching_PlaceLimitOrder(t *testing.T) {
assert.Len(t, trades, 4) assert.Len(t, trades, 4)
} }
func TestSimplePriceMatching_LimitTakerOrder(t *testing.T) { func TestSimplePriceMatching_LimitTakerOrder(t *testing.T) {
account := getTestAccount() account := getTestAccount()
market := getTestMarket() market := getTestMarket()