Skip to content

Commit

Permalink
FEATURE: no use MAX(quantity, minQuantity) to avoid sufficient quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
kbearXD committed Oct 21, 2024
1 parent 5a1249e commit 2e1dbbb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/strategy/grid2/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ func (s *Strategy) processFilledOrder(o types.Order) {
newQuantity = newQuantity.Round(s.Market.VolumePrecision, fixedpoint.Down)
s.logger.Infof("round down %s %s order base quantity %s to %s by base precision %d", s.Symbol, newSide, origQuantity.String(), newQuantity.String(), s.Market.VolumePrecision)

newQuantity = fixedpoint.Max(newQuantity, s.Market.MinQuantity)
} else if s.QuantityOrAmount.Quantity.Sign() > 0 {
newQuantity = s.QuantityOrAmount.Quantity
}
Expand All @@ -527,7 +526,7 @@ func (s *Strategy) processFilledOrder(o types.Order) {

// if EarnBase is enabled, we should sell less to get the same quote amount back
if s.EarnBase {
newQuantity = fixedpoint.Max(orderExecutedQuoteAmount.Div(newPrice).Sub(fee), s.Market.MinQuantity)
newQuantity = orderExecutedQuoteAmount.Div(newPrice).Sub(fee)
}

// always round down the base quantity for placing sell order to avoid the base currency fund locking issue
Expand Down

0 comments on commit 2e1dbbb

Please sign in to comment.