I am trying to get the historical data for individual instruments and save them in local database using Historical API. I have already subscribed for the same. I am getting Gateway Timedout Exception after 3 or 4 successive Instrument historical calls. I am placing only 3 calls per second thus playing under the API limit.
Error: Traceback (most recent call last): File "/home/kalki/Downloads/Market/com/kite/connections/InitialInstruments.py", line 160, in populateMinuteTables("minute") File "/home/kalki/Downloads/Market/com/kite/connections/InitialInstruments.py", line 140, in populateMinuteTables historicalData = kite.historical(rows[i][0], str(fromDate), str(toDate), interval) File "/home/kalki/.local/lib/python3.5/site-packages/kiteconnect/__init__.py", line 423, in historical "interval": interval}) File "/home/kalki/.local/lib/python3.5/site-packages/kiteconnect/__init__.py", line 463, in _get return self._request(route, "GET", params) File "/home/kalki/.local/lib/python3.5/site-packages/kiteconnect/__init__.py", line 522, in _request raise ex.ClientNetworkException("Gateway timed out", code=504) kiteconnect.exceptions.ClientNetworkException: Gateway timed out
Helping on this would be greatly appreciated because i am getting this error from yesterday evening.
I am trying to get minute(30 days cap at each request) data of instruments from nifty 50. I am using the following python code to get the same: historicalData = kite.historical(rows[i][0], str(fromDate), str(toDate), interval) where row[i][0] is instrument token from instruments list, fromDate and toDate are date format values parsed as sting and interval contains "minute" as value.
I am able to get minute data for one or two instruments without any error and then ClientNetwork error (Gateway timeout) is thrown and the script stops going forward. I am making the script to sleep for one second every 3 requests for api limit cap as well.
Can you give some more details about what scrip you are trying to access and what are the params you are sending?
I am trying to get minute(30 days cap at each request) data of instruments from nifty 50. I am using the following python code to get the same:
historicalData = kite.historical(rows[i][0], str(fromDate), str(toDate), interval)
where row[i][0] is instrument token from instruments list, fromDate and toDate are date format values parsed as sting and interval contains "minute" as value.
I am able to get minute data for one or two instruments without any error and then ClientNetwork error (Gateway timeout) is thrown and the script stops going forward. I am making the script to sleep for one second every 3 requests for api limit cap as well.
Thankyou
kite = KiteConnect(api_key="your_api_key", timeout=15)
Default timeout is 7 sec.