71 lines
2.4 KiB
Python
71 lines
2.4 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
|
|
|
|
IncTrader: Trader that manages a single strategy during backtesting
|
|
IncBacktester: Backtester for testing incremental strategies with multiprocessing
|
|
BacktestConfig: Configuration class for backtesting runs
|
|
"""
|
|
|
|
from .base import IncStrategyBase, IncStrategySignal
|
|
from .random_strategy import IncRandomStrategy
|
|
from .metatrend_strategy import IncMetaTrendStrategy, MetaTrendStrategy
|
|
from .inc_trader import IncTrader, TradeRecord
|
|
from .inc_backtester import IncBacktester, BacktestConfig
|
|
|
|
# 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__ = [
|
|
# Base classes
|
|
'IncStrategyBase',
|
|
'IncStrategySignal',
|
|
|
|
# Strategies
|
|
'IncRandomStrategy',
|
|
'IncMetaTrendStrategy',
|
|
'MetaTrendStrategy',
|
|
|
|
# Backtesting components
|
|
'IncTrader',
|
|
'IncBacktester',
|
|
'BacktestConfig',
|
|
'TradeRecord',
|
|
|
|
# Registry
|
|
'AVAILABLE_STRATEGIES'
|
|
|
|
# Future implementations
|
|
# 'IncDefaultStrategy',
|
|
# 'IncBBRSStrategy',
|
|
# 'IncStrategyManager'
|
|
]
|
|
|
|
__version__ = '1.0.0' |