Skip to content

Error: Tianqin Api will lose websocket connection every night after 19:30 #493

@zhengyoungzy

Description

@zhengyoungzy

Brief description of bug

The TQ Api will lose WSS connection every night after 19:30.
image
Unfortunately, it will raise an error in ops time and cause the asyncio loop to collapse. And there is no other parameter I can use to get the connection status of the WSS connection.
To solve the problem currently, I have to restart the program every night.

Self-Diagnosis

  • I have reviewed the documentation.
  • I have tried to use the latest version tqsdk==3.7.1.
  • I have searched the issues for an answer to my question and I think other issues are caused by this problem like 夜盘开始后,无法接收数据 #483

Environment(for bug reports)

  • Operating System: Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-40-generic x86_64)
  • IDE version: Pycharm 2024.1.5 (Professional Edition)
  • TQ API version: tqsdk==3.7.1

My configuration/Related code

import time
from datetime import datetime
from tqsdk import TqApi, TqAuth


tq_user = ''
tq_pwd = ''


tq_api = TqApi(auth=TqAuth(tq_user, tq_pwd))

tq_lst = tq_api.get_quote_list(['SHFE.au2504'])

print(tq_lst)

while True:
    tq_api.wait_update(deadline=time.time() + 2.0)

    dt = datetime.strptime(tq_lst[0]['datetime'], '%Y-%m-%d %H:%M:%S.%f')
    print(dt.timestamp())


Steps to Reproduce the Issue

  1. connect to TQ API
  2. no other network error before 19:00
  3. wait until 19:00

Current Result

连接失败,每日 19:00-19:30 为日常运维时间,请稍后再试

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions