From bbb1b8a9fa8fc248bf8ade3ded6c902248ea62bd Mon Sep 17 00:00:00 2001 From: narumi Date: Thu, 20 Jun 2024 17:39:20 +0800 Subject: [PATCH] fix position quantity --- pkg/strategy/atrpin/strategy.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/strategy/atrpin/strategy.go b/pkg/strategy/atrpin/strategy.go index 8dee5282f..9f02e3cd1 100644 --- a/pkg/strategy/atrpin/strategy.go +++ b/pkg/strategy/atrpin/strategy.go @@ -160,7 +160,8 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se takerPrice = ticker.Sell } - if !s.Market.IsDustQuantity(base, takerPrice) { + positionQuantity := base.Abs() + if !s.Market.IsDustQuantity(positionQuantity, takerPrice) { s.logger.Infof("%s position is not dust", s.Symbol) orderForms = append(orderForms, types.SubmitOrder{ @@ -168,7 +169,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se Type: types.OrderTypeLimit, Side: side, Price: takerPrice, - Quantity: base.Abs(), + Quantity: positionQuantity, Market: s.Market, TimeInForce: types.TimeInForceGTC, Tag: "takeProfit",