Skip to content

Commit

Permalink
fix xalign max amount
Browse files Browse the repository at this point in the history
  • Loading branch information
narumiruna committed Mar 27, 2024
1 parent 5cd68d3 commit c7bba2c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/strategy/xalign/strategy.go
Expand Up @@ -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 {
Expand Down

0 comments on commit c7bba2c

Please sign in to comment.