3.52K 浏览
0

我要获得order.status然后来撤单,但是半天都收不到,请教一下是什么原因呢

                            async with api.register_update_notify([quote, order]) as update_chan:
                                async for _ in update_chan:
                                    if order and order.status == “ALIVE” and (quote.bid_price1 > order.limit_price:
                                        print(symbol, direction,order.status, quote.bid_price1 > order.limit_price,  “价格改变,撤单重下”)
                                        api.cancel_order(order)
                                    if api.is_changing(order, “status”):
                                        break

chengxiaohui321 已回答的问题 2021年2月1日
0

先别用异步试一下,看看是策略的问题还是异步的问题,get_order尽量放在循环外试试

李思恒 发表新评论 2021年2月1日

这两天我没有用异步的实盘代码也出现这个问题,实盘代码已经运行很久了

之前运行的时候延迟如何?还是最近发生的

因为你这个的判断条件很多,我自己用单纯判断order.status来做没什么问题,具体的策略代码我们这边也不方便调试

您正在查看2个答案中的1个,单击此处查看所有答案。