Hi, I was doing testing of my app off market hours. I found historical data is giving frequent errors. The errors are "The remote server returned an error: (429)." "The operation timed out". I am using queue to hit server.(using dotnetAPI) From forum I found that many of users are facing same issue. Is this historical API still under development phase? Please do needful. Thanks for understanding our pain point. Please let us know if you need more info to replicate errors. (if you try to get 25 stock's 1 min interval data I hope you can easily replicate)
Hi@sujith but if I implement queue that should not happen.if you need I can share my code.please suggest if you we need to implement something different.i want to avoid threading.
//from the main class taking stocks name from xml file as below and calling enque deque function RequestQueue req = RequestQueue.Instance(); //req. List<Historical> historical = new List<Historical>(); string date = DateTime.Now.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.GetCultureInfo("en-US")); foreach (var node in nodeList)//all my stocks from xml stored nodelist { stockName = node.SelectSingleNode("STOCKNAME").InnerText; string strStock = "select instrumenttoken,convert(date,getdate(),112) from tblInstrument where tradingsymbol= '" + stockName + "'"; dsStock = new DataSet();
SqlDataAdapter objStock = new SqlDataAdapter(strStock, conn);
Even if you are using queue this may happen. Because sometimes requests might complete in short amount of time. And next request will be fired immediately. If more than 3 requests are called in a second like this you will get 429.
You can either add ~300ms delay in between each request or add a retry mechanism if you are getting 429 to solve this issue.
Hi,getting invalid api credentials.I am now testing my application.Suddently it started since last 5 mins.I regenerated tokens.But it is giving forbidden error.
@Encrypted, In .NET client session hook is invoked for every 403 errors which can be any other issue like invalid api_key(ForbiddenError in KiteConnect's context). We will change it to only invoke session hook when there is TokenException.
HTTP error code 429 means you are getting rate limited.
All Kite Connect HTTP calls are limited to 3 requests per second.
Can you paste your code?
Even if you are using queue this may happen. Because sometimes requests might complete in short amount of time. And next request will be fired immediately. If more than 3 requests are called in a second like this you will get 429.
You can either add ~300ms delay in between each request or add a retry mechanism if you are getting 429 to solve this issue.
but is it good practice ?
In .NET client session hook is invoked for every 403 errors which can be any other issue like invalid api_key(ForbiddenError in KiteConnect's context). We will change it to only invoke session hook when there is TokenException.