Skip to content

Commit bc23055

Browse files
committed
FEATURE: emit grid error when failed to recover or open grid
1 parent 6ea49f9 commit bc23055

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/strategy/grid2/strategy.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -2136,13 +2136,16 @@ func (s *Strategy) startProcess(ctx context.Context, session *bbgo.ExchangeSessi
21362136
// do recover only when triggerPrice is not set and not in the back-test mode
21372137
s.logger.Infof("recoverWhenStart is set, trying to recover grid orders...")
21382138
if err := s.recoverGrid(ctx, session); err != nil {
2139-
s.logger.WithError(err).Errorf("recover error")
2139+
// if recover fail, return and do not open grid
2140+
s.EmitGridError(errors.Wrapf(err, "failed to start process, recover error"))
2141+
return
21402142
}
21412143
}
21422144

21432145
// avoid using goroutine here for back-test
21442146
if err := s.openGrid(ctx, session); err != nil {
2145-
s.logger.WithError(err).Errorf("failed to setup grid orders")
2147+
s.EmitGridError(errors.Wrapf(err, "failed to start process, setup grid orders error"))
2148+
return
21462149
}
21472150
}
21482151

0 commit comments

Comments
 (0)