Merge pull request #1662 from c9s/narumi/fix-atrpin-qty

FIX: [atrpin] fix position quantity
This commit is contained in:
なるみ 2024-06-20 10:51:42 +01:00 committed by GitHub
commit 9bf635de5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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",