mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
Merge pull request #1608 from c9s/narumi/xalign/fix-max-amount
FIX: [xalign] fix buy side max amount
This commit is contained in:
commit
3881039bfb
|
@ -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 {
|
||||
|
@ -246,6 +247,8 @@ func (s *Strategy) selectSessionForCurrency(
|
|||
Market: market,
|
||||
TimeInForce: types.TimeInForceGTC,
|
||||
}
|
||||
} else {
|
||||
log.Warnf("The amount %f is not greater than the minimal order quantity for %s", requiredQuoteAmount.Float64(), market.Symbol)
|
||||
}
|
||||
|
||||
case types.SideTypeSell:
|
||||
|
@ -288,6 +291,8 @@ func (s *Strategy) selectSessionForCurrency(
|
|||
Market: market,
|
||||
TimeInForce: types.TimeInForceGTC,
|
||||
}
|
||||
} else {
|
||||
log.Warnf("The amount %f is not greater than the minimal order quantity for %s", q.Float64(), market.Symbol)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user