4.0 - 2.0 Implement strategy configuration utilities and templates
- Introduced `config_utils.py` for loading and managing strategy configurations, including functions for loading templates, generating dropdown options, and retrieving parameter schemas and default values. - Added JSON templates for EMA Crossover, MACD, and RSI strategies, defining their parameters and validation rules to enhance modularity and maintainability. - Implemented `StrategyManager` in `manager.py` for managing user-defined strategies with file-based storage, supporting easy sharing and portability. - Updated `__init__.py` to include new components and ensure proper module exports. - Enhanced error handling and logging practices across the new modules for improved reliability. These changes establish a robust foundation for strategy management and configuration, aligning with project goals for modularity, performance, and maintainability.
This commit is contained in:
@@ -21,9 +21,8 @@ class EMAStrategy(BaseStrategy):
|
||||
Generates buy/sell signals when a fast EMA crosses above or below a slow EMA.
|
||||
"""
|
||||
|
||||
def __init__(self, logger=None):
|
||||
super().__init__(logger)
|
||||
self.strategy_name = "ema_crossover"
|
||||
def __init__(self, strategy_name: str, logger=None):
|
||||
super().__init__(strategy_name, logger)
|
||||
|
||||
def get_required_indicators(self) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
|
||||
@@ -21,9 +21,8 @@ class MACDStrategy(BaseStrategy):
|
||||
Generates buy/sell signals when the MACD line crosses above or below its signal line.
|
||||
"""
|
||||
|
||||
def __init__(self, logger=None):
|
||||
super().__init__(logger)
|
||||
self.strategy_name = "macd"
|
||||
def __init__(self, strategy_name: str, logger=None):
|
||||
super().__init__(strategy_name, logger)
|
||||
|
||||
def get_required_indicators(self) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
|
||||
@@ -21,9 +21,8 @@ class RSIStrategy(BaseStrategy):
|
||||
Generates buy/sell signals when RSI crosses overbought/oversold thresholds.
|
||||
"""
|
||||
|
||||
def __init__(self, logger=None):
|
||||
super().__init__(logger)
|
||||
self.strategy_name = "rsi"
|
||||
def __init__(self, strategy_name: str, logger=None):
|
||||
super().__init__(strategy_name, logger)
|
||||
|
||||
def get_required_indicators(self) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user