MCPcopy Create free account
hub / github.com/ccxt/ccxt / clean_unsubscription

Method clean_unsubscription

python/ccxt/base/exchange.py:8184–8205  ·  view source on GitHub ↗
(self, client, subHash: str, unsubHash: str, subHashIsPrefix=False)

Source from the content-addressed store, hash-verified

8182 raise NotSupported(self.id + ' unWatchBidsAsks() is not supported yet')
8183
8184 def clean_unsubscription(self, client, subHash: str, unsubHash: str, subHashIsPrefix=False):
8185 if unsubHash in client.subscriptions:
8186 del client.subscriptions[unsubHash]
8187 if not subHashIsPrefix:
8188 if subHash in client.subscriptions:
8189 del client.subscriptions[subHash]
8190 if subHash in client.futures:
8191 error = UnsubscribeError(self.id + ' ' + subHash)
8192 client.reject(error, subHash)
8193 else:
8194 clientSubscriptions = list(client.subscriptions.keys())
8195 for i in range(0, len(clientSubscriptions)):
8196 sub = clientSubscriptions[i]
8197 if sub.startswith(subHash):
8198 del client.subscriptions[sub]
8199 clientFutures = list(client.futures.keys())
8200 for i in range(0, len(clientFutures)):
8201 future = clientFutures[i]
8202 if future.startswith(subHash):
8203 error = UnsubscribeError(self.id + ' ' + future)
8204 client.reject(error, future)
8205 client.resolve(True, unsubHash)
8206
8207 def clean_cache(self, subscription: dict):
8208 topic = self.safe_string(subscription, 'topic')

Calls 4

UnsubscribeErrorClass · 0.90
rejectMethod · 0.65
resolveMethod · 0.65
rangeFunction · 0.50

Tested by

no test coverage detected