"""
策略基类定义
"""

from abc import ABC, abstractmethod
from typing import Any


class Strategy(ABC):
    """策略抽象基类"""

    def __init__(self, name: str, config: dict = None):
        self.name = name
        self.config = config or {}

    @abstractmethod
    def run(self, **kwargs) -> Any:
        """执行策略"""
        pass

    @abstractmethod
    def get_signals(self, **kwargs) -> Any:
        """获取当前信号"""
        pass


class BacktestStrategy(Strategy):
    """回测策略基类"""

    def __init__(self, name: str, config: dict = None):
        super().__init__(name, config)
        self.results = None

    @abstractmethod
    def run_backtest(self, **kwargs) -> dict:
        """执行回测，返回绩效指标"""
        pass

    def get_results(self) -> dict:
        """获取回测结果"""
        return self.results
