KiteConnect WEBSOCKET流错误:ReactorNotRestartable

我正在尝试使用KiteTicker从kiteconnect API获取报价结果。我已经使用了documentation

中给出的代码
import logging
from kiteconnect import KiteTicker

logging.basicConfig(level=logging.DEBUG)

# Initialise
kws = KiteTicker("my_api","my_access_token")

def on_ticks(ws,ticks):
    # Callback to receive ticks.
      print(ticks)

def on_connect(ws,response):
    # Callback on successful connect.
    # Subscribe to a list of instrument_tokens (RELIANCE and acc here).
    ws.subscribe([738561,5633])

    # Set RELIANCE to tick in `full` mode.
    ws.set_mode(ws.MODE_FULL,[738561])

def on_close(ws,code,reason):
    # On connection close stop the event loop.
    # Reconnection will not happen after executing `ws.stop()`
    ws.stop()

# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close

# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
kws.connect()

它第一次成功运行,但未显示以下错误:

2020-06-26 20:09:26+0530 [-] Starting factory <kiteconnect.ticker.KiteTickerClientFactory object at 0x000001DE88068A88>
DEBUG:kiteconnect.ticker:Start WebSocket connection.
Traceback (most recent call last):

  File "<ipython-input-52-9b59ab5163b2>",line 31,in <module>
    kws.connect()

  File "C:\Users\yp229\anaconda3\lib\site-packages\kiteconnect\ticker.py",line 532,in connect
    reactor.run(**opts)

  File "C:\Users\yp229\anaconda3\lib\site-packages\twisted\internet\base.py",line 1282,in run
    self.startRunning(installSignalHandlers=installSignalHandlers)

  File "C:\Users\yp229\anaconda3\lib\site-packages\twisted\internet\base.py",line 1262,in startRunning
    ReactorBase.startRunning(self)

  File "C:\Users\yp229\anaconda3\lib\site-packages\twisted\internet\base.py",line 765,in startRunning
    raise error.ReactorNotRestartable()

ReactorNotRestartable

我无法找到其背后的原因,也无法获取日志文件:| 。我正在尝试实现以下输出:

  1. 风筝滴答声列表(我想将其存储在数据框中,但打印时会自行给出错误信息)
  2. 对报价结果应用某些条件

任何帮助都会非常有用。

iCMS 回答:KiteConnect WEBSOCKET流错误:ReactorNotRestartable

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2050692.html

大家都在问