"""
数据源抽象基类
"""

from abc import ABC, abstractmethod
from typing import Optional
import pandas as pd


class DataSource(ABC):
    """数据源抽象基类"""

    @abstractmethod
    def fetch_ohlcv(
        self,
        code: str,
        start_date: str,
        end_date: str,
        fields: Optional[list] = None,
    ) -> pd.DataFrame:
        """
        获取OHLCV数据

        Args:
            code: 标的代码
            start_date: 开始日期 (YYYY-MM-DD)
            end_date: 结束日期 (YYYY-MM-DD)
            fields: 指定字段列表，None表示获取全部

        Returns:
            DataFrame with columns: date, open, high, low, close, volume
        """
        pass

    @abstractmethod
    def fetch_multiple(
        self,
        codes: list,
        start_date: str,
        end_date: str,
    ) -> pd.DataFrame:
        """
        批量获取多只标的收盘价数据

        Args:
            codes: 标的代码列表
            start_date: 开始日期
            end_date: 结束日期

        Returns:
            DataFrame, index=日期, columns=代码, values=收盘价
        """
        pass
