2.15K 浏览
0

您好,根据TQ的示例我改写了,希望在挂单后,在变成alive前,监测价格变化,但是运行后没有反应,加入:print (quote.bid_price1)打印发现这个价格并没有更新。但

明明 api.wait_update且是在!= “FINISHED”循环中。请问哪里错了。

order = api.insert_order(sym1, "SELL", "OPEN", 1, limit_price=bid_price1)
while order.status != "FINISHED":
        api.wait_update()
        quote = api.get_quote(sym1)
        # 当行情有变化且当前挂单价格不优时,则撤单
         print (quote.bid_price1)   
         if order and api.is_changing(quote) and order.status == "ALIVE" and 
               quote.bid_price1 > order.limit_price:
               print("价格改变,撤单重下")
               api.cancel_order(order)

oct xk 编辑问题 2021年4月27日