Gateway timed out on orderbook call (kite.orders())

soumyadeep
soumyadeep edited August 2016 in Python client
Dear @Kailash and @vivek
A very serious problem I faced when calling for the orderbook using "kite.orders()".
As my orders and trades become more and more, the size of the orderbook also increases. At one point when the size of the orderbook is large, it simply keeps on giving me "Gateway timed out".
Now this is really a problem as I need to modify/exit a Bracket Order once the first leg has been executed. I need to call the orderbook everytime to know the "child order IDs" so that I can modify/exit the same.
I would request the experts to kindly look into the same or provide a short-cut alternative, if any, to get the "Child order IDs" of the executed 1st leg of the Bracket Order.

SUGGESTION: Can we have an API to get the child order IDs of any Bracket Order just by giving the "Parent Order ID"?

Thanks in advance
  • sabyasm
    @soumyadeep @Kailash @vivek

    Yes - this is a problem I faced several times. Usually after for 40-50+ orders, I keep on getting the Gateway Timeout error. I think it is something to do with a timeout parameter setting somewhere. One more observation - the issue is predominant during early market hours but after say 4:00 PM I have seen the same kite.orders() return the data for 100+ orders within 1-2 seconds.

    Alternative/Shortcut:

    Not sure if this will be applicable to your case. I am saving the orderid in a list when the order is placed and I am passing the orderid in kite.orders(orderid=XXX) in several loops to avoid the Gateway Timeout. Surely it is inefficient as for 20+ orders it will take more than 40-50 seconds in total instead of a single call. However - this is a workaround I am using the fantastic dev team at zerodha comes up with an efficient call.
  • soumyadeep
    soumyadeep edited August 2016
    Hi @sabyasm , I also do that but then also I get the getway timeout. I actually need to have the child order ids of my executed Bracket orders. For that, I compulsorily need to call the orderbook and then I look for child order IDs with the same parent ID. Can you please suggest me any other alternative ? Is there a way, I can get the child order Id just by the parent order ID?
    Thanks
  • Vivek
    @soumyadeep Checking If we can send parent order id with the order info call which should solve the issue.
  • Vivek
    @soumyadeep We have asked our OMS vendor send us the related field. It may take sometime for us to get this fixed.
  • soumyadeep
    Thanks @vivek , just a thought:
    When we send the call-
    kite.orders(order_id='xxxxx')
    it simply gives us all the information about that order right from placing the order to "validation pending" to "complete" or "rejected". These are recorded as a list in descending order with the latest being the first.
    Can you guys just add two more information about the child order Ids if the parent order id happens to be a bracket order? Lets say, the syntax be-
    kite.orders(order_id='xxxxx', variety='bo')
    Thanks
  • Vivek
    @soumyadeep Yeah we will add parent order id info to the response
  • soumyadeep
    soumyadeep edited August 2016
    Thanks @vivek . As getting the order book is crucial in trading (you always need to modify, cancel or exit positions), gateway timeout errors are a big hindrance. You cant lose money if you cant enter a trade but if you cant exit, you can incur losses. I hope the gateway timeout error gets solved at the earliest. So no matter if you call the order book or an individual order, gateway timeout is still a persistent issue. @Kailash please note.
    Thanks in advance
  • soumyadeep
    Today also I faced "Gateway Timed Out" error while placing orders and its happening too frequently.
  • Kailash
    @soumyadeep We recorded instances of this happening sporadically today. When you catch such an exception, please retry the requests.

    As I've said in other threads before, once we replace the underlying TR OMS APIs completely, these issues should go away for good.
  • soumyadeep
    I see. It's happening again today. Thanks
  • sujith
    Hi,
    We did some improvements to orderbook API. Can you check if you are still getting same error?
Sign In or Register to comment.