- Introduced a comprehensive framework for incremental trading strategies, including modules for strategy execution, backtesting, and data processing. - Added key components such as `IncTrader`, `IncBacktester`, and various trading strategies (e.g., `MetaTrendStrategy`, `BBRSStrategy`, `RandomStrategy`) to facilitate real-time trading and backtesting. - Implemented a robust backtesting framework with configuration management, parallel execution, and result analysis capabilities. - Developed an incremental indicators framework to support real-time data processing with constant memory usage. - Enhanced documentation to provide clear usage examples and architecture overview, ensuring maintainability and ease of understanding for future development. - Ensured compatibility with existing strategies and maintained a focus on performance and scalability throughout the implementation.
59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
"""
|
|
Incremental Trading Strategies Framework
|
|
|
|
This module provides the strategy framework and implementations for incremental trading.
|
|
All strategies inherit from IncStrategyBase and support real-time data processing
|
|
with constant memory usage.
|
|
|
|
Available Components:
|
|
- Base Framework: IncStrategyBase, IncStrategySignal, TimeframeAggregator
|
|
- Strategies: MetaTrendStrategy, RandomStrategy, BBRSStrategy
|
|
- Indicators: Complete indicator framework in .indicators submodule
|
|
|
|
Example:
|
|
from IncrementalTrader.strategies import MetaTrendStrategy, IncStrategySignal
|
|
|
|
# Create strategy
|
|
strategy = MetaTrendStrategy("metatrend", params={"timeframe": "15min"})
|
|
|
|
# Process data
|
|
strategy.process_data_point(timestamp, ohlcv_data)
|
|
|
|
# Get signals
|
|
entry_signal = strategy.get_entry_signal()
|
|
if entry_signal.action == "BUY":
|
|
print(f"Entry signal with confidence: {entry_signal.confidence}")
|
|
"""
|
|
|
|
# Base strategy framework (already migrated)
|
|
from .base import (
|
|
IncStrategyBase,
|
|
IncStrategySignal,
|
|
TimeframeAggregator,
|
|
)
|
|
|
|
# Migrated strategies
|
|
from .metatrend import MetaTrendStrategy, IncMetaTrendStrategy
|
|
from .random import RandomStrategy, IncRandomStrategy
|
|
from .bbrs import BBRSStrategy, IncBBRSStrategy
|
|
|
|
# Indicators submodule
|
|
from . import indicators
|
|
|
|
__all__ = [
|
|
# Base framework
|
|
"IncStrategyBase",
|
|
"IncStrategySignal",
|
|
"TimeframeAggregator",
|
|
|
|
# Available strategies
|
|
"MetaTrendStrategy",
|
|
"IncMetaTrendStrategy", # Compatibility alias
|
|
"RandomStrategy",
|
|
"IncRandomStrategy", # Compatibility alias
|
|
"BBRSStrategy",
|
|
"IncBBRSStrategy", # Compatibility alias
|
|
|
|
# Indicators submodule
|
|
"indicators",
|
|
] |