Giter Site home page Giter Site logo

当OKex接口调用调用stop后再调用connect报错,报错信息为:There is no current event loop in thread 'Thread-6'. about vnpy_rest HOT 5 CLOSED

vnpy avatar vnpy commented on July 17, 2024
当OKex接口调用调用stop后再调用connect报错,报错信息为:There is no current event loop in thread 'Thread-6'.

from vnpy_rest.

Comments (5)

vnpy avatar vnpy commented on July 17, 2024

请问使用的是最新的2.3.0版本吗?

from vnpy_rest.

sunmichace avatar sunmichace commented on July 17, 2024

对的。在vnpy中,开了同样一个帖子。链接地址:https://github.com/vnpy/vnpy/issues/3022。所以内容在那里补充一下。
环境
操作系统: Windows 10
Python版本: python3.7
vn.py版本: v2.3.0
Issue类型
三选一:Question

预期程序行为
针对Okex接口,设计了断开重连的代码,调用self.gateway.close(),之后调用self.gateway.connect()。预期gateway能继续连接上交易所数据。

实际程序行为
调用过程中,报错出现在self.gateway.connect()中,在调用OkexRestApi.connect中的self.start(session_number)报错。在启用start_event_loop()中报错。

重现步骤
针对Bug类型Issue,请提供具体重现步骤以及报错截图,流程:

self.gateway.close()(完成不报错)-->self.gateway.connect(报错)-->OkexRestApi.connect-->错误出现在start_event_loop

image
报错信息:There is no current event loop in thread 'Thread-6'

from vnpy_rest.

vnpy avatar vnpy commented on July 17, 2024

收到,我们一起来排查下

from vnpy_rest.

sunmichace avatar sunmichace commented on July 17, 2024

没问题,我这里提供我的试错经验。我查了网上的解决办法:
1.很多中文帖子,建议这种解决办法:https://blog.csdn.net/longe20111104/article/details/116641176。也出现报错。它是建议直接建一个新的事件循环
2.这个帖子,我认为是为啥上述方法解决不到的主要原因【“在主线程中,调用get_event_loop总能返回属于主线程的event loop对象,如果是处于非主线程中,还需要调用set_event_loop方法指定一个event loop对象,这样get_event_loop才会获取到被标记的event loop对象:”】,但我看得不太明白。https://www.cnblogs.com/SunshineKimi/p/12053914.html。请大佬过目

from vnpy_rest.

vnpy avatar vnpy commented on July 17, 2024

已修复

from vnpy_rest.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.