```
from vnpy.eventimport EventEngine# 事件引擎
from vnpy.trader.engineimport MainEngine# 主引擎
from vnpy.trader.uiimport MainWindow, create_qapp# 主引擎ui,创建ui
from vnpy.gateway.ctpimport CtpGateway# 网关,要用哪个交易所就导入哪个 ex:from vnpy.gateway.binance import binance_gateway
# 下面导入的模块在ui主界面中左侧栏
from vnpy.app.cta_strategyimport CtaStrategyApp# 策略模块
from vnpy.app.cta_backtesterimport CtaBacktesterApp# 回测模块
def main():
"""Start VN Trader"""
qapp = create_qapp() # 创建ui,相关知识点:pyqt5
event_engine = EventEngine()
main_engine = MainEngine(event_engine)
main_engine.add_gateway(CtpGateway)
main_engine.add_app(CtaStrategyApp)
main_engine.add_app(CtaBacktesterApp)
main_window = MainWindow(main_engine, event_engine)
main_window.showMaximized()
qapp.exec()
if __name__ =="__main__":
main()
```
启动界面还是比较简单,首先导入了事件引擎、主引擎、网关、策略、回测,那么按照顺序,我们先看引擎部分。
网友评论