grid2: truncate max base quantity

This commit is contained in:
c9s 2023-05-18 18:23:58 +08:00
parent 6fe4f7ca90
commit 11046bd1eb
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -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())