Skip to content

Commit

Permalink
change local position name
Browse files Browse the repository at this point in the history
  • Loading branch information
kbearXD committed Apr 15, 2024
1 parent 70a1058 commit 4d92cf1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/strategy/dca2/take_profit.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ func (s *Strategy) placeTakeProfitOrders(ctx context.Context) error {
return errors.Wrap(err, "failed to place the take-profit order when collecting round trades")
}

position := types.NewPositionFromMarket(s.Market)
roundPosition := types.NewPositionFromMarket(s.Market)

for _, trade := range trades {
if trade.FeeProcessing {
return fmt.Errorf("failed to place the take-profit order because there is a trade's fee not ready")
}

position.AddTrade(trade)
roundPosition.AddTrade(trade)
}

s.logger.Infof("placeTakeProfitOrders: %s", position.String())
s.logger.Infof("position of this round before place the take-profit order: %s", roundPosition.String())

order := generateTakeProfitOrder(s.Market, s.TakeProfitRatio, position, s.OrderGroupID)
order := generateTakeProfitOrder(s.Market, s.TakeProfitRatio, roundPosition, s.OrderGroupID)
createdOrders, err := s.OrderExecutor.SubmitOrders(ctx, order)
if err != nil {
return err
Expand Down

0 comments on commit 4d92cf1

Please sign in to comment.