# Path: vnpy/trader/ui/qt.py
# def create_qapp(app_name: str = "Veighna Trader") -> QtWidgets.QApplication:
#     def excepthook(exctype: type, value: Exception, tb: types.TracebackType) -> None:
#     def __init__(self, parent: QtWidgets.QWidget = None):
#     def init_ui(self) -> None:
#     def show_exception(self, msg: str) -> None:
#     def _copy_text(self) -> None:
#     def _open_community(self) -> None:
# class ExceptionWidget(QtWidgets.QWidget):
# 
# Path: vnpy/trader/constant.py
# 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"
# 
# Path: vnpy/trader/database.py
# def get_database() -> BaseDatabase:
#     """"""
#     # Return database object if already inited
#     global database
#     if database:
#         return database
# 
#     # Read database related global setting
#     database_name: str = SETTINGS["database.name"]
#     module_name: str = f"vnpy_{database_name}"
# 
#     # Try to import database module
#     try:
#         module = import_module(module_name)
#     except ModuleNotFoundError:
#         print(f"找不到数据库驱动{module_name}，使用默认的SQLite数据库")
#         module = import_module("vnpy_sqlite")
# 
#     # Create database object from module
#     database = module.Database()
#     return database


from datetime import datetime
from vnpy.trader.ui import create_qapp, QtCore
from vnpy.trader.constant import Exchange, Interval
from vnpy.trader.database import get_database
from vnpy.chart import ChartWidget, VolumeItem, CandleItem



if __name__ == "__main__":
    app = create_qapp()

    database = get_database()
    bars = database.load_bar_data(
        "IF888",

# Path: vnpy/trader/ui/qt.py
# def create_qapp(app_name: str = "Veighna Trader") -> QtWidgets.QApplication:
#     def excepthook(exctype: type, value: Exception, tb: types.TracebackType) -> None:
#     def __init__(self, parent: QtWidgets.QWidget = None):
#     def init_ui(self) -> None:
#     def show_exception(self, msg: str) -> None:
#     def _copy_text(self) -> None:
#     def _open_community(self) -> None:
# class ExceptionWidget(QtWidgets.QWidget):
# 
# Path: vnpy/trader/constant.py
# 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"
# 
# Path: vnpy/trader/database.py
# def get_database() -> BaseDatabase:
#     """"""
#     # Return database object if already inited
#     global database
#     if database:
#         return database
# 
#     # Read database related global setting
#     database_name: str = SETTINGS["database.name"]
#     module_name: str = f"vnpy_{database_name}"
# 
#     # Try to import database module
#     try:
#         module = import_module(module_name)
#     except ModuleNotFoundError:
#         print(f"找不到数据库驱动{module_name}，使用默认的SQLite数据库")
#         module = import_module("vnpy_sqlite")
# 
#     # Create database object from module
#     database = module.Database()
#     return database


# Path: examples/candle_chart/run.py
from datetime import datetime
from vnpy.trader.ui import create_qapp, QtCore
from vnpy.trader.constant import Exchange, Interval
from vnpy.trader.database import get_database
from vnpy.chart import ChartWidget, VolumeItem, CandleItem




if __name__ == "__main__":
    app = create_qapp()

    database = get_database()
    bars = database.load_bar_data(
        "IF888",

        Exchange.CFFEX,