Vasily.onl 4510181b39 Add OKX data collector implementation and modular exchange architecture
- Introduced the `OKXCollector` and `OKXWebSocketClient` classes for real-time market data collection from the OKX exchange.
- Implemented a factory pattern for creating exchange-specific collectors, enhancing modularity and scalability.
- Added configuration support for the OKX collector in `config/okx_config.json`.
- Updated documentation to reflect the new modular architecture and provide guidance on using the OKX collector.
- Created unit tests for the OKX collector and exchange factory to ensure functionality and reliability.
- Enhanced logging and error handling throughout the new implementation for improved monitoring and debugging.
2025-05-31 20:49:31 +08:00

39 lines
1.2 KiB
Python

"""
Exchange-specific data collectors.
This package contains implementations for different cryptocurrency exchanges,
each organized in its own subfolder with standardized interfaces.
"""
from .okx import OKXCollector, OKXWebSocketClient
from .factory import ExchangeFactory, ExchangeCollectorConfig, create_okx_collector
from .registry import get_supported_exchanges, get_exchange_info
__all__ = [
'OKXCollector',
'OKXWebSocketClient',
'ExchangeFactory',
'ExchangeCollectorConfig',
'create_okx_collector',
'get_supported_exchanges',
'get_exchange_info',
]
# 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():
"""Get list of supported exchange names."""
return list(EXCHANGE_REGISTRY.keys())
def get_exchange_info(exchange_name: str):
"""Get information about a specific exchange."""
return EXCHANGE_REGISTRY.get(exchange_name.lower())