From 4b0db6b3affe079845c191232e67445b0ff45aa4 Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 27 Nov 2022 00:25:29 +0800 Subject: [PATCH] bbgo: fix quantity adjustment --- pkg/bbgo/order_executor_general.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/bbgo/order_executor_general.go b/pkg/bbgo/order_executor_general.go index 86243708f..40b63c9ee 100644 --- a/pkg/bbgo/order_executor_general.go +++ b/pkg/bbgo/order_executor_general.go @@ -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)