bbgo: fix quantity adjustment

This commit is contained in:
c9s 2022-11-27 00:25:29 +08:00
parent 50d5449b9a
commit 4b0db6b3af
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -271,7 +271,7 @@ func (e *GeneralOrderExecutor) reduceQuantityAndSubmitOrder(ctx context.Context,
var err error
for i := 0; i < submitOrderRetryLimit; i++ {
q := submitOrder.Quantity.Mul(fixedpoint.One.Sub(quantityReduceDelta))
if !e.session.Futures {
if !e.session.Futures && !e.session.Margin {
if submitOrder.Side == types.SideTypeSell {
if baseBalance, ok := e.session.GetAccount().Balance(e.position.Market.BaseCurrency); ok {
q = fixedpoint.Min(q, baseBalance.Available)