mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-02 15:10:46 +00:00
exchanges: Add UpdateTickers method and reserve UpdateTicker for single ticker symbol update requests (if supported) (#764)
* exchanges: add an UpdateTickers method to the main exchange interface This method will fetch all currency pair tickers of a given asset type and update them internally, does nothing for now. * exchanges: refactor UpdateTicker on all exchanges Keep the exact previous behaviour but implement the UpdateTickers method and refactor UpdateTicker by using it where applicable. * sync_manager: update all tickers when batching is enabled * binance: UpdateTicker to fetch single ticker symbol * ftx: UpdateTicker to fetch single ticker symbol
This commit is contained in:
@@ -275,9 +275,14 @@ func (b *Bittrex) UpdateTradablePairs(forceUpdate bool) error {
|
||||
return b.UpdatePairs(p, asset.Spot, false, forceUpdate)
|
||||
}
|
||||
|
||||
// UpdateTickers updates the ticker for all currency pairs of a given asset type
|
||||
func (b *Bittrex) UpdateTickers(a asset.Item) error {
|
||||
return common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
func (b *Bittrex) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error) {
|
||||
formattedPair, err := b.FormatExchangeCurrency(p, assetType)
|
||||
func (b *Bittrex) UpdateTicker(p currency.Pair, a asset.Item) (*ticker.Price, error) {
|
||||
formattedPair, err := b.FormatExchangeCurrency(p, a)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -297,14 +302,14 @@ func (b *Bittrex) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.P
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tickerPrice := b.constructTicker(t, &s, pair, assetType)
|
||||
tickerPrice := b.constructTicker(t, &s, pair, a)
|
||||
|
||||
err = ticker.ProcessTicker(tickerPrice)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ticker.GetTicker(b.Name, p, assetType)
|
||||
return ticker.GetTicker(b.Name, p, a)
|
||||
}
|
||||
|
||||
// constructTicker constructs a ticker price from the underlying data
|
||||
|
||||
Reference in New Issue
Block a user