Skip to content

Commit

Permalink
Merge pull request #1887 from c9s/kbearXD/grid2/error-to-warn
Browse files Browse the repository at this point in the history
FIX: set logger and make log from error to warn in retry function
  • Loading branch information
kbearXD authored Jan 20, 2025
2 parents 08ccefd + 621ad04 commit 14a5818
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/bbgo/order_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ batchRetryOrder:
// can allocate permanent error backoff.Permanent(err) to stop backoff
createdOrder, err2 := exchange.SubmitOrder(timeoutCtx, submitOrder)
if err2 != nil {
logger.WithError(err2).Errorf("submit order error: %s", submitOrder.String())
logger.WithError(err2).Warnf("submit order error: %s", submitOrder.String())
}

if err2 == nil && createdOrder != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/strategy/dca2/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
}

s.OrderExecutor = bbgo.NewGeneralOrderExecutor(session, s.Symbol, ID, instanceID, s.Position)
s.OrderExecutor.SetLogger(s.logger)
s.OrderExecutor.SetMaxRetries(5)
s.OrderExecutor.BindEnvironment(s.Environment)
s.OrderExecutor.Bind()
Expand Down
1 change: 1 addition & 0 deletions pkg/strategy/grid2/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
s.historicalTrades.BindStream(session.UserDataStream)

orderExecutor := bbgo.NewGeneralOrderExecutor(session, s.Symbol, ID, instanceID, s.Position)
orderExecutor.SetLogger(s.logger)
orderExecutor.BindEnvironment(s.Environment)
orderExecutor.Bind()
orderExecutor.TradeCollector().OnTrade(func(trade types.Trade, _, _ fixedpoint.Value) {
Expand Down

0 comments on commit 14a5818

Please sign in to comment.