diff --git a/pkg/strategy/xalign/strategy.go b/pkg/strategy/xalign/strategy.go index 9faa96a8b1..010ba4e39f 100644 --- a/pkg/strategy/xalign/strategy.go +++ b/pkg/strategy/xalign/strategy.go @@ -231,9 +231,10 @@ func (s *Strategy) selectSessionForCurrency( } maxAmount, ok := s.MaxAmounts[market.QuoteCurrency] - if ok { - requiredQuoteAmount = bbgo.AdjustQuantityByMaxAmount(requiredQuoteAmount, price, maxAmount) - log.Infof("adjusted quantity %f %s by max amount %f %s", requiredQuoteAmount.Float64(), market.BaseCurrency, maxAmount.Float64(), market.QuoteCurrency) + if ok && requiredQuoteAmount.Compare(maxAmount) > 0 { + log.Infof("adjusted required quote ammount %f %s by max amount %f %s", requiredQuoteAmount.Float64(), market.QuoteCurrency, maxAmount.Float64(), market.QuoteCurrency) + + requiredQuoteAmount = maxAmount } if quantity, ok := market.GreaterThanMinimalOrderQuantity(side, price, requiredQuoteAmount); ok {