It looks like you're new here. If you want to get involved, click one of these buttons!
def place_order(...):
print('+++ place order')
kite.place_order(...)
print('--- place order')
def on_order_update(ws, data):
print('+++ on_order_update')
...
print('--- on_order_update')
Output screen:
+++ place order
+++ on_order_update
--- on_order_update
--- place order
And, the dataargument of the on_order_update, is it always a dictionary of size one? Meaning, is it not a list of dictionaries?kite.place_order() or data['order_id']?
It's always better to collect order_id from response of kite.place_order(),As, both method is async and there can be the discrepancy at your end in capturing order_id in case of multiple placed order in same period from on_order_update method.
Could you please also suggest on the sequence? You said it can be asynchronous, which I can assume if the
filled_quantityis not equal to the ordered quantity, then it can happen.place_order()can return?dataparameter ofon_order_updateis a dictionary (not a list of dictionaries). So, does it mean that every callback is for only one token at a time?Async can only effect, if you are continuously placing orders and at the time checking for on_order_update(). No,place_order() is always first. Yes, it's a dictionary but for every call back you will get dictionary response for all OPEN/COMPLETE orders.