Hi, Since a couple of days I am see many "Gateway connection error" messages when getting quotes especially next month quotes. This is got to a point that its just unacceptable. Quote api is to - put it mildly - totally crappy. Using historic api to get current quote is not an option. Please give a permanent solution where siple quopte requests even i in some 3 to 4 hours doesnt retrieve quotes consistently. Any ideas?
Hi @razcads, The old quote call is provided by our OMS vendor TR. It is known to have random and intermittent issues lately. We would suggest using new Quote API calls. If it takes time for migration then you can write your custom request to api.kite.trade/quote. You can check out the documentation for more information about request and response.
@sujith yes I created custom function as @tonystark had indicated. this works but it gives blank quotes and also errors out giving "Too many requests". What is the number of requests limit? Is it per minute? How many?
@razcads You can send multiple instruments to the URL instead of requesting separately. You will get rate limited otherwise. The rate is 1 request per second. And you can request up to 500 instruments in one request.
@tonystark thanks. my requests are well within the limit than. I do only 1 request in 10 mins or so. But still i seem to be hitting this error where i just don't get a quote. I get a simple python error indicating the key data is not present.
this is an excerpt from my code.
header_token ='token '+ kite.api_key+ ":" + kite.access_token # use a comma separated list for instrument, or single as below instrument = exchange+':'+next_month_trading_symbol headers = { 'X-Kite-Version': '3', 'Authorization': header_token, } params = (('i', [instrument]),) response = requests.get('https://api.kite.trade/quote', headers=headers, params=params) next_month_quote = response.json() if (next_month_quote['data'][instrument]['depth']['sell'][0]['price'] == 0) or \ (next_month_quote['data'][instrument]['depth']['buy'][0]['price'] ==0): pass else: print next_month_quote
The above code works when i test it out. But then on deploying to Amazon AMI i get error key data not found which only means that quote was not returned . Have you seen this issue? Any clues?
@tonystark I finally did find it.. it so happened that my code was executing call to quote twice within 1 second and returning the error. Resolved now.
Can you clarify if the one second limit is only for http quote response and not for python quote api right?
Can you let us know which version of pykiteconnect you are using?
The old quote call is provided by our OMS vendor TR. It is known to have random and intermittent issues lately. We would suggest using new Quote API calls. If it takes time for migration then you can write your custom request to api.kite.trade/quote. You can check out the documentation for more information about request and response.
data
is not present.this is an excerpt from my code. The above code works when i test it out. But then on deploying to Amazon AMI i get error key
data
not found which only means that quote was not returned . Have you seen this issue? Any clues?response.json()
while running in AMI?Can you clarify if the one second limit is only for http quote response and not for python quote api right?