Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pcriadoperez committed Dec 25, 2022
1 parent 4413a9d commit 7908094
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions js/pro/huobi.js
Expand Up @@ -15,11 +15,11 @@ module.exports = class huobi extends huobiRest {
'ws': true,
'watchOrderBook': true,
'watchOrders': true,
'watchTickers': false, // for now
'watchTickers': false,
'watchTicker': true,
'watchTrades': true,
'watchMyTrades': true,
'watchBalance': true, // for now
'watchBalance': true,
'watchOHLCV': true,
},
'urls': {
Expand Down Expand Up @@ -89,7 +89,9 @@ module.exports = class huobi extends huobiRest {
'ws': {
'gunzip': true,
},
'watchTickerTopic': 'market.{marketId}.detail', // 'market.{marketId}.bbo' or 'market.{marketId}.ticker'
'watchTicker': {
'name': 'market.{marketId}.detail', // 'market.{marketId}.bbo' or 'market.{marketId}.ticker'
},
},
'exceptions': {
'ws': {
Expand Down Expand Up @@ -124,7 +126,11 @@ module.exports = class huobi extends huobiRest {
await this.loadMarkets ();
const market = this.market (symbol);
symbol = market['symbol'];
const topic = this.safeString (this.options, 'watchTickerTopic', 'market.{marketId}.detail');
const options = this.safeValue (this.options, 'watchTicker', {});
const topic = this.safeString (options, 'name', 'market.{marketId}.detail');
if (topic === 'market.{marketId}.ticker' && market['type'] !== 'spot') {
throw new BadRequest (this.id + ' watchTicker() with name market.{marketId}.ticker is only allowed for spot markets, use market.{marketId}.detail instead');
}
const messageHash = this.implodeParams (topic, { 'marketId': market['id'] });
const url = this.getUrlByMarketType (market['type'], market['linear']);
return await this.subscribePublic (url, symbol, messageHash, undefined, params);
Expand Down

0 comments on commit 7908094

Please sign in to comment.