getting accessToken successfully and all that. but when i try to fetch the instruments('NFO') , it errors out. Surprisingly this was working on monday and tuesday. start erroring out since wednesday.
logs- 2022-04-07 13:38:11: Going to fetch instruments from server... 2022-04-07 13:38:12: Exception while fetching instruments from server Traceback (most recent call last): File "/Users/me/Documents/fin/algotrading/algo-trade-python/src/instruments/Instruments.py", line 62, in fetchInstrumentsFromServer instrumentsListFnO = brokerHandle.instruments('NFO') File "/Users/me/opt/anaconda3/lib/python3.9/site-packages/kiteconnect/connect.py", line 556, in instruments return self._parse_instruments(self._get("market.instruments", url_args={"exchange": exchange})) File "/Users/me/opt/anaconda3/lib/python3.9/site-packages/kiteconnect/connect.py", line 837, in _get return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json) File "/Users/me/opt/anaconda3/lib/python3.9/site-packages/kiteconnect/connect.py", line 919, in _request raise ex.DataException("Unknown Content-Type ({content_type}) with response: ({content})".format( kiteconnect.exceptions.DataException: Unknown Content-Type (text/html) with response: (b'<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n</body>\r\n</html>\r\n')
Instruments dump is a very large file. The instruments api shouldn't be polled continuously.
It only updates once in the morning every trading day.
So ,you can just fetch it once/day and store in your database for that trading day.
The raw endpoint seems to be working fine.
$kite = new KiteConnect($api_key);
$kite->setAccessToken($access_token);
$data = $kite->getInstruments('NFO');
print_r($data);
ERROR:
tradeguru.website is currently unable to handle this request.
HTTP ERROR 500
brokerHandle = KiteConnect(api_key=self.brokerAppDetails.appKey)
getting accessToken successfully and all that.
but when i try to fetch the instruments('NFO') , it errors out. Surprisingly this was working on monday and tuesday. start erroring out since wednesday.
instrumentsListFnO = brokerHandle.instruments('NFO')
logs-
2022-04-07 13:38:11: Going to fetch instruments from server...
2022-04-07 13:38:12: Exception while fetching instruments from server
Traceback (most recent call last):
File "/Users/me/Documents/fin/algotrading/algo-trade-python/src/instruments/Instruments.py", line 62, in fetchInstrumentsFromServer
instrumentsListFnO = brokerHandle.instruments('NFO')
File "/Users/me/opt/anaconda3/lib/python3.9/site-packages/kiteconnect/connect.py", line 556, in instruments
return self._parse_instruments(self._get("market.instruments", url_args={"exchange": exchange}))
File "/Users/me/opt/anaconda3/lib/python3.9/site-packages/kiteconnect/connect.py", line 837, in _get
return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
File "/Users/me/opt/anaconda3/lib/python3.9/site-packages/kiteconnect/connect.py", line 919, in _request
raise ex.DataException("Unknown Content-Type ({content_type}) with response: ({content})".format(
kiteconnect.exceptions.DataException: Unknown Content-Type (text/html) with response: (b'<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n</body>\r\n</html>\r\n')
Thank you
It only updates once in the morning every trading day.
So ,you can just fetch it once/day and store in your database for that trading day.