@Archana I have been testing my code for past few days again and I am not able to get OHLC data consistently for around 170 stocks. Here is my detailed observations:-Out of past 10-12 days, I got OHLC data only two times. Other times I got an error. I am posting screenshot of error message generated by code during execution today. Please see if this can help you to identify possible cause of error. (Please note that I have not changed my code at all during these days so most probably code is ok because it successfully fetched correct OHLC data for 2 days out of 10-12 days):-
Out of 2 days when code fetched OHLC data for first 5 minute candle successfully, one day (12-07-2018) it took around 130 seconds for fetching data for around 170 stocks one by one which is normal as code was taking approximately the similar time for generating 15/60 minute candles for last 2 months. Next day i.e. on 13-07-2018 same code took unusually longer time (approximately 9 minutes) to fetch the same data. But I was still satisfied because my code was able to fetch data somehow. Today the same code failed to fetch OHLC data of first five minute candle and code generated error message as posted above. But the same code (ran separately) generated OHLC data for first 15 minutes candle without any issue.
I am not able to resolve this issue. Your prompt suggestion on above issue will be highly appreciated. Please look into it asap.