From bfbf415c151396ba8722e3009d3457817afa8bd5 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 29 Jan 2024 20:23:24 +0800 Subject: [PATCH] tri: fix tests --- pkg/strategy/tri/strategy_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/strategy/tri/strategy_test.go b/pkg/strategy/tri/strategy_test.go index b15d6638f1..96bb27809c 100644 --- a/pkg/strategy/tri/strategy_test.go +++ b/pkg/strategy/tri/strategy_test.go @@ -30,11 +30,12 @@ func loadMarket(symbol string) types.Market { } func newArbMarket(symbol, base, quote string, askPrice, askVolume, bidPrice, bidVolume float64) *ArbMarket { + market := loadMarket(symbol) return &ArbMarket{ Symbol: symbol, BaseCurrency: base, QuoteCurrency: quote, - market: loadMarket(symbol), + market: market, book: nil, bestBid: types.PriceVolume{ Price: fixedpoint.NewFromFloat(bidPrice), @@ -44,9 +45,12 @@ func newArbMarket(symbol, base, quote string, askPrice, askVolume, bidPrice, bid Price: fixedpoint.NewFromFloat(askPrice), Volume: fixedpoint.NewFromFloat(askVolume), }, - buyRate: 1.0 / askPrice, - sellRate: bidPrice, + buyRate: 1.0 / askPrice, + sellRate: bidPrice, + truncateBaseQuantity: createBaseQuantityTruncator(market), + truncateQuoteQuantity: createPricePrecisionBasedQuoteQuantityTruncator(market), } + } func TestPath_calculateBackwardRatio(t *testing.T) {