mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
bbgo: fix balance lock issue
This commit is contained in:
parent
ad6f07a40c
commit
7b68e5ee27
|
@ -271,6 +271,11 @@ func (e *GeneralOrderExecutor) ClosePosition(ctx context.Context, percentage fix
|
|||
return nil
|
||||
}
|
||||
|
||||
// check base balance and adjust the close position order
|
||||
if baseBalance, ok := e.session.Account.Balance(e.position.Market.BaseCurrency); ok {
|
||||
submitOrder.Quantity = fixedpoint.Min(submitOrder.Quantity, baseBalance.Available)
|
||||
}
|
||||
|
||||
tagStr := strings.Join(tags, ",")
|
||||
submitOrder.Tag = tagStr
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user