Skip to content

Commit c2c650a

Browse files
committed
fix xalign max amount
1 parent 0095eae commit c2c650a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/strategy/xalign/strategy.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,10 @@ func (s *Strategy) selectSessionForCurrency(
231231
}
232232

233233
maxAmount, ok := s.MaxAmounts[market.QuoteCurrency]
234-
if ok {
235-
requiredQuoteAmount = bbgo.AdjustQuantityByMaxAmount(requiredQuoteAmount, price, maxAmount)
236-
log.Infof("adjusted quantity %f %s by max amount %f %s", requiredQuoteAmount.Float64(), market.BaseCurrency, maxAmount.Float64(), market.QuoteCurrency)
234+
if ok && requiredQuoteAmount.Compare(maxAmount) > 0 {
235+
log.Infof("adjusted required quote ammount %f %s by max amount %f %s", requiredQuoteAmount.Float64(), market.QuoteCurrency, maxAmount.Float64(), market.QuoteCurrency)
236+
237+
requiredQuoteAmount = maxAmount
237238
}
238239

239240
if quantity, ok := market.GreaterThanMinimalOrderQuantity(side, price, requiredQuoteAmount); ok {

0 commit comments

Comments
 (0)