2025-06-03 12:49:46 +08:00
|
|
|
"""
|
|
|
|
|
Chart Configuration Package
|
|
|
|
|
|
2025-06-03 14:33:25 +08:00
|
|
|
This package provides configuration management for the modular chart system,
|
|
|
|
|
including indicator definitions, schema validation, and default configurations.
|
2025-06-03 12:49:46 +08:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from .indicator_defs import (
|
2025-06-03 14:33:25 +08:00
|
|
|
# Core classes
|
|
|
|
|
IndicatorType,
|
|
|
|
|
DisplayType,
|
|
|
|
|
LineStyle,
|
|
|
|
|
PriceColumn,
|
|
|
|
|
IndicatorParameterSchema,
|
|
|
|
|
IndicatorSchema,
|
2025-06-03 12:49:46 +08:00
|
|
|
ChartIndicatorConfig,
|
2025-06-03 14:33:25 +08:00
|
|
|
|
|
|
|
|
# Schema definitions
|
|
|
|
|
INDICATOR_SCHEMAS,
|
|
|
|
|
INDICATOR_DEFINITIONS,
|
|
|
|
|
|
|
|
|
|
# Utility functions
|
|
|
|
|
validate_indicator_configuration,
|
|
|
|
|
create_indicator_config,
|
|
|
|
|
get_indicator_schema,
|
|
|
|
|
get_available_indicator_types,
|
|
|
|
|
get_indicator_parameter_info,
|
|
|
|
|
validate_parameters_for_type,
|
|
|
|
|
create_configuration_from_json,
|
|
|
|
|
|
|
|
|
|
# Legacy functions
|
2025-06-03 12:49:46 +08:00
|
|
|
get_indicator_display_config,
|
|
|
|
|
get_available_indicators,
|
|
|
|
|
get_overlay_indicators,
|
|
|
|
|
get_subplot_indicators,
|
2025-06-03 14:33:25 +08:00
|
|
|
get_default_indicator_params,
|
|
|
|
|
calculate_indicators
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from .defaults import (
|
|
|
|
|
# Categories and strategies
|
|
|
|
|
IndicatorCategory,
|
|
|
|
|
TradingStrategy,
|
|
|
|
|
IndicatorPreset,
|
|
|
|
|
|
|
|
|
|
# Color schemes
|
|
|
|
|
CATEGORY_COLORS,
|
|
|
|
|
|
|
|
|
|
# Default indicators
|
|
|
|
|
get_all_default_indicators,
|
|
|
|
|
get_indicators_by_category,
|
|
|
|
|
get_indicators_for_timeframe,
|
|
|
|
|
|
|
|
|
|
# Strategy presets
|
|
|
|
|
get_strategy_indicators,
|
|
|
|
|
get_strategy_info,
|
|
|
|
|
get_available_strategies,
|
|
|
|
|
get_available_categories,
|
|
|
|
|
|
|
|
|
|
# Custom presets
|
|
|
|
|
create_custom_preset
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from .strategy_charts import (
|
|
|
|
|
# Chart configuration classes
|
|
|
|
|
ChartLayout,
|
|
|
|
|
SubplotType,
|
|
|
|
|
SubplotConfig,
|
|
|
|
|
ChartStyle,
|
|
|
|
|
StrategyChartConfig,
|
|
|
|
|
|
|
|
|
|
# Strategy configuration functions
|
|
|
|
|
create_default_strategy_configurations,
|
|
|
|
|
validate_strategy_configuration,
|
|
|
|
|
create_custom_strategy_config,
|
|
|
|
|
load_strategy_config_from_json,
|
|
|
|
|
export_strategy_config_to_json,
|
|
|
|
|
get_strategy_config,
|
|
|
|
|
get_all_strategy_configs,
|
|
|
|
|
get_available_strategy_names
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from .validation import (
|
|
|
|
|
# Validation classes
|
|
|
|
|
ValidationLevel,
|
|
|
|
|
ValidationRule,
|
|
|
|
|
ValidationIssue,
|
|
|
|
|
ValidationReport,
|
|
|
|
|
ConfigurationValidator,
|
|
|
|
|
|
|
|
|
|
# Validation functions
|
|
|
|
|
validate_configuration,
|
|
|
|
|
get_validation_rules_info
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from .example_strategies import (
|
|
|
|
|
# Example strategy classes
|
|
|
|
|
StrategyExample,
|
|
|
|
|
|
|
|
|
|
# Example strategy functions
|
|
|
|
|
create_ema_crossover_strategy,
|
|
|
|
|
create_momentum_breakout_strategy,
|
|
|
|
|
create_mean_reversion_strategy,
|
|
|
|
|
create_scalping_strategy,
|
|
|
|
|
create_swing_trading_strategy,
|
|
|
|
|
get_all_example_strategies,
|
|
|
|
|
get_example_strategy,
|
|
|
|
|
get_strategies_by_difficulty,
|
|
|
|
|
get_strategies_by_risk_level,
|
|
|
|
|
get_strategies_by_market_condition,
|
|
|
|
|
get_strategy_summary,
|
|
|
|
|
export_example_strategies_to_json
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
from .error_handling import (
|
|
|
|
|
# Error handling classes
|
|
|
|
|
ErrorSeverity,
|
|
|
|
|
ErrorCategory,
|
|
|
|
|
ConfigurationError,
|
|
|
|
|
ErrorReport,
|
|
|
|
|
ConfigurationErrorHandler,
|
|
|
|
|
|
|
|
|
|
# Error handling functions
|
|
|
|
|
validate_configuration_strict,
|
|
|
|
|
validate_strategy_name,
|
|
|
|
|
get_indicator_suggestions,
|
|
|
|
|
get_strategy_suggestions,
|
|
|
|
|
check_configuration_health
|
2025-06-03 12:49:46 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Package metadata
|
|
|
|
|
__version__ = "0.1.0"
|
|
|
|
|
__package_name__ = "config"
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
2025-06-03 14:33:25 +08:00
|
|
|
# Core classes from indicator_defs
|
|
|
|
|
'IndicatorType',
|
|
|
|
|
'DisplayType',
|
|
|
|
|
'LineStyle',
|
|
|
|
|
'PriceColumn',
|
|
|
|
|
'IndicatorParameterSchema',
|
|
|
|
|
'IndicatorSchema',
|
|
|
|
|
'ChartIndicatorConfig',
|
|
|
|
|
|
|
|
|
|
# Schema and definitions
|
|
|
|
|
'INDICATOR_SCHEMAS',
|
|
|
|
|
'INDICATOR_DEFINITIONS',
|
|
|
|
|
|
|
|
|
|
# Validation and creation functions
|
|
|
|
|
'validate_indicator_configuration',
|
|
|
|
|
'create_indicator_config',
|
|
|
|
|
'get_indicator_schema',
|
|
|
|
|
'get_available_indicator_types',
|
|
|
|
|
'get_indicator_parameter_info',
|
|
|
|
|
'validate_parameters_for_type',
|
|
|
|
|
'create_configuration_from_json',
|
|
|
|
|
|
|
|
|
|
# Legacy compatibility functions
|
|
|
|
|
'get_indicator_display_config',
|
|
|
|
|
'get_available_indicators',
|
|
|
|
|
'get_overlay_indicators',
|
|
|
|
|
'get_subplot_indicators',
|
|
|
|
|
'get_default_indicator_params',
|
|
|
|
|
'calculate_indicators',
|
|
|
|
|
|
|
|
|
|
# Categories and strategies from defaults
|
|
|
|
|
'IndicatorCategory',
|
|
|
|
|
'TradingStrategy',
|
|
|
|
|
'IndicatorPreset',
|
|
|
|
|
'CATEGORY_COLORS',
|
|
|
|
|
|
|
|
|
|
# Default configuration functions
|
|
|
|
|
'get_all_default_indicators',
|
|
|
|
|
'get_indicators_by_category',
|
|
|
|
|
'get_indicators_for_timeframe',
|
|
|
|
|
'get_strategy_indicators',
|
|
|
|
|
'get_strategy_info',
|
|
|
|
|
'get_available_strategies',
|
|
|
|
|
'get_available_categories',
|
|
|
|
|
'create_custom_preset',
|
|
|
|
|
|
|
|
|
|
# Strategy chart configuration classes
|
|
|
|
|
'ChartLayout',
|
|
|
|
|
'SubplotType',
|
|
|
|
|
'SubplotConfig',
|
|
|
|
|
'ChartStyle',
|
|
|
|
|
'StrategyChartConfig',
|
|
|
|
|
|
|
|
|
|
# Strategy configuration functions
|
|
|
|
|
'create_default_strategy_configurations',
|
|
|
|
|
'validate_strategy_configuration',
|
|
|
|
|
'create_custom_strategy_config',
|
|
|
|
|
'load_strategy_config_from_json',
|
|
|
|
|
'export_strategy_config_to_json',
|
|
|
|
|
'get_strategy_config',
|
|
|
|
|
'get_all_strategy_configs',
|
|
|
|
|
'get_available_strategy_names',
|
|
|
|
|
|
|
|
|
|
# Validation classes
|
|
|
|
|
'ValidationLevel',
|
|
|
|
|
'ValidationRule',
|
|
|
|
|
'ValidationIssue',
|
|
|
|
|
'ValidationReport',
|
|
|
|
|
'ConfigurationValidator',
|
|
|
|
|
|
|
|
|
|
# Validation functions
|
|
|
|
|
'validate_configuration',
|
|
|
|
|
'get_validation_rules_info',
|
|
|
|
|
|
|
|
|
|
# Example strategy classes
|
|
|
|
|
'StrategyExample',
|
|
|
|
|
|
|
|
|
|
# Example strategy functions
|
|
|
|
|
'create_ema_crossover_strategy',
|
|
|
|
|
'create_momentum_breakout_strategy',
|
|
|
|
|
'create_mean_reversion_strategy',
|
|
|
|
|
'create_scalping_strategy',
|
|
|
|
|
'create_swing_trading_strategy',
|
|
|
|
|
'get_all_example_strategies',
|
|
|
|
|
'get_example_strategy',
|
|
|
|
|
'get_strategies_by_difficulty',
|
|
|
|
|
'get_strategies_by_risk_level',
|
|
|
|
|
'get_strategies_by_market_condition',
|
|
|
|
|
'get_strategy_summary',
|
|
|
|
|
'export_example_strategies_to_json',
|
|
|
|
|
|
|
|
|
|
# Error handling classes
|
|
|
|
|
'ErrorSeverity',
|
|
|
|
|
'ErrorCategory',
|
|
|
|
|
'ConfigurationError',
|
|
|
|
|
'ErrorReport',
|
|
|
|
|
'ConfigurationErrorHandler',
|
|
|
|
|
|
|
|
|
|
# Error handling functions
|
|
|
|
|
'validate_configuration_strict',
|
|
|
|
|
'validate_strategy_name',
|
|
|
|
|
'get_indicator_suggestions',
|
|
|
|
|
'get_strategy_suggestions',
|
|
|
|
|
'check_configuration_health'
|
2025-06-03 12:49:46 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# Legacy function names for backward compatibility
|
|
|
|
|
validate_indicator_config = get_default_indicator_params # Will be properly implemented in future tasks
|