VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 22
声望: 0

ModuleNotFoundError: No module named 'vnpy.app.algo_trading.algos'

import os, sys

sys.path.insert(0, ".")
sys.path.insert(0, os.path.join("..", "vnpy"))

from vnpy.event import EventEngine

from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp

# from vnpy.ctp import CtpGateway
# from vnpy.ctptest import CtptestGateway

from vnpy.gateway.ib import IbGateway
# from vnpy.gateway.tiger import TigerGateway
# from vnpy.gateway.tap import TapGateway
# from vnpy.gateway.da import DaGateway


# from howtrader.app.cta_strategy import CtaStrategyApp
# from howtrader.app.data_manager import DataManagerApp
# from howtrader.app.data_recorder import DataRecorderApp
# from howtrader.app.algo_trading import AlgoTradingApp
# from howtrader.app.cta_backtester import CtaBacktesterApp
# from howtrader.app.risk_manager import RiskManagerApp
# from howtrader.app.spread_trading import SpreadTradingApp


from vnpy.app.cta_strategy import CtaStrategyApp

from vnpy.app.cta_backtester import CtaBacktesterApp
from vnpy.app.spread_trading import SpreadTradingApp
from vnpy.app.algo_trading import AlgoTradingApp
# from vnpy.app.option_master import OptionMasterApp
from vnpy.app.portfolio_strategy import PortfolioStrategyApp
from vnpy.app.script_trader import ScriptTraderApp
# from vnpy.app.market_radar import MarketRadarApp
# from vnpy.chartwizard import ChartWizardApp
# from vnpy.app.rpc_service import RpcServiceApp
# from vnpy.app.excel_rtd import ExcelRtdApp
from vnpy.app.data_manager  import DataManagerApp
from vnpy.app.data_recorder import DataRecorderApp
from vnpy.app.risk_manager import RiskManagerApp
from vnpy.app.spread_trading import SpreadTradingApp

from vnpy.app.web_trader import WebTraderApp
from vnpy.app.portfolio_manager import PortfolioManagerApp
from vnpy.app.paper_account import PaperAccountApp


def main():
    """"""
    qapp = create_qapp()
    qapp = create_qapp()

    event_engine = EventEngine()

    main_engine = MainEngine(event_engine)

    main_engine.add_gateway(IbGateway)
    main_engine.add_app(CtaStrategyApp)
    main_engine.add_app(CtaBacktesterApp)
    main_engine.add_app(DataManagerApp)
    main_engine.add_app(AlgoTradingApp)
    main_engine.add_app(DataRecorderApp)
    main_engine.add_app(RiskManagerApp)
    main_engine.add_app(SpreadTradingApp)

    main_window = MainWindow(main_engine, event_engine)
    main_window.showMaximized()


    # main_engine.add_gateway(CtptestGateway)
    # main_engine.add_gateway(MiniGateway)
    # main_engine.add_gateway(MinitestGateway)
    # main_engine.add_gateway(FemasGateway)
    # main_engine.add_gateway(SoptGateway)
    # main_engine.add_gateway(SopttestGateway)
    # main_engine.add_gateway(SecGateway)    
    # main_engine.add_gateway(UftGateway)
    # main_engine.add_gateway(EsunnyGateway)
    # main_engine.add_gateway(HsoptionGateway)
    # main_engine.add_gateway(XtpGateway)
    # main_engine.add_gateway(ToraStockGateway)
    # main_engine.add_gateway(ToraOptionGateway)
    # main_engine.add_gateway(OesGateway)
    # main_engine.add_gateway(ComstarGateway)
    # main_engine.add_gateway(FutuGateway)
    # main_engine.add_gateway(IbGateway)
    # main_engine.add_gateway(TigerGateway)
    # main_engine.add_gateway(TapGateway)
    # main_engine.add_gateway(DaGateway)

    # main_engine.add_app(CtaStrategyApp)
    # main_engine.add_app(CtaBacktesterApp)
    # main_engine.add_app(SpreadTradingApp)
    # main_engine.add_app(AlgoTradingApp)
    # main_engine.add_app(OptionMasterApp)
    # main_engine.add_app(PortfolioStrategyApp)
    # main_engine.add_app(ScriptTraderApp)
    # main_engine.add_app(MarketRadarApp)
    # main_engine.add_app(ChartWizardApp)
    # main_engine.add_app(RpcServiceApp)
    # main_engine.add_app(ExcelRtdApp)
    # main_engine.add_app(DataManagerApp)
    # main_engine.add_app(DataRecorderApp)
    # main_engine.add_app(RiskManagerApp)
    # main_engine.add_app(WebTraderApp)
    # main_engine.add_app(PortfolioManagerApp)
    # main_engine.add_app(PaperAccountApp)

    main_window = MainWindow(main_engine, event_engine)
    main_window.showMaximized()

    qapp.exec()


if __name__ == "__main__":
    main()
Member
avatar
加入于:
帖子: 5049
声望: 303

你qapp = create_qapp()这行代码用了两次,会报错的。去掉多余的代码后我这边可以打开,可以试着加载其他的app看看能否成功,如果不可以可能是环境配置问题,如果可以就请查看一下vnpy包里algo_trading的代码是否有缺失,可能是安装不完全导致的

Member
avatar
加入于:
帖子: 22
声望: 0

xiaohe wrote:

你qapp = create_qapp()这行代码用了两次,会报错的。去掉多余的代码后我这边可以打开,可以试着加载其他的app看看能否成功,如果不可以可能是环境配置问题,如果可以就请查看一下vnpy包里algo_trading的代码是否有缺失,可能是安装不完全导致的

谢谢回复! 我还是有这个错误 我看了vnpy那个文件夹 文件都在啊 很奇怪为什么会找不到.algos自文件。 另外我是通过

sys.path.insert(0, ".")
sys.path.insert(0, os.path.join("..", "vnpy"))

来调用vnpy的。没有安装 不知道是不是这个原因?但是感觉这个错误不合理啊

 trade_bot $ python main_window.py 
找不到数据服务驱动vnpy_,使用默认的RQData数据服务
Traceback (most recent call last):
  File "main_window.py", line 127, in <module>
    main()
  File "main_window.py", line 51, in main
    main_engine.add_app(AlgoTradingApp)
  File "../vnpy/vnpy/trader/engine.py", line 99, in add_app
  File "../vnpy/vnpy/trader/engine.py", line 74, in add_engine
  File "../vnpy/vnpy/app/algo_trading/engine.py", line 34, in __init__
  File "../vnpy/vnpy/app/algo_trading/engine.py", line 48, in load_algo_template
ModuleNotFoundError: No module named 'vnpy.app.algo_trading.algos'
Member
avatar
加入于:
帖子: 5049
声望: 303

请问加载其他的app能否成功呢?

© 2015-2022 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】