2019-06-28 03:03:57 +00:00
|
|
|
# flake8: noqa
|
2019-01-08 12:45:01 +00:00
|
|
|
from vnpy.event import EventEngine
|
2019-02-10 03:49:09 +00:00
|
|
|
|
2019-01-08 12:45:01 +00:00
|
|
|
from vnpy.trader.engine import MainEngine
|
|
|
|
from vnpy.trader.ui import MainWindow, create_qapp
|
|
|
|
|
2019-07-16 08:15:07 +00:00
|
|
|
# from vnpy.gateway.binance import BinanceGateway
|
2020-02-02 11:09:05 +00:00
|
|
|
#from vnpy.gateway.bitmex import BitmexGateway
|
2019-06-25 08:25:34 +00:00
|
|
|
# from vnpy.gateway.futu import FutuGateway
|
2019-06-30 15:39:39 +00:00
|
|
|
# from vnpy.gateway.ib import IbGateway
|
2020-02-02 11:09:05 +00:00
|
|
|
from vnpy.gateway.ctp import CtpGateway
|
2019-06-14 04:12:41 +00:00
|
|
|
# from vnpy.gateway.ctptest import CtptestGateway
|
2019-08-06 06:35:51 +00:00
|
|
|
# from vnpy.gateway.mini import MiniGateway
|
2019-09-01 14:40:29 +00:00
|
|
|
# from vnpy.gateway.sopt import SoptGateway
|
2019-07-19 14:04:21 +00:00
|
|
|
# from vnpy.gateway.minitest import MinitestGateway
|
2019-06-26 13:43:06 +00:00
|
|
|
# from vnpy.gateway.femas import FemasGateway
|
2019-06-29 15:36:50 +00:00
|
|
|
# from vnpy.gateway.tiger import TigerGateway
|
2019-07-02 15:32:36 +00:00
|
|
|
# from vnpy.gateway.oes import OesGateway
|
2019-09-01 14:40:29 +00:00
|
|
|
# from vnpy.gateway.okex import OkexGateway
|
2019-06-25 08:25:34 +00:00
|
|
|
# from vnpy.gateway.huobi import HuobiGateway
|
2019-11-01 06:34:37 +00:00
|
|
|
# from vnpy.gateway.bitfinex import BitfinexGateway
|
2019-06-25 08:25:34 +00:00
|
|
|
# from vnpy.gateway.onetoken import OnetokenGateway
|
2019-11-01 06:34:37 +00:00
|
|
|
# from vnpy.gateway.okexf import OkexfGateway
|
|
|
|
# from vnpy.gateway.okexs import OkexsGateway
|
2019-06-11 14:59:10 +00:00
|
|
|
# from vnpy.gateway.xtp import XtpGateway
|
2019-06-29 15:36:50 +00:00
|
|
|
# from vnpy.gateway.hbdm import HbdmGateway
|
2019-06-26 13:43:06 +00:00
|
|
|
# from vnpy.gateway.tap import TapGateway
|
2019-06-29 15:36:50 +00:00
|
|
|
# from vnpy.gateway.tora import ToraGateway
|
|
|
|
# from vnpy.gateway.alpaca import AlpacaGateway
|
2019-11-01 06:34:37 +00:00
|
|
|
# from vnpy.gateway.da import DaGateway
|
|
|
|
# from vnpy.gateway.coinbase import CoinbaseGateway
|
|
|
|
# from vnpy.gateway.bitstamp import BitstampGateway
|
|
|
|
# from vnpy.gateway.gateios import GateiosGateway
|
2020-02-02 11:09:05 +00:00
|
|
|
# from vnpy.gateway.bybit import BybitGateway
|
2019-02-10 03:49:09 +00:00
|
|
|
|
2020-02-02 11:09:05 +00:00
|
|
|
from vnpy.app.cta_strategy_pro import CtaStrategyProApp
|
2019-06-25 08:25:34 +00:00
|
|
|
# from vnpy.app.csv_loader import CsvLoaderApp
|
|
|
|
# from vnpy.app.algo_trading import AlgoTradingApp
|
2019-11-15 03:15:16 +00:00
|
|
|
from vnpy.app.cta_backtester import CtaBacktesterApp
|
2019-11-13 07:45:27 +00:00
|
|
|
# from vnpy.app.data_recorder import DataRecorderApp
|
2020-02-02 11:09:05 +00:00
|
|
|
from vnpy.app.tick_recorder import TickRecorderApp
|
|
|
|
from vnpy.app.risk_manager import RiskManagerApp
|
2019-11-13 07:45:27 +00:00
|
|
|
# from vnpy.app.script_trader import ScriptTraderApp
|
|
|
|
# from vnpy.app.rpc_service import RpcServiceApp
|
|
|
|
# from vnpy.app.spread_trading import SpreadTradingApp
|
2020-02-02 11:09:05 +00:00
|
|
|
# from vnpy.app.portfolio_manager import PortfolioManagerApp
|
|
|
|
from vnpy.app.account_recorder import AccountRecorderApp
|
2019-01-08 13:53:03 +00:00
|
|
|
|
|
|
|
def main():
|
|
|
|
""""""
|
2019-01-08 12:45:01 +00:00
|
|
|
qapp = create_qapp()
|
|
|
|
|
2020-02-02 11:09:05 +00:00
|
|
|
event_engine = EventEngine(debug=True, over_ms=200)
|
2019-01-10 15:45:21 +00:00
|
|
|
|
2019-01-08 12:45:01 +00:00
|
|
|
main_engine = MainEngine(event_engine)
|
2019-05-17 02:06:43 +00:00
|
|
|
|
2019-07-16 08:15:07 +00:00
|
|
|
# main_engine.add_gateway(BinanceGateway)
|
2020-02-02 11:09:05 +00:00
|
|
|
main_engine.add_gateway(CtpGateway, gateway_name='ctp')
|
|
|
|
main_engine.add_gateway(CtpGateway, gateway_name='ctp_yh01')
|
|
|
|
|
2019-06-14 04:12:41 +00:00
|
|
|
# main_engine.add_gateway(CtptestGateway)
|
2019-08-06 06:35:51 +00:00
|
|
|
# main_engine.add_gateway(MiniGateway)
|
2019-09-03 01:45:40 +00:00
|
|
|
# main_engine.add_gateway(SoptGateway)
|
2019-07-19 14:04:21 +00:00
|
|
|
# main_engine.add_gateway(MinitestGateway)
|
2019-06-26 13:43:06 +00:00
|
|
|
# main_engine.add_gateway(FemasGateway)
|
2019-06-30 15:39:39 +00:00
|
|
|
# main_engine.add_gateway(IbGateway)
|
2019-06-25 08:25:34 +00:00
|
|
|
# main_engine.add_gateway(FutuGateway)
|
2020-02-02 11:09:05 +00:00
|
|
|
#main_engine.add_gateway(BitmexGateway)
|
2019-06-25 08:25:34 +00:00
|
|
|
# main_engine.add_gateway(TigerGateway)
|
2019-07-02 15:32:36 +00:00
|
|
|
# main_engine.add_gateway(OesGateway)
|
2019-07-16 09:15:42 +00:00
|
|
|
# main_engine.add_gateway(OkexGateway)
|
2019-06-25 08:25:34 +00:00
|
|
|
# main_engine.add_gateway(HuobiGateway)
|
2019-10-21 03:01:50 +00:00
|
|
|
# main_engine.add_gateway(BitfinexGateway)
|
2019-06-25 08:25:34 +00:00
|
|
|
# main_engine.add_gateway(OnetokenGateway)
|
2019-07-16 09:15:42 +00:00
|
|
|
# main_engine.add_gateway(OkexfGateway)
|
2019-06-25 08:25:34 +00:00
|
|
|
# main_engine.add_gateway(HbdmGateway)
|
2019-06-15 15:58:10 +00:00
|
|
|
# main_engine.add_gateway(XtpGateway)
|
2019-06-26 13:43:06 +00:00
|
|
|
# main_engine.add_gateway(TapGateway)
|
2019-06-29 15:36:50 +00:00
|
|
|
# main_engine.add_gateway(ToraGateway)
|
|
|
|
# main_engine.add_gateway(AlpacaGateway)
|
2019-09-05 03:23:37 +00:00
|
|
|
# main_engine.add_gateway(OkexsGateway)
|
|
|
|
# main_engine.add_gateway(DaGateway)
|
2019-09-25 08:00:24 +00:00
|
|
|
# main_engine.add_gateway(CoinbaseGateway)
|
2019-11-01 06:34:37 +00:00
|
|
|
# main_engine.add_gateway(BitstampGateway)
|
2019-10-21 03:01:50 +00:00
|
|
|
# main_engine.add_gateway(GateiosGateway)
|
2020-02-02 11:09:05 +00:00
|
|
|
#main_engine.add_gateway(BybitGateway)
|
2019-05-17 02:06:43 +00:00
|
|
|
|
2020-02-02 11:09:05 +00:00
|
|
|
#main_engine.add_app(CtaStrategyApp)
|
|
|
|
main_engine.add_app(CtaStrategyProApp)
|
|
|
|
#main_engine.add_app(CtaBacktesterApp)
|
2019-06-25 08:25:34 +00:00
|
|
|
# main_engine.add_app(CsvLoaderApp)
|
|
|
|
# main_engine.add_app(AlgoTradingApp)
|
2019-11-13 07:45:27 +00:00
|
|
|
# main_engine.add_app(DataRecorderApp)
|
2020-02-02 11:09:05 +00:00
|
|
|
# main_engine.add_app(TickRecorderApp)
|
|
|
|
main_engine.add_app(RiskManagerApp)
|
2019-09-15 09:44:08 +00:00
|
|
|
# main_engine.add_app(ScriptTraderApp)
|
|
|
|
# main_engine.add_app(RpcServiceApp)
|
2019-11-13 07:45:27 +00:00
|
|
|
# main_engine.add_app(SpreadTradingApp)
|
2020-02-02 11:09:05 +00:00
|
|
|
# main_engine.add_app(PortfolioManagerApp)
|
|
|
|
# main_engine.add_app(AccountRecorderApp)
|
2019-01-18 01:35:35 +00:00
|
|
|
|
2019-01-08 12:45:01 +00:00
|
|
|
main_window = MainWindow(main_engine, event_engine)
|
|
|
|
main_window.showMaximized()
|
|
|
|
|
2019-01-08 13:53:03 +00:00
|
|
|
qapp.exec()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|