- Split the `aggregation.py` file into a dedicated sub-package, improving modularity and maintainability. - Moved `TimeframeBucket`, `RealTimeCandleProcessor`, and `BatchCandleProcessor` classes into their respective files within the new `aggregation` sub-package. - Introduced utility functions for trade aggregation and validation, enhancing code organization. - Updated import paths throughout the codebase to reflect the new structure, ensuring compatibility. - Added safety net tests for the aggregation package to verify core functionality and prevent regressions during refactoring. These changes enhance the overall architecture of the aggregation module, making it more scalable and easier to manage.
34 lines
946 B
Python
34 lines
946 B
Python
"""
|
|
Aggregation package for market data processing.
|
|
|
|
This package provides functionality for building OHLCV candles from trade data,
|
|
with support for both real-time and batch processing. It handles:
|
|
|
|
- Time-based bucketing of trades
|
|
- Real-time candle construction
|
|
- Batch processing for historical data
|
|
- Multiple timeframe support
|
|
|
|
Note: The actual class exports will be added here once the refactoring is complete.
|
|
"""
|
|
|
|
from .bucket import TimeframeBucket
|
|
from .realtime import RealTimeCandleProcessor
|
|
from .batch import BatchCandleProcessor
|
|
from .utils import (
|
|
aggregate_trades_to_candles,
|
|
validate_timeframe,
|
|
parse_timeframe
|
|
)
|
|
|
|
__all__ = [
|
|
'TimeframeBucket',
|
|
'RealTimeCandleProcessor',
|
|
'BatchCandleProcessor',
|
|
'aggregate_trades_to_candles',
|
|
'validate_timeframe',
|
|
'parse_timeframe'
|
|
]
|
|
|
|
# Placeholder for future imports and exports
|
|
# These will be added as we move the classes into their respective modules |