- Introduced `IncMetaTrendStrategy` for real-time processing of the MetaTrend trading strategy, utilizing three Supertrend indicators. - Added comprehensive documentation in `METATREND_IMPLEMENTATION.md` detailing architecture, key components, and usage examples. - Updated `__init__.py` to include the new strategy in the strategy registry. - Created tests to compare the incremental strategy's signals against the original implementation, ensuring mathematical equivalence. - Developed visual comparison scripts to analyze performance and signal accuracy between original and incremental strategies.
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
"""
|
|
Incremental Strategies Module
|
|
|
|
This module contains the incremental calculation implementation of trading strategies
|
|
that support real-time data processing with efficient memory usage and performance.
|
|
|
|
The incremental strategies are designed to:
|
|
- Process new data points incrementally without full recalculation
|
|
- Maintain bounded memory usage regardless of data history length
|
|
- Provide identical results to batch calculations
|
|
- Support real-time trading with minimal latency
|
|
|
|
Classes:
|
|
IncStrategyBase: Base class for all incremental strategies
|
|
IncRandomStrategy: Incremental implementation of random strategy for testing
|
|
IncMetaTrendStrategy: Incremental implementation of the MetaTrend strategy
|
|
IncDefaultStrategy: Incremental implementation of the default Supertrend strategy
|
|
IncBBRSStrategy: Incremental implementation of Bollinger Bands + RSI strategy
|
|
IncStrategyManager: Manager for coordinating multiple incremental strategies
|
|
"""
|
|
|
|
from .base import IncStrategyBase, IncStrategySignal
|
|
from .random_strategy import IncRandomStrategy
|
|
from .metatrend_strategy import IncMetaTrendStrategy, MetaTrendStrategy
|
|
|
|
# Note: These will be implemented in subsequent phases
|
|
# from .default_strategy import IncDefaultStrategy
|
|
# from .bbrs_strategy import IncBBRSStrategy
|
|
# from .manager import IncStrategyManager
|
|
|
|
# Strategy registry for easy access
|
|
AVAILABLE_STRATEGIES = {
|
|
'random': IncRandomStrategy,
|
|
'metatrend': IncMetaTrendStrategy,
|
|
'meta_trend': IncMetaTrendStrategy, # Alternative name
|
|
# 'default': IncDefaultStrategy,
|
|
# 'bbrs': IncBBRSStrategy,
|
|
}
|
|
|
|
__all__ = [
|
|
'IncStrategyBase',
|
|
'IncStrategySignal',
|
|
'IncRandomStrategy',
|
|
'IncMetaTrendStrategy',
|
|
'MetaTrendStrategy',
|
|
'AVAILABLE_STRATEGIES'
|
|
# 'IncDefaultStrategy',
|
|
# 'IncBBRSStrategy',
|
|
# 'IncStrategyManager'
|
|
]
|
|
|
|
__version__ = '1.0.0' |