【发布时间】:2020-02-21 18:11:08
【问题描述】:
我正在使用 fxcmpy 的 REST api 连接到我的 fxcmpy 帐户。 自从升级到 1.2.6 版本后,当我意外断开与服务器的连接时,我遇到了重新连接问题。
我通过命令检测断线
api.socket.on('disconnect',disconnect)
disconnect 是我重新连接的回调函数:
def disconnect():
FLAG=False
while not FLAG:
try :
api=fxcmpy.fxcmpy(access_token=API_ACCESS_TOKEN,log_level='error',server='demo')
api.subscribe_market_data(symbol,(automated_strategy,))
FLAG=True
except:
print('be patient')
time.sleep(60)
FLAG=False
自从新版本以来,我收到“服务器错误:无法连接到 FXCM 服务器”。或“数据包队列为空,正在中止”消息。
如果我重新启动我的 python 控制台,我可以重新启动我的脚本,直到下一次断开连接。 我在 Windows 10、Raspbian 和 android 上试过这个:在所有情况下都是同样的问题。
我已将 python-socketio 和 python-engineio 更新到最新版本:没有变化。
我正在寻找一种在遇到断开连接问题时重新启动客户端的方法。有人有同样的问题/解决它的线索吗?
谢谢
【问题讨论】:
-
您好,我也有同样的问题,您找到解决方案了吗?
标签: python forex python-socketio