55 lines
1.6 KiB
Python
Raw Normal View History

"""
Exchange registry for supported exchanges.
This module contains the registry of supported exchanges and their capabilities,
separated to avoid circular import issues.
"""
from utils.logger import get_logger
from .exceptions import ExchangeNotSupportedError
# Initialize logger
logger = get_logger('exchanges')
# Exchange registry for factory pattern
EXCHANGE_REGISTRY = {
'okx': {
'collector': 'data.exchanges.okx.collector.OKXCollector',
'websocket': 'data.exchanges.okx.websocket.OKXWebSocketClient',
'name': 'OKX',
'supported_pairs': ['BTC-USDT', 'ETH-USDT', 'SOL-USDT', 'DOGE-USDT', 'TON-USDT'],
'supported_data_types': ['trade', 'orderbook', 'ticker', 'candles']
}
}
def get_supported_exchanges() -> list:
"""Get list of supported exchange names."""
exchanges = list(EXCHANGE_REGISTRY.keys())
logger.debug(f"Available exchanges: {exchanges}")
return exchanges
def get_exchange_info(exchange_name: str) -> dict:
"""
Get information about a specific exchange.
Args:
exchange_name: Name of the exchange
Returns:
Dictionary containing exchange information
Raises:
ExchangeNotSupportedError: If exchange is not found in registry
"""
exchange_name = exchange_name.lower()
exchange_info = EXCHANGE_REGISTRY.get(exchange_name)
if not exchange_info:
error_msg = f"Exchange '{exchange_name}' not found in registry"
logger.error(error_msg)
raise ExchangeNotSupportedError(error_msg)
logger.debug(f"Retrieved info for exchange: {exchange_name}")
return exchange_info