Skip to content

Commit

Permalink
fix position quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
narumiruna committed Jun 20, 2024
1 parent ee09922 commit bbb1b8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/strategy/atrpin/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,16 @@ 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{
Symbol: s.Symbol,
Type: types.OrderTypeLimit,
Side: side,
Price: takerPrice,
Quantity: base.Abs(),
Quantity: positionQuantity,
Market: s.Market,
TimeInForce: types.TimeInForceGTC,
Tag: "takeProfit",
Expand Down

0 comments on commit bbb1b8a

Please sign in to comment.