grid2: sub 1 only when num > 0

This commit is contained in:
c9s 2023-05-22 17:26:06 +08:00
parent 6ae5d2f33a
commit f11d869d02
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -778,9 +778,8 @@ func (s *Strategy) calculateBaseQuoteInvestmentQuantity(quoteInvestment, baseInv
}
// avoid placing a sell order above the last price
numberOfSellOrders--
if numberOfSellOrders < 0 {
numberOfSellOrders = 0
if numberOfSellOrders > 0 {
numberOfSellOrders--
}
// if the maxBaseQuantity is less than minQuantity, then we need to reduce the number of the sell orders