From 86a99b59020a18a7cee97903a785e6ef243837df Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 18 May 2023 18:23:58 +0800 Subject: [PATCH] grid2: truncate max base quantity --- pkg/strategy/grid2/strategy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/strategy/grid2/strategy.go b/pkg/strategy/grid2/strategy.go index 6192c63dd..b2ea027cb 100644 --- a/pkg/strategy/grid2/strategy.go +++ b/pkg/strategy/grid2/strategy.go @@ -785,7 +785,11 @@ func (s *Strategy) calculateBaseQuoteInvestmentQuantity(quoteInvestment, baseInv for maxBaseQuantity.Compare(s.Market.MinQuantity) <= 0 || maxBaseQuantity.Compare(minBaseQuantity) <= 0 { maxNumberOfSellOrders-- maxBaseQuantity = baseInvestment.Div(fixedpoint.NewFromInt(int64(maxNumberOfSellOrders))) + + // maxBaseQuantity = s.Market.RoundDownQuantityByPrecision(maxBaseQuantity) + maxBaseQuantity = s.Market.TruncateQuantity(maxBaseQuantity) } + s.logger.Infof("grid base investment sell orders: %d", maxNumberOfSellOrders) if maxNumberOfSellOrders > 0 { s.logger.Infof("grid base investment quantity: %f (base investment) / %d (number of sell orders) = %f (base quantity per order)", baseInvestment.Float64(), maxNumberOfSellOrders, maxBaseQuantity.Float64())