grid2: backoff retry open orders api

This commit is contained in:
c9s 2023-03-03 18:55:15 +08:00
parent fa395b0d0a
commit 3f560b2230
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -878,9 +878,14 @@ func (s *Strategy) cancelAll(ctx context.Context) error {
for {
s.logger.Infof("checking %s open orders...", s.Symbol)
openOrders, err := session.Exchange.QueryOpenOrders(ctx, s.Symbol)
if err != nil {
var openOrders []types.Order
if err := backoff.Retry(func() error {
var err error
openOrders, err = session.Exchange.QueryOpenOrders(ctx, s.Symbol)
return err
}, backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 101)); err != nil {
s.logger.WithError(err).Errorf("CancelOrdersByGroupID api call error")
werr = multierr.Append(werr, err)
}
if len(openOrders) == 0 {