mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge pull request #1571 from c9s/narumi/rebalance/fix-cannot-lock-fund
FIX: [rebalance] fix cannot lock fund
This commit is contained in:
commit
4337662852
|
@ -253,14 +253,14 @@ func (s *Strategy) generateOrder(ctx context.Context) (*types.SubmitOrder, error
|
|||
return nil, err
|
||||
}
|
||||
|
||||
price := s.PriceType.Map(ticker, side)
|
||||
|
||||
if side == types.SideTypeBuy {
|
||||
quantity = fixedpoint.Min(quantity, balances[s.QuoteCurrency].Available.Div(price))
|
||||
quantity = fixedpoint.Min(quantity, balances[s.QuoteCurrency].Available.Div(ticker.Sell))
|
||||
} else if side == types.SideTypeSell {
|
||||
quantity = fixedpoint.Min(quantity, balances[market.BaseCurrency].Available)
|
||||
}
|
||||
|
||||
price := s.PriceType.Map(ticker, side)
|
||||
|
||||
if s.MaxAmount.Float64() > 0 {
|
||||
quantity = bbgo.AdjustQuantityByMaxAmount(quantity, price, s.MaxAmount)
|
||||
log.Infof("adjusted quantity %s (%s %s @ %s) by max amount %s",
|
||||
|
|
Loading…
Reference in New Issue
Block a user