Add technical indicators module for OHLCV data analysis

- Introduced `indicators.py` containing implementations for SMA, EMA, RSI, MACD, and Bollinger Bands, optimized for handling sparse OHLCV data.
- Added `IndicatorResult` dataclass to encapsulate results of indicator calculations.
- Implemented methods for calculating multiple indicators efficiently with JSON configuration support and validation.
- Updated `__init__.py` to include new indicators in the module's exports.
- Enhanced documentation to cover the new technical indicators module, including usage examples and integration details.
- Added comprehensive unit tests to ensure accuracy and robustness of the indicators module.
This commit is contained in:
Vasily.onl
2025-06-02 13:42:00 +08:00
parent cffc54b648
commit 24b6a3feed
7 changed files with 1184 additions and 2 deletions

View File

@@ -15,6 +15,7 @@
- `data/__init__.py` - Data collection package initialization
- `data/okx_collector.py` - OKX API integration for real-time market data collection
- `data/aggregator.py` - OHLCV candle aggregation and processing
- `data/common/indicators.py` - Technical indicators module with SMA, EMA, RSI, MACD, and Bollinger Bands calculations optimized for sparse OHLCV data
- `strategies/base_strategy.py` - Base strategy class and interface
- `strategies/ema_crossover.py` - Example EMA crossover strategy implementation
- `components/dashboard.py` - Dashboard UI components and layouts
@@ -37,8 +38,10 @@
- `tests/test_base_collector.py` - Comprehensive unit tests for the BaseDataCollector abstract class (13 tests)
- `tests/test_collector_manager.py` - Comprehensive unit tests for the CollectorManager with health monitoring (14 tests)
- `tests/test_logging_enhanced.py` - Comprehensive unit tests for enhanced logging features (16 tests)
- `tests/test_indicators.py` - Comprehensive unit tests for technical indicators module (18 tests)
- `docs/setup.md` - Comprehensive setup guide for new machines and environments
- `docs/logging.md` - Complete documentation for the enhanced unified logging system
- `docs/components/technical-indicators.md` - Complete documentation for the technical indicators module with usage examples and integration guide
## Tasks
@@ -62,7 +65,7 @@
- [x] 2.3 Build data validation and error handling for market data
- [x] 2.4 Implement Redis channels for real-time data distribution
- [x] 2.5 Create data storage layer for OHLCV data in PostgreSQL
- [ ] 2.6 Add technical indicators calculation (SMA, EMA, RSI, MACD, Bollinger Bands)
- [x] 2.6 Add technical indicators calculation (SMA, EMA, RSI, MACD, Bollinger Bands)
- [ ] 2.7 Implement data recovery and reconnection logic for API failures
- [ ] 2.8 Create data collection service with proper logging
- [ ] 2.9 Unit test data collection and aggregation logic