read time out on single thread sequnetial application

npchoubey
Hello,
For all day i am getting time exception.
All kite calls are sequential i.e. no multiple thread its plain sequential program to read quotes or position details.


VerifiedHTTPSConnection object at 0x04118D90>, 'Connection to api.kite.trade timed out. (connect timeout=7)'))
quotes exception HTTPSConnectionPool(host='api.kite.trade', port=443): Max retries exceeded with url: /quote?i=NSE%3ANIFTY+BANK&i=NFO%3ABANKNIFTY19SEPFUT (Caused by ConnectTimeoutError(, 'Connection to api.kite.trade timed out. (connect timeout=7)'))
LTP exception HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
LTP exception HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Failed to read positions HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
quotes exception HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Failed to read positions HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
LTP exception HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Failed to read positions HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)

is platform having issues?
Tagged:
  • rakeshr
    @npchoubey
    No, there is no issue at our end for Kite Connect APIs.
    Are you getting request timeout error for all API calls or it's random in between?
    For all random time-out error in between, you may use below code:
    try:
    Your code logic here
    except ReadTimeout:
    pass
  • ZI4453
    @npchoubey is this happening only for these two segments/This particular API call ?
    can you verify if param is correct for Quote call ?
  • npchoubey
    i am essentially calling only 2 apis -- quote() and positions() and both were thowing exception randomly.

    My code is covered under try block but I never seen so many exceptions ever.

    i could tickers being updated on kite GUI so ideally it should not be a net issues .

    However , today i noticed another behaviour. when i ran my program thru Windows command prompt ( which i do daily ) after inputting token, it did not connect to kite server.
    But code worked fine within my Code Studio IDE . Not sure if you guys know any such issue and resolution
  • npchoubey
    Update:
    At this moment my program is working all good. from command prompt as well within IDE.
  • npchoubey
    Deep diving into my code it was not just quote but place_order had failed to execute at
    2019-09-23 13:50:57,012 - 1519 - Failed to place order of SELL_STRANGLE HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)

    This really critical as I had placed order for strangle and 1 leg was executed and second leg failed and it opened up me to high risk, if I manage to fire fight.

    Hope i can get some real good reason why i was getting time outs.
  • ZI4453
    Connection time out error "can occur" when consumer's network layer is clogged, Socket connection producers "usually/dont" actually await ack,or it can be due to erratic internet connection(intermittent)...
Sign In or Register to comment.