diff --git a/pkg/strategy/grid2/strategy.go b/pkg/strategy/grid2/strategy.go index 6befe6b0d..67f8e5fda 100644 --- a/pkg/strategy/grid2/strategy.go +++ b/pkg/strategy/grid2/strategy.go @@ -793,6 +793,7 @@ func (s *Strategy) calculateBaseQuoteInvestmentQuantity(quoteInvestment, baseInv if baseQuantity.Compare(minBaseQuantity) <= 0 { numberOfSellOrders = int(math.Floor(baseInvestment.Div(minBaseQuantity).Float64())) + baseQuantity = s.Market.RoundUpQuantityByPrecision(minBaseQuantity) } s.logger.Infof("grid base investment sell orders: %d", numberOfSellOrders) diff --git a/pkg/types/market.go b/pkg/types/market.go index 6b7199798..d9660c970 100644 --- a/pkg/types/market.go +++ b/pkg/types/market.go @@ -76,6 +76,11 @@ func (m Market) RoundDownQuantityByPrecision(quantity fixedpoint.Value) fixedpoi return quantity.Round(m.VolumePrecision, fixedpoint.Down) } +// RoundUpQuantityByPrecision uses the volume precision to round up the quantity +func (m Market) RoundUpQuantityByPrecision(quantity fixedpoint.Value) fixedpoint.Value { + return quantity.Round(m.VolumePrecision, fixedpoint.Up) +} + func (m Market) TruncatePrice(price fixedpoint.Value) fixedpoint.Value { return fixedpoint.MustNewFromString(m.FormatPrice(price)) }