def load_exchange_symbol_mapping(exchange: str, key_id=None): if exchange in {BITMEX, DERIBIT, KRAKEN_FUTURES}: return mapping = gen_symbols(exchange, key_id=key_id) for std, exch in mapping.items(): _exchange_to_std[exch] = std _std_trading_symbols[std][exchange] = exch
def __init__(self, symbols=None, channels=None, subscription=None, **kwargs): # TRADES and FUNDING use the same subscription channel, only the first symbol character distinguishes them # => Warn when symbols will be subscribed to the wrong channel symbols_exch_to_std = gen_symbols(BITFINEX) for chan in set(channels or subscription): for pair in set(subscription[chan] if subscription else symbols or []): exch_sym = symbols_exch_to_std.get(pair) if (exch_sym[0] == 'f') == (chan != FUNDING): LOG.warning('%s: No %s for symbol %s => Cryptofeed will subscribe to the wrong channel', self.id, chan, pair) super().__init__('wss://api.bitfinex.com/ws/2', symbols=symbols, channels=channels, subscription=subscription, **kwargs) self.__reset()
def get_exchange_info(exchange: str, key_id=None): mapping = gen_symbols(exchange, key_id=key_id) info = dict(_exchange_info.get(exchange, {})) return mapping, info
def load_exchange_symbol_mapping(exchange: str, key_id=None): mapping = gen_symbols(exchange, key_id=key_id) for std, exch in mapping.items(): _exchange_to_std[exch] = std _std_trading_symbols[std][exchange] = exch
def get_exchange_info(exchange: str, key_id=None, force_update=False): mapping = gen_symbols(exchange, key_id=key_id, force_update=force_update) info = dict(_exchange_info.get(exchange, {})) return mapping, info