api = TqApi(account=account, auth=auth, backtest=TqBacktest(start_dt=date(2023, 11, 27), end_dt=date(2024, 1, 1))) kline = api.get_kline_serial(symbol, 20, 2) trade = api.get_trade() try: while api.wait_update(): target_pos = TargetPosTask(api, symbol, offset_priority="开") target_pos.set_target_volume(1) while True: api.wait_update() if api.is_changing(trade): target_pos.cancel() if target_pos.is_finished(): break except BacktestFinished: api.close() api = TqApi(account=account, auth=auth) # 这里tqsdk.exceptions.TqTimeoutError: 接收数据超时,请检查客户端及网络是否正常