@ignore subscribes to a websocket channel https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-overview#subscribe :param str name: the name of the channel :param boolean isPrivate: whether the channel is private or not :param str[] [symbols]: unified
(self, name: str, isPrivate: bool, symbols: Strings = None, params={})
| 153 | return res |
| 154 | |
| 155 | async def subscribe_multiple(self, name: str, isPrivate: bool, symbols: Strings = None, params={}): |
| 156 | """ |
| 157 | @ignore |
| 158 | subscribes to a websocket channel |
| 159 | |
| 160 | https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-overview#subscribe |
| 161 | |
| 162 | :param str name: the name of the channel |
| 163 | :param boolean isPrivate: whether the channel is private or not |
| 164 | :param str[] [symbols]: unified market symbol |
| 165 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 166 | :returns dict: subscription to a websocket channel |
| 167 | """ |
| 168 | await self.load_markets() |
| 169 | productIds = [] |
| 170 | messageHashes = [] |
| 171 | symbols = self.market_symbols(symbols, None, False) |
| 172 | for i in range(0, len(symbols)): |
| 173 | symbol = symbols[i] |
| 174 | market = self.market(symbol) |
| 175 | marketId = market['id'] |
| 176 | productIds.append(marketId) |
| 177 | messageHashes.append(name + '::' + symbol) |
| 178 | url = self.urls['api']['ws'] |
| 179 | subscribe = { |
| 180 | 'type': 'subscribe', |
| 181 | 'product_ids': productIds, |
| 182 | 'channel': name, |
| 183 | } |
| 184 | if isPrivate: |
| 185 | subscribe = self.extend(subscribe, self.create_ws_auth(name, productIds)) |
| 186 | return await self.watch_multiple(url, messageHashes, subscribe, messageHashes) |
| 187 | |
| 188 | async def un_subscribe_multiple(self, topic: str, name: str, isPrivate: bool, symbols: Strings = None, params={}): |
| 189 | """ |
no test coverage detected