#!/usr/bin/env python3
"""
SignalGenerators - 可替换的策略信号生成器包

使用方式：
    from signal_generators import create_generator

    gen = create_generator("ema_macd")
    signal = gen.analyze(bars, params={"ema_short": 9, "ema_long": 21})
"""
from .base import BaseSignalGenerator
from .ema_macd_signal import EMAMacdSignalGenerator


def create_generator(strategy_type: str = "ema_macd", params: dict = None) -> BaseSignalGenerator:
    """统一工厂函数：根据策略类型创建信号生成器"""
    if strategy_type in ("ema_macd", "ema", "default"):
        return EMAMacdSignalGenerator(params)
    elif strategy_type in ("wyckoff", "wyck"):
        from .wyckoff_signal import WyckoffSignalGenerator
        return WyckoffSignalGenerator(params)
    elif strategy_type in ("composite", "multi", "hybrid"):
        from .composite_signal import CompositeSignalGenerator
        return CompositeSignalGenerator(params)
    else:
        raise ValueError(f"Unknown or unimplemented strategy type: {strategy_type}")


__all__ = [
    "BaseSignalGenerator",
    "EMAMacdSignalGenerator",
    "create_generator",
]
