Refactor data module to enhance modularity and maintainability
- Extracted `OHLCVData` and validation logic into a new `common/ohlcv_data.py` module, promoting better organization and reusability. - Updated `BaseDataCollector` to utilize the new `validate_ohlcv_data` function for improved data validation, enhancing code clarity and maintainability. - Refactored imports in `data/__init__.py` to reflect the new structure, ensuring consistent access to common data types and exceptions. - Removed redundant data validation logic from `BaseDataCollector`, streamlining its responsibilities. - Added unit tests for `OHLCVData` and validation functions to ensure correctness and reliability. These changes improve the architecture of the data module, aligning with project standards for maintainability and performance.
This commit is contained in:
@@ -26,10 +26,13 @@ This architecture allows for high scalability and fault tolerance.
|
||||
|
||||
- **Location**: `data/exchanges/okx/collector.py`
|
||||
- **Responsibilities**:
|
||||
- Connects to the OKX WebSocket API
|
||||
- Subscribes to real-time data channels
|
||||
- Processes and standardizes incoming data
|
||||
- Stores data in the database
|
||||
- Inherits from `BaseDataCollector` and implements exchange-specific data collection logic.
|
||||
- Utilizes `ConnectionManager` for robust WebSocket connection management.
|
||||
- Leverages `CollectorStateAndTelemetry` for internal status, health, and logging.
|
||||
- Uses `CallbackDispatcher` to notify registered consumers of processed data.
|
||||
- Subscribes to real-time data channels specific to OKX.
|
||||
- Processes and standardizes incoming OKX data before dispatching.
|
||||
- Stores processed data in the database.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user