def symbol_std_to_exchange(symbol: str, exchange: str): if symbol in _std_trading_symbols: try: return _std_trading_symbols[symbol][exchange] except KeyError: raise UnsupportedSymbol(f'{symbol} is not supported on {exchange}') else: raise UnsupportedSymbol(f'{symbol} is not supported on {exchange}')
def symbol_std_to_exchange(symbol: str, exchange: str): if symbol in _std_trading_symbols: try: return _std_trading_symbols[symbol][exchange] except KeyError: raise UnsupportedSymbol(f'{symbol} is not supported on {exchange}') else: # Bitfinex supports funding symbols that are single currencies, prefixed with f if exchange == BITFINEX and '-' not in symbol: return f"f{symbol}" raise UnsupportedSymbol(f'{symbol} is not supported on {exchange}')
def symbol_std_to_exchange(symbol: str, exchange: str): # bitmex does its own validation of trading symbols dynamically if exchange in {BITMEX, DERIBIT, KRAKEN_FUTURES}: return symbol if symbol in _std_trading_symbols: try: return _std_trading_symbols[symbol][exchange] except KeyError: raise UnsupportedSymbol(f'{symbol} is not supported on {exchange}') else: # Bitfinex supports funding symbols that are single currencies, prefixed with f if exchange == BITFINEX and '-' not in symbol: return f"f{symbol}" raise UnsupportedSymbol(f'{symbol} is not supported on {exchange}')
def std_symbol_to_exchange_symbol(self, symbol: Union[str, Symbol]) -> str: if isinstance(symbol, Symbol): symbol = symbol.normalized try: return self.normalized_symbol_mapping[symbol] except KeyError: raise UnsupportedSymbol(f'{symbol} is not supported on {self.id}')
def exchange_symbol_to_std_symbol(self, symbol: str) -> str: try: return self.exchange_symbol_mapping[symbol] except KeyError: if self.ignore_invalid_instruments: LOG.warning('Invalid symbol %s configured for %s', symbol, self.id) return symbol raise UnsupportedSymbol(f'{symbol} is not supported on {self.id}')
def std_symbol_to_exchange_symbol(self, symbol: Union[str, Symbol]) -> str: if isinstance(symbol, Symbol): symbol = symbol.normalized try: return self.normalized_symbol_mapping[symbol] except KeyError: if self.ignore_invalid_instruments: LOG.warning('Invalid symbol %s configured for %s', symbol, self.id) return symbol raise UnsupportedSymbol(f'{symbol} is not supported on {self.id}')
def std_symbol_to_exchange_symbol(self, symbol: str) -> str: try: return self.normalized_symbol_mapping[symbol] except KeyError: raise UnsupportedSymbol(f'{symbol} is not supported on {self.id}')