fix position quantity

This commit is contained in:
narumi 2024-06-20 17:39:20 +08:00
parent ee09922865
commit bbb1b8a9fa

View File

@ -160,7 +160,8 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
takerPrice = ticker.Sell 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) s.logger.Infof("%s position is not dust", s.Symbol)
orderForms = append(orderForms, types.SubmitOrder{ orderForms = append(orderForms, types.SubmitOrder{
@ -168,7 +169,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
Type: types.OrderTypeLimit, Type: types.OrderTypeLimit,
Side: side, Side: side,
Price: takerPrice, Price: takerPrice,
Quantity: base.Abs(), Quantity: positionQuantity,
Market: s.Market, Market: s.Market,
TimeInForce: types.TimeInForceGTC, TimeInForce: types.TimeInForceGTC,
Tag: "takeProfit", Tag: "takeProfit",