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",
|
||
|
|
]
|