- Extracted connection management logic into a new `ConnectionManager` class, promoting separation of concerns and enhancing modularity. - Updated `BaseDataCollector` to utilize the `ConnectionManager` for connection, disconnection, and reconnection processes, improving code clarity and maintainability. - Refactored connection-related methods and attributes, ensuring consistent error handling and logging practices. - Enhanced the `OKXCollector` to implement the new connection management approach, streamlining its connection logic. - Added unit tests for the `ConnectionManager` to validate its functionality and ensure robust error handling. These changes improve the architecture of the data collector, aligning with project standards for maintainability and performance.
69 lines
1.5 KiB
Python
69 lines
1.5 KiB
Python
"""
|
|
Common utilities and data structures for the application.
|
|
|
|
This package provides shared functionality across different components
|
|
of the system, including data transformation, validation, and aggregation.
|
|
"""
|
|
|
|
from .data_types import (
|
|
StandardizedTrade,
|
|
OHLCVCandle,
|
|
MarketDataPoint,
|
|
DataValidationResult,
|
|
CandleProcessingConfig,
|
|
DataType
|
|
)
|
|
|
|
from .transformation.trade import (
|
|
TradeTransformer,
|
|
create_standardized_trade,
|
|
batch_create_standardized_trades
|
|
)
|
|
|
|
from .transformation.base import BaseDataTransformer
|
|
from .transformation.unified import UnifiedDataTransformer
|
|
|
|
from .transformation.safety import (
|
|
TradeLimits,
|
|
DEFAULT_LIMITS,
|
|
STABLECOIN_LIMITS,
|
|
VOLATILE_LIMITS,
|
|
validate_trade_size,
|
|
validate_trade_price,
|
|
validate_symbol_format
|
|
)
|
|
|
|
from .validation import (
|
|
BaseDataValidator,
|
|
ValidationResult
|
|
)
|
|
|
|
__all__ = [
|
|
# Data types
|
|
'StandardizedTrade',
|
|
'OHLCVCandle',
|
|
'MarketDataPoint',
|
|
'DataValidationResult',
|
|
'CandleProcessingConfig',
|
|
'DataType',
|
|
|
|
# Trade transformation
|
|
'TradeTransformer',
|
|
'create_standardized_trade',
|
|
'batch_create_standardized_trades',
|
|
'BaseDataTransformer',
|
|
'UnifiedDataTransformer',
|
|
|
|
# Safety limits and validation
|
|
'TradeLimits',
|
|
'DEFAULT_LIMITS',
|
|
'STABLECOIN_LIMITS',
|
|
'VOLATILE_LIMITS',
|
|
'validate_trade_size',
|
|
'validate_trade_price',
|
|
'validate_symbol_format',
|
|
|
|
# Validation
|
|
'BaseDataValidator',
|
|
'ValidationResult',
|
|
] |