pivotshort: fix quantity check

This commit is contained in:
c9s 2022-07-19 11:25:27 +08:00
parent 9302474d51
commit f72cf9bfff
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -281,9 +281,11 @@ func useQuantityOrBaseBalance(session *bbgo.ExchangeSession, market types.Market
if hasBalance {
if quantity.IsZero() {
log.Warnf("sell quantity is not set, submitting sell with all base balance: %s", balance.Available.String())
quantity = balance.Available
if !balance.Available.IsZero() {
return balance.Available, nil
}
} else {
quantity = fixedpoint.Min(quantity, balance.Available)
return fixedpoint.Min(quantity, balance.Available), nil
}
}