Vasily.onl d34da789ec 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.
2025-06-12 15:17:35 +08:00

67 lines
1.9 KiB
JSON

{
"type": "rsi",
"name": "RSI Strategy",
"description": "Relative Strength Index momentum strategy that generates buy signals when RSI is oversold and sell signals when RSI is overbought.",
"category": "momentum",
"parameter_schema": {
"period": {
"type": "int",
"description": "Period for RSI calculation",
"min": 2,
"max": 50,
"default": 14,
"required": true
},
"overbought": {
"type": "float",
"description": "RSI overbought threshold (sell signal)",
"min": 50.0,
"max": 95.0,
"default": 70.0,
"required": true
},
"oversold": {
"type": "float",
"description": "RSI oversold threshold (buy signal)",
"min": 5.0,
"max": 50.0,
"default": 30.0,
"required": true
},
"neutrality_zone": {
"type": "bool",
"description": "Enable neutrality zone between 40-60 RSI",
"default": false,
"required": false
}
},
"default_parameters": {
"period": 14,
"overbought": 70.0,
"oversold": 30.0,
"neutrality_zone": false
},
"metadata": {
"required_indicators": ["rsi"],
"timeframes": ["15m", "1h", "4h", "1d"],
"market_conditions": ["volatile", "ranging"],
"risk_level": "medium",
"difficulty": "beginner",
"signals": {
"buy": "RSI below oversold threshold",
"sell": "RSI above overbought threshold",
"hold": "RSI in neutral zone (if enabled)"
},
"performance_notes": "Works well in ranging markets, may lag in strong trending markets"
},
"validation_rules": {
"oversold_less_than_overbought": {
"rule": "oversold < overbought",
"message": "Oversold threshold must be less than overbought threshold"
},
"valid_threshold_range": {
"rule": "oversold >= 5 and overbought <= 95",
"message": "Thresholds must be within valid RSI range (5-95)"
}
}
}