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

Method handle_ohlcv_un_subscription

python/ccxt/pro/bitget.py:2617–2652  ·  view source on GitHub ↗
(self, client: Client, message)

Source from the content-addressed store, hash-verified

2615 client.resolve(True, messageHash)
2616
2617 def handle_ohlcv_un_subscription(self, client: Client, message):
2618 #
2619 # {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"candle1m","instId":"BTCUSDT"}}
2620 #
2621 # UTA
2622 #
2623 # {"event":"unsubscribe","arg":{"instType":"spot","topic":"kline","symbol":"BTCUSDT","interval":"1m"}}
2624 #
2625 arg = self.safe_dict(message, 'arg', {})
2626 instType = self.safe_string_lower(arg, 'instType')
2627 type = 'spot' if (instType == 'spot') else 'contract'
2628 instId = self.safe_string_2(arg, 'instId', 'symbol')
2629 channel = self.safe_string_2(arg, 'channel', 'topic')
2630 interval = self.safe_string(arg, 'interval')
2631 isUta = None
2632 if interval is None:
2633 isUta = False
2634 interval = channel.replace('candle', '')
2635 else:
2636 isUta = True
2637 timeframes = self.safe_value(self.options, 'timeframes')
2638 timeframe = self.find_timeframe(interval, timeframes)
2639 market = self.safe_market(instId, None, None, type)
2640 symbol = market['symbol']
2641 messageHash = None
2642 subMessageHash = None
2643 if isUta:
2644 messageHash = 'unsubscribe:kline:' + symbol
2645 subMessageHash = 'kline:' + symbol
2646 else:
2647 messageHash = 'unsubscribe:candles:' + timeframe + ':' + symbol
2648 subMessageHash = 'candles:' + timeframe + ':' + symbol
2649 if symbol in self.ohlcvs:
2650 if timeframe in self.ohlcvs[symbol]:
2651 del self.ohlcvs[symbol][timeframe]
2652 self.clean_unsubscription(client, subMessageHash, messageHash)
2653
2654 def handle_un_subscription_status(self, client: Client, message):
2655 #

Callers 1

Calls 9

safe_dictMethod · 0.80
safe_string_lowerMethod · 0.80
safe_string_2Method · 0.80
safe_stringMethod · 0.80
replaceMethod · 0.80
safe_valueMethod · 0.80
clean_unsubscriptionMethod · 0.80
find_timeframeMethod · 0.45
safe_marketMethod · 0.45

Tested by

no test coverage detected