Historical API throwing gateway timeout

RL0520
RL0520 edited December 2017 in Python client
Traceback (most recent call last):
File "C:\Users\hp\Desktop\APJ\main folder\Crude Live\007.py", line 167, in
start()
File "C:\Users\hp\Desktop\APJ\main folder\Crude Live\007.py", line 162, in start
records =get_historical_data()
File "C:\Users\hp\Desktop\APJ\main folder\Crude Live\007.py", line 29, in get_historical_data
return kite.historical(instrument_token, from_date, to_date, interval)
File "C:\Users\hp\AppData\Local\Programs\Python\Python36\lib\site-packages\kiteconnect\__init__.py", line 522, in historical
"continuous": 1 if continuous else 0})
File "C:\Users\hp\AppData\Local\Programs\Python\Python36\lib\site-packages\kiteconnect\__init__.py", line 577, in _get
return self._request(route, "GET", params)
File "C:\Users\hp\AppData\Local\Programs\Python\Python36\lib\site-packages\kiteconnect\__init__.py", line 668, in _request
raise(exp(data["message"], code=r.status_code))
kiteconnect.exceptions.NetworkException: Gateway timed out
>>>
  • sujith
    Hi,
    It seems like historical data API is throwing gateway timeout error. I think requests are timing out before fetching data from the database. Our data team is working on the new architecture for Historical data API, once it is live this issue will be gone. For now, you need to handle this exception at your end.
  • sagarraut0007
    When this issue will be resolved? Since, i'm facing this issue so badly
  • sujith
    Hi @sagarraut0007,
    Can you create a new thread with all the details about which Kite Connect client you are using, what is the version of the Kite Connect client, params sent, an exact error message from the server?
  • dibya_1
    facing same issue 50 times a day - kiteconnect.exceptions.NetworkException: Gateway is busy don't know how to handle this issue.

    Traceback (most recent call last):
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/python/log.py", line 103, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/python/log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
    --- ---
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
    why = selectable.doRead()
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 205, in doRead
    return self._dataReceived(data)
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 211, in _dataReceived
    rval = self.protocol.dataReceived(data)
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/protocols/tls.py", line 330, in dataReceived
    self._flushReceiveBIO()
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/protocols/tls.py", line 295, in _flushReceiveBIO
    ProtocolWrapper.dataReceived(self, bytes)
    File "/home/dibya/.local/lib/python2.7/site-packages/twisted/protocols/policies.py", line 120, in dataReceived
    self.wrappedProtocol.dataReceived(data)
    File "/home/dibya/.local/lib/python2.7/site-packages/autobahn/twisted/websocket.py", line 131, in dataReceived
    self._dataReceived(data)
    File "/home/dibya/.local/lib/python2.7/site-packages/autobahn/websocket/protocol.py", line 1175, in _dataReceived
    self.consumeData()
    File "/home/dibya/.local/lib/python2.7/site-packages/autobahn/websocket/protocol.py", line 1187, in consumeData
    while self.processData() and self.state != WebSocketProtocol.STATE_CLOSED:
    File "/home/dibya/.local/lib/python2.7/site-packages/autobahn/websocket/protocol.py", line 1553, in processData
    fr = self.onFrameEnd()
    File "/home/dibya/.local/lib/python2.7/site-packages/autobahn/websocket/protocol.py", line 1674, in onFrameEnd
    self._onMessageEnd()
    File "/home/dibya/.local/lib/python2.7/site-packages/autobahn/twisted/websocket.py", line 159, in _onMessageEnd
    self.onMessageEnd()
    File "/home/dibya/.local/lib/python2.7/site-packages/autobahn/websocket/protocol.py", line 627, in onMessageEnd
    self._onMessage(payload, self.message_is_binary)
    File "/home/dibya/.local/lib/python2.7/site-packages/autobahn/twisted/websocket.py", line 162, in _onMessage
    self.onMessage(payload, isBinary)
    File "build/bdist.linux-x86_64/egg/kiteconnect/ticker.py", line 71, in onMessage

    File "build/bdist.linux-x86_64/egg/kiteconnect/ticker.py", line 657, in _on_message

    File "/home/dibya/abstrade/src/absengine.py", line 2486, in on_ticks
    trade.engine_strategy_gold_negative( ConfigGlobal.kite,ConfigGlobal.lstrategy[0] ,tick)
    File "/home/dibya/abstrade/src/absengine.py", line 2135, in engine_strategy_gold_negative
    records = init_trade_obj.get_historical_data(kite, dstrstegy)
    File "/home/dibya/abstrade/src/__init__.py", line 374, in get_historical_data
    return kite.historical_data(dtrade['INSTRUMENT_TOKEN'], str(dtrade['FROM_DATE']), str(dtrade['TO_DATE']),dtrade['INTERVAL'])
    File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 604, in historical_data

    File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 693, in _get

    File "build/bdist.linux-x86_64/egg/kiteconnect/connect.py", line 762, in _request

    kiteconnect.exceptions.NetworkException: Gateway is busy
  • sujith
    Post-midnight after MCX market closes BOD process runs till early morning. You won't receive any response from OMS.
Sign In or Register to comment.