grid2: fix fee reduction by rounding

This commit is contained in:
c9s 2023-02-24 12:24:43 +08:00
parent 2a47d390f0
commit 37535e9f3e
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

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