-
Notifications
You must be signed in to change notification settings - Fork 904
exchanges: Update UpdateTickers method so that available pairs are used instead of enabled pairs.
#2159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
exchanges: Update UpdateTickers method so that available pairs are used instead of enabled pairs.
#2159
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -578,35 +578,7 @@ func (e *Exchange) UpdateTickers(ctx context.Context, a asset.Item) error { | |||||||||||
| } | ||||||||||||
| return errs | ||||||||||||
| case asset.Options: | ||||||||||||
| pairs, err := e.GetEnabledPairs(a) | ||||||||||||
| if err != nil { | ||||||||||||
| return err | ||||||||||||
| } | ||||||||||||
| for i := range pairs { | ||||||||||||
| underlying, err := e.GetUnderlyingFromCurrencyPair(pairs[i]) | ||||||||||||
| if err != nil { | ||||||||||||
| return err | ||||||||||||
| } | ||||||||||||
| tickers, err := e.GetOptionsTickers(ctx, underlying.String()) | ||||||||||||
| if err != nil { | ||||||||||||
| return err | ||||||||||||
| } | ||||||||||||
| for x := range tickers { | ||||||||||||
| err = ticker.ProcessTicker(&ticker.Price{ | ||||||||||||
| Last: tickers[x].LastPrice.Float64(), | ||||||||||||
| Ask: tickers[x].Ask1Price.Float64(), | ||||||||||||
| AskSize: tickers[x].Ask1Size, | ||||||||||||
| Bid: tickers[x].Bid1Price.Float64(), | ||||||||||||
| BidSize: tickers[x].Bid1Size, | ||||||||||||
| Pair: tickers[x].Name, | ||||||||||||
| ExchangeName: e.Name, | ||||||||||||
| AssetType: a, | ||||||||||||
| }) | ||||||||||||
| if err != nil { | ||||||||||||
| return err | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| return common.ErrFunctionNotSupported | ||||||||||||
|
||||||||||||
| return common.ErrFunctionNotSupported | |
| // Options tickers are currently treated as a supported no-op. | |
| // This ensures UpdateTickers does not return an error for all | |
| // assets returned by GetAssetTypes(false), including Options. | |
| return nil |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -218,20 +218,14 @@ func (e *Exchange) UpdateTickers(ctx context.Context, a asset.Item) error { | |||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| for x := range tick { | ||||||||||||||||||||||||
| var pair currency.Pair | ||||||||||||||||||||||||
| var enabled bool | ||||||||||||||||||||||||
| pair, enabled, err = e.MatchSymbolCheckEnabled(tick[x].Symbol, a, false) | ||||||||||||||||||||||||
| pair, err := e.MatchSymbolWithAvailablePairs(tick[x].Symbol, a, false) | ||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||
| if !errors.Is(err, currency.ErrPairNotFound) { | ||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||
| if errors.Is(err, currency.ErrPairNotFound) { | ||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
224
to
229
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When
Suggested change
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if !enabled { | ||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| err = ticker.ProcessTicker(&ticker.Price{ | ||||||||||||||||||||||||
| if err := ticker.ProcessTicker(&ticker.Price{ | ||||||||||||||||||||||||
| Last: tick[x].Last, | ||||||||||||||||||||||||
| High: tick[x].High, | ||||||||||||||||||||||||
| Low: tick[x].Low, | ||||||||||||||||||||||||
|
|
@@ -244,8 +238,7 @@ func (e *Exchange) UpdateTickers(ctx context.Context, a asset.Item) error { | |||||||||||||||||||||||
| LastUpdated: tick[x].Timestamp, | ||||||||||||||||||||||||
| ExchangeName: e.Name, | ||||||||||||||||||||||||
| AssetType: a, | ||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||
| }); err != nil { | ||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
e.MatchSymbolCheckEnabledreturns acurrency.ErrPairNotFounderror, the loop shouldcontinueto the next ticker. Currently, it proceeds with a zero-valuepair, which will causeticker.ProcessTickerto fail and halt all ticker updates for the exchange.