From 37535e9f3e71fb496a54c6df15d29d2edfbf006a Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 24 Feb 2023 12:24:43 +0800 Subject: [PATCH] grid2: fix fee reduction by rounding --- pkg/strategy/grid2/strategy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/grid2/strategy.go b/pkg/strategy/grid2/strategy.go index 7fc3c3754..5fb48ffeb 100644 --- a/pkg/strategy/grid2/strategy.go +++ b/pkg/strategy/grid2/strategy.go @@ -373,9 +373,11 @@ func (s *Strategy) processFilledOrder(o types.Order) { // if we don't reduce the sell quantity, than we might fail to place the sell order if o.Side == types.SideTypeBuy { baseSellQuantityReduction = s.aggregateOrderBaseFee(o) - s.logger.Infof("GRID BUY ORDER BASE FEE: %s %s", baseSellQuantityReduction.String(), s.Market.BaseCurrency) + baseSellQuantityReduction = baseSellQuantityReduction.Round(s.Market.VolumePrecision, fixedpoint.HalfUp) + s.logger.Infof("GRID BUY ORDER BASE FEE (Rounding): %s %s", baseSellQuantityReduction.String(), s.Market.BaseCurrency) + newQuantity = newQuantity.Sub(baseSellQuantityReduction) }