mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
18 lines
343 B
Go
18 lines
343 B
Go
|
package retry
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/c9s/bbgo/pkg/types"
|
||
|
)
|
||
|
|
||
|
func QueryTickerUntilSuccessful(ctx context.Context, ex types.Exchange, symbol string) (ticker *types.Ticker, err error) {
|
||
|
var op = func() (err2 error) {
|
||
|
ticker, err2 = ex.QueryTicker(ctx, symbol)
|
||
|
return err2
|
||
|
}
|
||
|
|
||
|
err = GeneralBackoff(ctx, op)
|
||
|
return ticker, err
|
||
|
}
|