from tqsdk import TqApi, TargetPosTask,TqAuth
api = TqApi(auth=TqAuth("xxx", "xxx"))
target_pos_active = TargetPosTask(api, "SHFE.rb2401", price="ACTIVE")
target_pos_active.set_target_volume(1) # 平所有仓位
while not target_pos_active.is_finished():
api.wait_update()
api.close()
成交以后一直在死循环。
李思恒 已回答的问题 2023年11月2日