Lots of errors in kite.historical_data over the past few days

Most times it returns a 502 Bad Gateway error.
Other times it says-
HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)

What is happening? Any clue? Is it an issue on my end?
  • abhi95
    @sujith This issue needs to be resolved. Is this an issue from your end? What can I do to fix it or handle it from my end? Any response would be appreciated.
  • sujith
    We are investigating this issue. Since this is happening on the client side. Kite Trade will not have logs for this.
    Have you seen any pattern when this happens? Any particular API is throwing this error or is it for all the API calls?
  • abhi95
    I have seen this error only for the historical_data API.
    The only way I'm still able to tolerate this is by catching the exception when it throws a 502 Bad Gateway and just indiscriminately requesting the data again in a loop till it grants the request. And it does after a while. Say a minute or a few seconds or on the 10th or 20th request. Can't really say. The occurrence is pretty random and there seems to be no pattern. Since it is more or less serving my purpose for now, I don't have an issue using this workaround.

    However, HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7) makes my script behave unpredictably. Often crashing it. This is why I'm not able to confidently put more money in the system. If you can find a fix or narrow the issue down or even find a workaround for now, please let us know. Any which way, please fix it ASAP. Because at the end of the day, I am still shelling out 2000 bucks a month trusting in you folks.
  • sujith
    We will look into this.
    We don't recommend using historical data API for live strategies. It is provided only for backtesting purposes.
    You can generate candles at your end using the live market data provided by the Kite Ticker.
    You can get started from here.
  • Guhan
    @sujith, facing similar issue while fetching historical data
  • sujith
    You can update to the latest version of pykiteconnect. It has the fix for this.
  • abhi95
    Thanks @sujith, will see how it goes. But the Bad Gateway errors still persist. For example, this morning, the API just shot back a 502 Bad Gateway for 30 minutes. Now that's a long time. A few minutes is understandable. But 30 minutes is kind of pushing it.

    I see what you've told me about generating my own candles using the Ticker. While I can code that, that is unnecessary stress on my system. There is candle data available at your end. It's 2k a month. While that's a tad expensive, I don't mind paying for it. However, all I ask is to ensure the API faults less often.

    Appreciate the support. :)
  • mdalvi
    mdalvi edited October 2018
    Encountered 502 Bad Gateway on Historical API @2018-10-26 17:54:09,158 and it continues...

    @2018-10-26 18:51:09
    Seems to have resolved now...
Sign In or Register to comment.