API Place_Order TimeOut

rj_stk
Hi,
I have been using KITE API for order placement etc. for last 2 years.
I usually place approx 200 orders a day. Since last 2-3 days, 50% of my orders are being rejected with the following message:
HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Plz advise.
Thanks
  • sujith
    Can you give more details? Is this consistent or intermittent? What kind of setup is this local or hosted? Did you try on alternate network?
    A timeout in order placement doesn't mean order is not placed, you need to fetch orderbook and check if it is already placed, before retry.
  • tahseen
    @rj_stk

    Assuming Zerodha Kite won't have 50% failures only with you and if overall it has 50% failures then it would be outage known all over twitter

    Ping and see if you have packet drops, mediation router has issues or DNS of ISP has issues

    Try to make a domain to IP mapping in your machine's hosts file in /etc and see after this is becomes okay
  • rj_stk
    @sujith
    facing this problem since last 2 days. earlier it was fine. some of the orders get placed while others are timed out. its intermittent. The orders which were placed was with the delay of 1 - 20 seconds.
    Its windows365 - microsoft cloud.
    chked the orderbook, order was not placed.
  • rj_stk
    @tahseen i am running this on microsoft cloud. plz advise on this
  • tahseen
    @rj_stk
    https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-tcp-idle-timeout?tabs=tcp-reset-idle-portal

    Check there is no idle timeout configured. Honestly, I don't recommend environments where you have no idea about the layer conditions the cloud provider has created.

    For start, always prefer simpler cloud providers and Ubuntu as OS
  • rj_stk
    Hi, faced same issue today. plz advise asap
  • rj_stk
    Today, I run those on my local pc with good internet connection. Still the problem persists.

    I had upgraded kiteconnect module with python pip 2 days before. Since then, this problem is happening.
    do I need to change any part of the code because of the update?
    @sujith @tahseen

  • rj_stk
    hey @sujith. can you plz provide a solution on this
  • rakeshr
    HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
    This is not related to kite connect lib(here pykiteconnect), but your underlying network. As, @sujith mentioned above you can handle time-out with order book inspect and then re-try. This thread explains more.
  • rj_stk
    hi @rakeshhr @sujith

    Today I uninstalled the kiteconnect version 4.2 and reinstalled 3.9.4. and everything worked smoothly.
    i almost fired approx more than 1000 orders today, and not a single order problem.

    so, i think there may be some issue with the new version which is not compatible with the old code.
    as many people may have not updated to new version, you are not getting much complaints about this.
    plz have a look at it as there is some compatibility issue.
  • rakeshr
    so, i think there may be some issue with the new version which is not compatible with the old code.
    No, I have placed a couple of 100s of orders using the latest pykiteconnect version v4.2.0 and all went fine. Can you DM me a detailed log for such time-out orders with input parameters?
  • tahseen
    @rj_stk maybe in 4.2 the web socket is used more optimally, which is considered as idling by Azure and it disconnects the socket. Whereas 3.9.4 version isn't optimal and continually uses socket thus not disconnected

    Because if you read the link of Microsoft, socket connections are disconnected on idling

    FYI
    @rakeshr
Sign In or Register to comment.