#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'heyongfu' from tqsdk import TqApi, TqAuth, TqSim, TqKq import math api = TqApi(web_gui=True, debug=True,account=TqKq(), auth=TqAuth("*********", "********")) #api = TqApi(web_gui=True, debug=True, auth=TqAuth("*********", "*********")) order = api.insert_order(symbol="CFFEX.IC2108", direction="BUY", offset="OPEN", limit_price="FIVELEVEL", volume=1) while order.status != "FINISHED": api.wait_update() api.close() print("成交量:",order.volume_orign-order.volume_left) print(dict(order))
提示信息为
2021-08-10 11:29:37 – INFO – 通知: 登录成功
2021-08-10 11:29:37 – INFO – 通知: 下单成功
2021-08-10 11:29:37 – INFO – 通知: 报单被服务器撤销
成交为0,
如果把
api = TqApi(web_gui=True, debug=True,account=TqKq(), auth=TqAuth("*********", "********")) 换成
api = TqApi(web_gui=True, debug=True, auth=TqAuth("*********", "*********")) 就没有问题
ringo 已回答的问题 2021年8月11日