同一段代码,在PYcharm上可以正常返回主程序,但在天勤客户端上却出现错误,问题是运行到左边红圈部分的IF语句运行中断(if后的第一个条件不满足);奇怪的是我的print语句都是打印了两次,不知道咋回事。请大神指导!
leo zhang 发表新评论 2019年11月27日
运行结果
C:Python37python.exe C:/TianQin/strategies/my_handle.py
2019-11-27 11:26:19,244 – INFO – 通知: 登录成功
可用资金 561878.76
Task was destroyed but it is pending!
task: <Task pending coro= wait_for=<Future pending cb=[()]> cb=[TqApi._on_task_done()]>
Task was destroyed but it is pending!
task: <Task pending coro= wait_for=<Future pending cb=[()]> cb=[TqApi._on_task_done()]>
Exception ignored in:
Traceback (most recent call last):
这已经是最简单的了,还是不行啊
near_contract_id=”SHFE.”+near_contract
far_contract_id=”SHFE.”+far_contract
api = TqApi(TqAccount(my_corp, my_account, my_pass))
account = api.get_account()
print(“可用资金”,account.available)
quote_near = api.get_quote(near_contract_id)
quote_far = api.get_quote(far_contract_id)
order_far = api.insert_order(symbol=far_contract_id, direction=”SELL”, offset=”OPEN”, limit_price=my_ask_price, volume=1)
order_near = api.insert_order(symbol=near_contract_id, direction=”BUY”, offset=”OPEN”, limit_price=13800, volume=1)