# Path: vnpy/trader/constant.py
# class Direction(Enum):
#     """
#     Direction of order/trade/position.
#     """
#     LONG = "多"
#     SHORT = "空"
#     NET = "净"
# 
# class Exchange(Enum):
#     """
#     Exchange.
#     """
#     # Chinese
#     CFFEX = "CFFEX"         # China Financial Futures Exchange
#     SHFE = "SHFE"           # Shanghai Futures Exchange
#     CZCE = "CZCE"           # Zhengzhou Commodity Exchange
#     DCE = "DCE"             # Dalian Commodity Exchange
#     INE = "INE"             # Shanghai International Energy Exchange
#     SSE = "SSE"             # Shanghai Stock Exchange
#     SZSE = "SZSE"           # Shenzhen Stock Exchange
#     BSE = "BSE"             # Beijing Stock Exchange
#     SGE = "SGE"             # Shanghai Gold Exchange
#     WXE = "WXE"             # Wuxi Steel Exchange
#     CFETS = "CFETS"         # CFETS Bond Market Maker Trading System
#     XBOND = "XBOND"         # CFETS X-Bond Anonymous Trading System
# 
#     # Global
#     SMART = "SMART"         # Smart Router for US stocks
#     NYSE = "NYSE"           # New York Stock Exchnage
#     NASDAQ = "NASDAQ"       # Nasdaq Exchange
#     ARCA = "ARCA"           # ARCA Exchange
#     EDGEA = "EDGEA"         # Direct Edge Exchange
#     ISLAND = "ISLAND"       # Nasdaq Island ECN
#     BATS = "BATS"           # Bats Global Markets
#     IEX = "IEX"             # The Investors Exchange
#     NYMEX = "NYMEX"         # New York Mercantile Exchange
#     COMEX = "COMEX"         # COMEX of CME
#     GLOBEX = "GLOBEX"       # Globex of CME
#     IDEALPRO = "IDEALPRO"   # Forex ECN of Interactive Brokers
#     CME = "CME"             # Chicago Mercantile Exchange
#     ICE = "ICE"             # Intercontinental Exchange
#     SEHK = "SEHK"           # Stock Exchange of Hong Kong
#     HKFE = "HKFE"           # Hong Kong Futures Exchange
#     SGX = "SGX"             # Singapore Global Exchange
#     CBOT = "CBT"            # Chicago Board of Trade
#     CBOE = "CBOE"           # Chicago Board Options Exchange
#     CFE = "CFE"             # CBOE Futures Exchange
#     DME = "DME"             # Dubai Mercantile Exchange
#     EUREX = "EUX"           # Eurex Exchange
#     APEX = "APEX"           # Asia Pacific Exchange
#     LME = "LME"             # London Metal Exchange
#     BMD = "BMD"             # Bursa Malaysia Derivatives
#     TOCOM = "TOCOM"         # Tokyo Commodity Exchange
#     EUNX = "EUNX"           # Euronext Exchange
#     KRX = "KRX"             # Korean Exchange
#     OTC = "OTC"             # OTC Product (Forex/CFD/Pink Sheet Equity)
#     IBKRATS = "IBKRATS"     # Paper Trading Exchange of IB
# 
#     # Special Function
#     LOCAL = "LOCAL"         # For local generated data
# 
# class Interval(Enum):
#     """
#     Interval of bar data.
#     """
#     MINUTE = "1m"
#     HOUR = "1h"
#     DAILY = "d"
#     WEEKLY = "w"
#     TICK = "tick"
# 
# class Offset(Enum):
#     """
#     Offset of order/trade.
#     """
#     NONE = ""
#     OPEN = "开"
#     CLOSE = "平"
#     CLOSETODAY = "平今"
#     CLOSEYESTERDAY = "平昨"
# 
# class Status(Enum):
#     """
#     Order status.
#     """
#     SUBMITTING = "提交中"
#     NOTTRADED = "未成交"
#     PARTTRADED = "部分成交"
#     ALLTRADED = "全部成交"
#     CANCELLED = "已撤销"
#     REJECTED = "拒单"
# 
# class Product(Enum):
#     """
#     Product class.
#     """
#     EQUITY = "股票"
#     FUTURES = "期货"
#     OPTION = "期权"
#     INDEX = "指数"
#     FOREX = "外汇"
#     SPOT = "现货"
#     ETF = "ETF"
#     BOND = "债券"
#     WARRANT = "权证"
#     SPREAD = "价差"
#     FUND = "基金"
# 
# class OptionType(Enum):
#     """
#     Option type.
#     """
#     CALL = "看涨期权"
#     PUT = "看跌期权"
# 
# class OrderType(Enum):
#     """
#     Order type.
#     """
#     LIMIT = "限价"
#     MARKET = "市价"
#     STOP = "STOP"
#     FAK = "FAK"
#     FOK = "FOK"
#     RFQ = "询价"


from dataclasses import dataclass
from datetime import datetime
from logging import INFO
from .constant import Direction, Exchange, Interval, Offset, Status, Product, OptionType, OrderType

    def __post_init__(self):
        """"""
        self.available = self.balance - self.frozen
        self.vt_accountid = f"{self.gateway_name}.{self.accountid}"


@dataclass
class LogData(BaseData):
    """
    Log data is used for recording log messages on GUI or in log files.
    """

    msg: str
    level: int = INFO

    def __post_init__(self):
        """"""
        self.time = datetime.now()


@dataclass
class ContractData(BaseData):
    """
    Contract data contains basic information about each contract traded.
    """

    symbol: str
    exchange: Exchange
    name: str

# Path: vnpy/trader/constant.py
# class Direction(Enum):
#     """
#     Direction of order/trade/position.
#     """
#     LONG = "多"
#     SHORT = "空"
#     NET = "净"
# 
# class Exchange(Enum):
#     """
#     Exchange.
#     """
#     # Chinese
#     CFFEX = "CFFEX"         # China Financial Futures Exchange
#     SHFE = "SHFE"           # Shanghai Futures Exchange
#     CZCE = "CZCE"           # Zhengzhou Commodity Exchange
#     DCE = "DCE"             # Dalian Commodity Exchange
#     INE = "INE"             # Shanghai International Energy Exchange
#     SSE = "SSE"             # Shanghai Stock Exchange
#     SZSE = "SZSE"           # Shenzhen Stock Exchange
#     BSE = "BSE"             # Beijing Stock Exchange
#     SGE = "SGE"             # Shanghai Gold Exchange
#     WXE = "WXE"             # Wuxi Steel Exchange
#     CFETS = "CFETS"         # CFETS Bond Market Maker Trading System
#     XBOND = "XBOND"         # CFETS X-Bond Anonymous Trading System
# 
#     # Global
#     SMART = "SMART"         # Smart Router for US stocks
#     NYSE = "NYSE"           # New York Stock Exchnage
#     NASDAQ = "NASDAQ"       # Nasdaq Exchange
#     ARCA = "ARCA"           # ARCA Exchange
#     EDGEA = "EDGEA"         # Direct Edge Exchange
#     ISLAND = "ISLAND"       # Nasdaq Island ECN
#     BATS = "BATS"           # Bats Global Markets
#     IEX = "IEX"             # The Investors Exchange
#     NYMEX = "NYMEX"         # New York Mercantile Exchange
#     COMEX = "COMEX"         # COMEX of CME
#     GLOBEX = "GLOBEX"       # Globex of CME
#     IDEALPRO = "IDEALPRO"   # Forex ECN of Interactive Brokers
#     CME = "CME"             # Chicago Mercantile Exchange
#     ICE = "ICE"             # Intercontinental Exchange
#     SEHK = "SEHK"           # Stock Exchange of Hong Kong
#     HKFE = "HKFE"           # Hong Kong Futures Exchange
#     SGX = "SGX"             # Singapore Global Exchange
#     CBOT = "CBT"            # Chicago Board of Trade
#     CBOE = "CBOE"           # Chicago Board Options Exchange
#     CFE = "CFE"             # CBOE Futures Exchange
#     DME = "DME"             # Dubai Mercantile Exchange
#     EUREX = "EUX"           # Eurex Exchange
#     APEX = "APEX"           # Asia Pacific Exchange
#     LME = "LME"             # London Metal Exchange
#     BMD = "BMD"             # Bursa Malaysia Derivatives
#     TOCOM = "TOCOM"         # Tokyo Commodity Exchange
#     EUNX = "EUNX"           # Euronext Exchange
#     KRX = "KRX"             # Korean Exchange
#     OTC = "OTC"             # OTC Product (Forex/CFD/Pink Sheet Equity)
#     IBKRATS = "IBKRATS"     # Paper Trading Exchange of IB
# 
#     # Special Function
#     LOCAL = "LOCAL"         # For local generated data
# 
# class Interval(Enum):
#     """
#     Interval of bar data.
#     """
#     MINUTE = "1m"
#     HOUR = "1h"
#     DAILY = "d"
#     WEEKLY = "w"
#     TICK = "tick"
# 
# class Offset(Enum):
#     """
#     Offset of order/trade.
#     """
#     NONE = ""
#     OPEN = "开"
#     CLOSE = "平"
#     CLOSETODAY = "平今"
#     CLOSEYESTERDAY = "平昨"
# 
# class Status(Enum):
#     """
#     Order status.
#     """
#     SUBMITTING = "提交中"
#     NOTTRADED = "未成交"
#     PARTTRADED = "部分成交"
#     ALLTRADED = "全部成交"
#     CANCELLED = "已撤销"
#     REJECTED = "拒单"
# 
# class Product(Enum):
#     """
#     Product class.
#     """
#     EQUITY = "股票"
#     FUTURES = "期货"
#     OPTION = "期权"
#     INDEX = "指数"
#     FOREX = "外汇"
#     SPOT = "现货"
#     ETF = "ETF"
#     BOND = "债券"
#     WARRANT = "权证"
#     SPREAD = "价差"
#     FUND = "基金"
# 
# class OptionType(Enum):
#     """
#     Option type.
#     """
#     CALL = "看涨期权"
#     PUT = "看跌期权"
# 
# class OrderType(Enum):
#     """
#     Order type.
#     """
#     LIMIT = "限价"
#     MARKET = "市价"
#     STOP = "STOP"
#     FAK = "FAK"
#     FOK = "FOK"
#     RFQ = "询价"


# Path: vnpy/trader/object.py
from dataclasses import dataclass
from datetime import datetime
from logging import INFO
from .constant import Direction, Exchange, Interval, Offset, Status, Product, OptionType, OrderType


    def __post_init__(self):
        """"""
        self.available = self.balance - self.frozen
        self.vt_accountid = f"{self.gateway_name}.{self.accountid}"


@dataclass
class LogData(BaseData):
    """
    Log data is used for recording log messages on GUI or in log files.
    """

    msg: str
    level: int = INFO

    def __post_init__(self):
        """"""
        self.time = datetime.now()


@dataclass
class ContractData(BaseData):
    """
    Contract data contains basic information about each contract traded.
    """

    symbol: str
    exchange: Exchange
    name: str

    product: Product