Order book not updated

AntonyPrakash
Hi today after placing cover order for 5 stocks, while requesting order book, remaining qty was returned as 5 and avg price returned as 0. this had hppened for all requests. while in kite order book shows the order as executed. why am i not getting updated order book? this happened for all stocks today so the program only made entries and could not proceed further since it did not get confirmation of execution and avg price which it checks thro remaining qty and avg price. I had to manually exit all positions thro kite after shutting down the program. Also its happening since error fetching data error came on kite yesterday. I dont understand why this happens bcos ive been using the code since 3 months. pls tell how to go about this and hav others been facing this too?
  • sujith
    sujith edited September 2017
    Hi @AntonyPrakash,
    Can you private message your client id and order ids? We will check and get back to you.
  • AntonyPrakash
    Tester Placing Order : /orders/co?api_key=xxxxxxxx&access_token=xxxxxxxx&tradingsymbol=PNCINFRA&exchange=NSE&transaction_type=SELL&quantity=5&product=CO&validity=DAY&trigger_price=134.05|[10:58:10]
    Tester Order Placed|[10:58:10]
    Tester Order ID : 170919000450944|[10:58:10]
    Order Info. PendQty : 5,AvgPrice=0|[10:58:20]
    .....
    Order Info. PendQty : 5,AvgPrice=0|[11:3:53]


    Tester Placing Order : /orders/co?api_key=xxxxxxxx&access_token=xxxxxx&tradingsymbol=JUSTDIAL&exchange=NSE&transaction_type=BUY&quantity=1&product=CO&validity=DAY&trigger_price=411.95|[9:54:35]
    Tester Order Placed|[9:54:35]
    Tester Order ID : 170919000253383|[9:54:36]
    Order Info. PendQty : 1,AvgPrice=0|[9:54:46]
    ......
    Order Info. PendQty : 1,AvgPrice=0|[10:51:16]

    These are the order ids...

    How to send client id through private message?
  • AntonyPrakash
    Hi this is trade history from q...

    1 19-09-2017 09:54:35 NSE JUSTDIAL B 1 ₹414.70 1100000001287908 25498865

    2 19-09-2017 10:58:10 NSE PNCINFRA S 5 ₹133.05 1200000001778871 50708042
  • puneetbijnor4020
    FOR 'order_id': '170920000926179' , IT took 10 seconds for status to change from 'PUT ORDER REQ RECEIVED' to 'VALIDATION PENDING' for a CO (market) order. Super slow.It happened for this order only. Check it as such delay should not happen for a market order or any other order. Specially this is not good for algo trading
  • AntonyPrakash
    Hi same hap today also...

    (CPrice=142.05)(TrailPt=142.48)|[9:42:21]
    Tester Placing Order : /orders/co?api_key=xxx&access_token=xxx&tradingsymbol=ASTRAMICRO&exchange=NSE&transaction_type=BUY&quantity=5&product=CO&validity=DAY&trigger_price=141.55|[9:42:21]
    Tester Order Placed|[9:42:21]
    Tester Order ID : 170920000207983|[9:42:21]
    Order Info. PendQty : 5,AvgPrice=0|[9:42:31]
    Order Info. PendQty : 5,AvgPrice=0|[9:42:41]
    ...

    Order Info. PendQty : 5,AvgPrice=0|[10:6:41]
    Order Info. PendQty : 5,AvgPrice=0|[10:6:51]
    Order Info. PendQty : 5,AvgPrice=0|[10:7:1]
    Order Info. PendQty : 5,AvgPrice=0|[10:7:11
  • sujith
    Hi @AntonyPrakash,
    Kite also uses the same endpoint to populate data. If it is displaying on Kite then it is available on Kite Connect.
    Price field in API is the price entered by the user. To check average price check out "average_price" field.
  • puneetbijnor4020
    Does orders with intermediate status like 'PUT ORDER REQ RECEIVED' or 'VALIDATION PENDING' available in response of order api call without order_id
  • puneetbijnor4020
    FOR 'order_id': '170920000926179' , IT took 10 seconds for status to change from 'PUT ORDER REQ RECEIVED' to 'VALIDATION PENDING' for a CO (market) order. Super slow.It happened for this order only. Check it as such delay should not happen for a market order or any other order. Specially this is not good for algo trading
  • AntonyPrakash
    Hi Sujith, thanks for the reply.
    See i coded this but im out of station now and my wife has been using this code. Has never given this erro , but since yesterday this error comes up. As u can see im checking pending qty and avgprice from orderbook and they return the same value everytime. Since the code has been in continuous use for last 3 months it cant b a bug. How ever has any change been in process flow in connect especially wrt requesting order book? bcos if i cant resolve the issue i cant use algo trading.
  • sujith
    Hi @puneetbijnor4020,
    Can you private message the client id?
  • sujith
    Hi @AntonyPrakash,
    From the above logs, it seems like your order is not executed and you are trying to fetch the average price.
    Since you are trying to fetch the average price for an order that is not even partially executed you are facing the issue.
    Ideally, market orders shouldn't take such a long time to execute for liquid instruments. I just checked placing a cover order and it seems to be working fine. It took only 1 second to get completed.
    Please make sure to inform us the same day of order placement. It will be easier as order status logs are only available on the same day.
  • AntonyPrakash
    Hi Sujith,thank u for ur reply. Found the problem. The responce to the order book query according to api documentation is suppose to return the latest entry fitst. So if we parse the latest entry we get to know if peding qty is zero and avg price non zero means order executed. However now the latest entry to order book comes last. Since i dont check status message my program just checks the first message (which used to contain latest entry previously but now it always contain 1st entry only)and thats what has lead to the problem. Now modifying code to read the status message (COMPLETE) to resolve the issue.
    All market orders get executed instantly with zerodha actually less than a second with very few execptions where it takes a bit longer.I add 10 sec delay to make the code more stable...
    Thank u very much.
This discussion has been closed.