# Path: vnpy/trader/object.py
# class HistoryRequest:
#     """
#     Request sending to specific gateway for querying history data.
#     """
# 
#     symbol: str
#     exchange: Exchange
#     start: datetime
#     end: datetime = None
#     interval: Interval = None
# 
#     def __post_init__(self):
#         """"""
#         self.vt_symbol = f"{self.symbol}.{self.exchange.value}"
# 
# class TickData(BaseData):
#     """
#     Tick data contains information about:
#         * last trade in market
#         * orderbook snapshot
#         * intraday market statistics.
#     """
# 
#     symbol: str
#     exchange: Exchange
#     datetime: datetime
# 
#     name: str = ""
#     volume: float = 0
#     turnover: float = 0
#     open_interest: float = 0
#     last_price: float = 0
#     last_volume: float = 0
#     limit_up: float = 0
#     limit_down: float = 0
# 
#     open_price: float = 0
#     high_price: float = 0
#     low_price: float = 0
#     pre_close: float = 0
# 
#     bid_price_1: float = 0
#     bid_price_2: float = 0
#     bid_price_3: float = 0
#     bid_price_4: float = 0
#     bid_price_5: float = 0
# 
#     ask_price_1: float = 0
#     ask_price_2: float = 0
#     ask_price_3: float = 0
#     ask_price_4: float = 0
#     ask_price_5: float = 0
# 
#     bid_volume_1: float = 0
#     bid_volume_2: float = 0
#     bid_volume_3: float = 0
#     bid_volume_4: float = 0
#     bid_volume_5: float = 0
# 
#     ask_volume_1: float = 0
#     ask_volume_2: float = 0
#     ask_volume_3: float = 0
#     ask_volume_4: float = 0
#     ask_volume_5: float = 0
# 
#     localtime: datetime = None
# 
#     def __post_init__(self):
#         """"""
#         self.vt_symbol = f"{self.symbol}.{self.exchange.value}"
# 
# class BarData(BaseData):
#     """
#     Candlestick bar data of a certain trading period.
#     """
# 
#     symbol: str
#     exchange: Exchange
#     datetime: datetime
# 
#     interval: Interval = None
#     volume: float = 0
#     turnover: float = 0
#     open_interest: float = 0
#     open_price: float = 0
#     high_price: float = 0
#     low_price: float = 0
#     close_price: float = 0
# 
#     def __post_init__(self):
#         """"""
#         self.vt_symbol = f"{self.symbol}.{self.exchange.value}"
# 
# Path: vnpy/trader/setting.py
# SETTINGS: Dict[str, Any] = {
#     "font.family": "微软雅黑",
#     "font.size": 12,
# 
#     "log.active": True,
#     "log.level": CRITICAL,
#     "log.console": True,
#     "log.file": True,
# 
#     "email.server": "smtp.qq.com",
#     "email.port": 465,
#     "email.username": "",
#     "email.password": "",
#     "email.sender": "",
#     "email.receiver": "",
# 
#     "datafeed.name": "",
#     "datafeed.username": "",
#     "datafeed.password": "",
# 
#     "database.timezone": get_localzone().zone,
#     "database.name": "sqlite",
#     "database.database": "database.db",
#     "database.host": "",
#     "database.port": 0,
#     "database.user": "",
#     "database.password": ""
# }


from abc import ABC
from typing import Optional, List
from importlib import import_module
from .object import HistoryRequest, TickData, BarData
from .setting import SETTINGS



class BaseDatafeed(ABC):
    """
    Abstract datafeed class for connecting to different datafeed.
    """

    def init(self) -> bool:
        """
        Initialize datafeed service connection.
        """
        pass


# Path: vnpy/trader/object.py
# class HistoryRequest:
#     """
#     Request sending to specific gateway for querying history data.
#     """
# 
#     symbol: str
#     exchange: Exchange
#     start: datetime
#     end: datetime = None
#     interval: Interval = None
# 
#     def __post_init__(self):
#         """"""
#         self.vt_symbol = f"{self.symbol}.{self.exchange.value}"
# 
# class TickData(BaseData):
#     """
#     Tick data contains information about:
#         * last trade in market
#         * orderbook snapshot
#         * intraday market statistics.
#     """
# 
#     symbol: str
#     exchange: Exchange
#     datetime: datetime
# 
#     name: str = ""
#     volume: float = 0
#     turnover: float = 0
#     open_interest: float = 0
#     last_price: float = 0
#     last_volume: float = 0
#     limit_up: float = 0
#     limit_down: float = 0
# 
#     open_price: float = 0
#     high_price: float = 0
#     low_price: float = 0
#     pre_close: float = 0
# 
#     bid_price_1: float = 0
#     bid_price_2: float = 0
#     bid_price_3: float = 0
#     bid_price_4: float = 0
#     bid_price_5: float = 0
# 
#     ask_price_1: float = 0
#     ask_price_2: float = 0
#     ask_price_3: float = 0
#     ask_price_4: float = 0
#     ask_price_5: float = 0
# 
#     bid_volume_1: float = 0
#     bid_volume_2: float = 0
#     bid_volume_3: float = 0
#     bid_volume_4: float = 0
#     bid_volume_5: float = 0
# 
#     ask_volume_1: float = 0
#     ask_volume_2: float = 0
#     ask_volume_3: float = 0
#     ask_volume_4: float = 0
#     ask_volume_5: float = 0
# 
#     localtime: datetime = None
# 
#     def __post_init__(self):
#         """"""
#         self.vt_symbol = f"{self.symbol}.{self.exchange.value}"
# 
# class BarData(BaseData):
#     """
#     Candlestick bar data of a certain trading period.
#     """
# 
#     symbol: str
#     exchange: Exchange
#     datetime: datetime
# 
#     interval: Interval = None
#     volume: float = 0
#     turnover: float = 0
#     open_interest: float = 0
#     open_price: float = 0
#     high_price: float = 0
#     low_price: float = 0
#     close_price: float = 0
# 
#     def __post_init__(self):
#         """"""
#         self.vt_symbol = f"{self.symbol}.{self.exchange.value}"
# 
# Path: vnpy/trader/setting.py
# SETTINGS: Dict[str, Any] = {
#     "font.family": "微软雅黑",
#     "font.size": 12,
# 
#     "log.active": True,
#     "log.level": CRITICAL,
#     "log.console": True,
#     "log.file": True,
# 
#     "email.server": "smtp.qq.com",
#     "email.port": 465,
#     "email.username": "",
#     "email.password": "",
#     "email.sender": "",
#     "email.receiver": "",
# 
#     "datafeed.name": "",
#     "datafeed.username": "",
#     "datafeed.password": "",
# 
#     "database.timezone": get_localzone().zone,
#     "database.name": "sqlite",
#     "database.database": "database.db",
#     "database.host": "",
#     "database.port": 0,
#     "database.user": "",
#     "database.password": ""
# }


# Path: vnpy/trader/datafeed.py
from abc import ABC
from typing import Optional, List
from importlib import import_module
from .object import HistoryRequest, TickData, BarData
from .setting import SETTINGS




class BaseDatafeed(ABC):
    """
    Abstract datafeed class for connecting to different datafeed.
    """

    def init(self) -> bool:
        """
        Initialize datafeed service connection.
        """
        pass


    def query_bar_history(self, req: HistoryRequest) -> Optional[List[BarData]]: