Exemplo n.º 1
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    # me.addGateway(secGateway)
    me.addGateway(ctpGateway)
    # me.addGateway(ctpsecGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(optionMaster)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 2
0
def main():
    """主程序入口"""

    logger = setup_logger(filename='logs/vnpy.log', debug=False)

    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine2()

    # 初始化主引擎和主窗口对象
    mainEngine = MainEngine(ee)

    mainEngine.logger = logger

    # 添加Gatway
    for gw_name in init_gateway_names['CTP']:
        print('add {0}'.format(gw_name))
        mainEngine.addGateway(ctpGateway, gw_name)

    # 添加应用
    mainEngine.addApp(ctaStrategy)
    mainEngine.addApp(riskManager)
    mainEngine.addApp(spreadTrading)

    mainWindow = MainWindow(mainEngine, ee)
    mainWindow.showMaximized()
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 3
0
def  display_multi_grid():

    qApp = createQApp()
    qApp.setWindowIcon(QtGui.QIcon(loadIconPath('dashboard.ico')))
    w = GridKline()
    w.showMaximized()
    sys.exit(qApp.exec_())
Exemplo n.º 4
0
def main():
    """主程序入口"""

    logger = setup_logger(filename='logs/vnpy.log', debug=False)

    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine2()

    # 初始化主引擎和主窗口对象
    mainEngine = MainEngine(ee)

    mainEngine.logger = logger

    # 添加Gatway
    for gw_name in init_gateway_names['CTP']:
        print('add {0}'.format(gw_name))
        mainEngine.addGateway(ctpGateway, gw_name)

    # 添加应用
    mainEngine.addApp(ctaStrategy)
    mainEngine.addApp(riskManager)
    mainEngine.addApp(spreadTrading)

    mainWindow = MainWindow(mainEngine, ee)
    mainWindow.showMaximized()
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 5
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(ctpGateway)
    me.addGateway(huobiGateway)

    if system == 'Windows':
        pass

    if system == 'Linux':
        me.addGateway(xtpGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)
    me.addApp(spreadTrading)
    me.addApp(algoTrading)
    me.addApp(tradeCopy)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 6
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()
    
    # 创建事件引擎
    ee = EventEngine()
    
    # 创建主引擎
    me = MainEngine(ee)
    
    # 添加交易接口
    me.addGateway(futuGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)
    me.addApp(spreadTrading)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 7
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()
    
    # 创建事件引擎
    ee = EventEngine()
    
    # 创建主引擎
    me = MainEngine(ee)
    
    # 添加交易接口
    me.addGateway(secGateway)
    me.addGateway(ctpGateway)
    me.addGateway(ctpsecGateway)
        
    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(optionMaster)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 8
0
def display_multi_grid():

    qApp = createQApp()
    qApp.setWindowIcon(QtGui.QIcon(loadIconPath('dashboard.ico')))
    w = GridKline()
    w.showMaximized()
    sys.exit(qApp.exec_())
Exemplo n.º 9
0
def main():
    """主程序入口"""

    logger = setup_logger(filename='logs/vnpy', debug=True)

    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine2()

    # 初始化主引擎和主窗口对象
    mainEngine = MainEngine(ee)

    mainEngine.logger = logger

    # 添加Gatway
    for gw_name in init_gateway_names.keys():
        for gw_conf in init_gateway_names[gw_name]:
            print('add {}'.format(gw_conf))
            mainEngine.addGateway(gateway_model_dict[gw_name], gw_conf)
            # 自动连接
            # mainEngine.connect(gw_conf)

    # 添加应用
    mainEngine.addApp(ctaStrategy)
    #mainEngine.addApp(riskManager)
    mainEngine.addApp(spreadTrading)

    mainWindow = MainWindow(mainEngine, ee)
    mainWindow.showMaximized()
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 10
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()
    
    # 创建事件引擎
    ee = EventEngine()
    
    # 创建主引擎
    me = MainEngine(ee)
    
    # 添加交易接口
    me.addGateway(ctpGateway)
    me.addGateway(oandaGateway)
    me.addGateway(ibGateway)
    me.addGateway(huobiGateway)
    me.addGateway(okcoinGateway)
    
    if system == 'Windows':
        me.addGateway(femasGateway)
        me.addGateway(xspeedGateway)
        me.addGateway(sgitGateway)  
        me.addGateway(shzdGateway)
        
    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)
    me.addApp(spreadTrading)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 11
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(ccxtGateway)
    me.addGateway(coinbaseGateway)
    me.addGateway(lbankGateway)
    me.addGateway(bigoneGateway)
    me.addGateway(fcoinGateway)
    me.addGateway(bitmexGateway)
    me.addGateway(huobiGateway)
    me.addGateway(okexGateway)
    me.addGateway(binanceGateway)
    me.addGateway(bitfinexGateway)
    
    # 添加上层应用
    me.addApp(algoTrading)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 12
0
Arquivo: run.py Projeto: cmbclh/test
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(ctpGateway)
    me.addGateway(oandaGateway)
    me.addGateway(ibGateway)
    me.addGateway(huobiGateway)
    me.addGateway(okcoinGateway)
    me.addGateway(geyaGateway)

    if system == 'Windows':
        me.addGateway(femasGateway)
        me.addGateway(xspeedGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)
    me.addApp(spreadTrading)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 13
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(futuGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)
    me.addApp(spreadTrading)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 14
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()
    
    # 创建事件引擎
    ee = EventEngine()
    
    # 创建主引擎
    me = MainEngine(ee)
    
    # 添加交易接口
    me.addGateway(futuGateway)
    me.addGateway(tradeDllAShareGateway)

    # 添加上层应用
    #me.addApp(riskManager)
    # me.addApp(ctaStrategy)
    # me.addApp(spreadTrading)
    me.addApp(stopOrder)
    # me.addApp(slipperyGrid)
    me.addApp(optionSelector)
    me.addApp(optionSprites)
    me.addApp(catchLimitUp)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 15
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    # me.addGateway(ccxtGateway)
    # me.addGateway(coinbaseGateway)
    # me.addGateway(lbankGateway)
    # me.addGateway(bigoneGateway)
    # me.addGateway(fcoinGateway)
    # me.addGateway(bitmexGateway)
    me.addGateway(huobiGateway)
    me.addGateway(okexGateway)
    me.addGateway(binanceGateway)
    # me.addGateway(bitfinexGateway)
    
    # 添加上层应用
    me.addApp(algoTrading)
    me.addApp(ctaStrategy)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 16
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(okexGateway)
    me.addGateway(huobiGateway)
    me.addGateway(binanceGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)
    # me.addApp(dataRecorder)
    # me.addApp(spreadTrading)
    # me.addApp(optionMaster)
    # me.addApp(jaqsService)
    # me.addApp(rpcService)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 17
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(okexfGateway)

    me.addGateway(hbdmGateway)
    me.addGateway(huobiGateway)
    me.addGateway(okexGateway)

    # 添加上层应用
    me.addApp(algoTrading)
    me.addApp(CryptoData)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 18
0
def main():
    # Back up the reference to the exceptionhook
    sys._excepthook = sys.excepthook

    # Set the exception hook to our wrapping function
    sys.excepthook = my_exception_hook

    # if not itchat.instanceList[0].alive:
    #     itchat.auto_login(hotReload=True)
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(ctpGateway)
    me.addGateway(tkproGateway)
    me.addGateway(oandaGateway)
    me.addGateway(ibGateway)

    me.addGateway(femasGateway)
    me.addGateway(xspeedGateway)
    me.addGateway(secGateway)
    me.addGateway(futuGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)

    # 自动连接
    if globalSetting['start_Gateway'] != None:
        me.connect(globalSetting['start_Gateway'])  # ROBIN LIN

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 自动显示CTA策略窗口
    for appDetail in mw.appDetailList:
        if appDetail['appName'] == globalSetting['start_App']:  #'CtaStrategy':
            appName = appDetail['appName']
            try:
                mw.widgetDict[appName].show()
            except KeyError:
                appEngine = mw.mainEngine.getApp(appName)
                mw.widgetDict[appName] = appDetail['appWidget'](appEngine,
                                                                mw.eventEngine)
                mw.widgetDict[appName].show()

    # 在主线程中启动Qt事件循环
    try:
        sys.exit(qApp.exec_())
    except:
        print("Exiting")
Exemplo n.º 19
0
def main():

    from vnpy.trader.uiQt import createQApp

    qApp = createQApp()

    qApp.setWindowIcon(QtGui.QIcon(loadIconPath('dashboard.ico')))
    w = MultiRpcServerManager()
    w.showMaximized()
    sys.exit(qApp.exec_())
Exemplo n.º 20
0
def main():

    from vnpy.trader.uiQt import createQApp

    qApp = createQApp()

    qApp.setWindowIcon(QtGui.QIcon(loadIconPath('dashboard.ico')))
    w = MultiRpcServerManager()
    w.showMaximized()
    sys.exit(qApp.exec_())
Exemplo n.º 21
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = initialize_main_engine(ee)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 22
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(ctpGateway)
    me.addGateway(ibGateway)

    if system == 'Windows':
        me.addGateway(femasGateway)
        me.addGateway(xspeedGateway)
        me.addGateway(secGateway)
Exemplo n.º 23
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(ctpGateway)
    #me.addGateway(ibGateway)

    if system == 'Windows':
        pass
        # me.addGateway(femasGateway)
        # me.addGateway(xspeedGateway)
        # me.addGateway(secGateway)

    if system == 'Linux':
        me.addGateway(xtpGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)
    # me.addApp(spreadTrading)
    me.addApp(algoTrading)
    me.addApp(signalMonitor)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    #启动后自动连接CTP, 同时也连接了数据库
    me.connect("CTP")

    #订阅观察的品种,测试性能
    #subFutures()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 24
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()
    
    # 创建事件引擎
    ee = EventEngine()
    
    # 创建主引擎
    reqAddress = 'tcp://localhost:2014'
    subAddress = 'tcp://localhost:0602'    
    me = MainEngineProxy(ee)
    me.init(reqAddress, subAddress)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 25
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()
    
    # 创建事件引擎
    ee = EventEngine()
    
    # 创建主引擎
    reqAddress = 'tcp://localhost:2014'
    subAddress = 'tcp://localhost:4028'
    me = MainEngineProxy(ee)
    me.init(reqAddress, subAddress)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 26
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)
    me.addGateway(okexGateway)

    # 添加上层应用
    # me.addApp(ctaStrategy)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 27
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(ctpGateway)
    # me.addGateway(oandaGateway)
    me.addGateway(ibGateway)
    # from vnpy.trader.gateway import okexGateway
    # me.addGateway(okexGateway)

    if system == 'Windows':
        me.addGateway(femasGateway)
        me.addGateway(xspeedGateway)
        me.addGateway(secGateway)
        # me.addGateway(futuGateway)
        me.addGateway(tdexGateway)

    if system == 'Linux':
        me.addGateway(xtpGateway)

    # 添加上层应用
    me.addApp(riskManager)
    me.addApp(ctaStrategy)
    me.addApp(spreadTrading)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 28
0
def display_multi_window():
    qApp = createQApp()

    qApp.setWindowIcon(QtGui.QIcon(loadIconPath('dashboard.ico')))
    settings = []
    collections = ['RB99_5', 'RB99_10']
    for collection in collections:
        s = {
            'kline_name': collection,
            'mongo': {
                'host': 'localhost',
                'port': 27017,
                'db': 'Renko_Db',
                'collection': collection,
                'is_live': True
            }
        }
        settings.append(s)

    w = MultiKlineWindow(parent=None, settings=settings)
    w.showMaximized()
    sys.exit(qApp.exec_())
Exemplo n.º 29
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()
    
    # 创建事件引擎
    ee = EventEngine()
    
    # 创建主引擎
    me = MainEngine(ee)
    
    # 添加交易接口
    me.addGateway(ctpGateway)
    
    # 添加上层应用
    me.addApp(jaqsService)
    
    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 30
0
def main():
    """主程序入口"""
    # 创建Qt应用对象
    qApp = createQApp()

    # 创建事件引擎
    ee = EventEngine()

    # 创建主引擎
    me = MainEngine(ee)

    # 添加交易接口
    me.addGateway(ctpGateway)

    # 添加上层应用
    me.addApp(jaqsService)

    # 创建主窗口
    mw = MainWindow(me, ee)
    mw.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 31
0
def main():
    """客户端主程序入口"""
    # 创建Qt对象
    qApp = createQApp()
    
    # 创建事件引擎
    eventEngine = EventEngine2()
    eventEngine.start(timer=False)

    # 创建客户端
    reqAddress = 'tcp://localhost:2014'
    subAddress = 'tcp://localhost:0602'
    client = VtClient(reqAddress, subAddress, eventEngine)

    client.subscribeTopic('')
    client.start()
    
    # 初始化主引擎和主窗口对象
    mainEngine = ClientEngine(client, eventEngine)
    mainWindow = MainWindow(mainEngine, mainEngine.eventEngine)
    mainWindow.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 32
0
def main():
    """客户端主程序入口"""
    # 创建Qt对象
    qApp = createQApp()

    # 创建事件引擎
    eventEngine = EventEngine2()
    eventEngine.start(timer=False)

    # 创建客户端
    reqAddress = 'tcp://localhost:2014'
    subAddress = 'tcp://localhost:0602'
    client = VtClient(reqAddress, subAddress, eventEngine)

    client.subscribeTopic('')
    client.start()

    # 初始化主引擎和主窗口对象
    mainEngine = ClientEngine(client, eventEngine)
    mainWindow = MainWindow(mainEngine, mainEngine.eventEngine)
    mainWindow.showMaximized()

    # 在主线程中启动Qt事件循环
    sys.exit(qApp.exec_())
Exemplo n.º 33
0

def display_multi_grid():

    qApp = createQApp()
    qApp.setWindowIcon(QtGui.QIcon(loadIconPath('dashboard.ico')))
    w = GridKline()
    w.showMaximized()
    sys.exit(qApp.exec_())


if __name__ == '__main__':

    #
    ## 界面设置
    qApp = createQApp()
    qApp.setWindowIcon(QtGui.QIcon(loadIconPath('dashboard.ico')))
    #
    # K线界面
    try:
        ui = KLineWidget(display_vol=False, display_sub=True)
        ui.show()
        ui.KLtitle.setText('btc()', size='20pt')
        ui.add_indicator(indicator='ema34', is_main=True)
        ui.add_indicator(indicator='ema55', is_main=True)
        ui.add_indicator(indicator='ema120', is_main=True)
        ui.add_indicator(indicator='sk', is_main=False)
        ui.add_indicator(indicator='sd', is_main=False)

        # 这里加载基础K线
        df = pd.read_csv('logs/SDemo_btc_usdt_M5.csv')