mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +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]
|
maxAmount, ok := s.MaxAmounts[market.QuoteCurrency]
|
||||||
if ok {
|
if ok && requiredQuoteAmount.Compare(maxAmount) > 0 {
|
||||||
requiredQuoteAmount = bbgo.AdjustQuantityByMaxAmount(requiredQuoteAmount, price, maxAmount)
|
log.Infof("adjusted required quote ammount %f %s by max amount %f %s", requiredQuoteAmount.Float64(), market.QuoteCurrency, maxAmount.Float64(), market.QuoteCurrency)
|
||||||
log.Infof("adjusted quantity %f %s by max amount %f %s", requiredQuoteAmount.Float64(), market.BaseCurrency, maxAmount.Float64(), market.QuoteCurrency)
|
|
||||||
|
requiredQuoteAmount = maxAmount
|
||||||
}
|
}
|
||||||
|
|
||||||
if quantity, ok := market.GreaterThanMinimalOrderQuantity(side, price, requiredQuoteAmount); ok {
|
if quantity, ok := market.GreaterThanMinimalOrderQuantity(side, price, requiredQuoteAmount); ok {
|
||||||
|
@ -246,6 +247,8 @@ func (s *Strategy) selectSessionForCurrency(
|
||||||
Market: market,
|
Market: market,
|
||||||
TimeInForce: types.TimeInForceGTC,
|
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:
|
case types.SideTypeSell:
|
||||||
|
@ -288,6 +291,8 @@ func (s *Strategy) selectSessionForCurrency(
|
||||||
Market: market,
|
Market: market,
|
||||||
TimeInForce: types.TimeInForceGTC,
|
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