Hi Gurpreet.
After posting a thread the button to edit dissapears after a few minutes and there is no button to answer, so in practice the thread is closed and I can't answer anywhere to your comments. That is why I open a new thread with my code. In case it is possible to answer a thread, Can you tell me how?
The file 2acciones simply contains one column with ACCIONES in the first cell and all the RICS of an exchange below. I tried .SPX and others but all crashed below 200 stocks. I was not able to download the S&P 500 for example.
(edit: I got two different errors, I upload the error messages)
I add the error code, apparently the RIC giving problems was ISX.AX:
2020-04-22 20:46:41,379 P[15208] [MainThread 18380] Error with ISX.AX: No data available for the requested date range 2020-04-22 20:46:41,379 P[15208] [MainThread 18380] ISX.AX: No data available for the requested date range | Traceback (most recent call last): File "C:/ES.py", line 17, in <module> resultado = ek.get_timeseries(j, start_date = fecha_inicio, end_date = fecha_fin, interval="minute",fields= ["HIGH", "LOW", "OPEN", "CLOSE", "VOLUME"] ) File "C:\User ikon\time_series.py", line 198, in get_timeseries raise EikonError(-1, message=ts_error_messages) eikon.eikonError.EikonError: Error code -1 | ISX.AX: No data available for the requested date range |
I get a different error, I add here what I get, no idea what this error is:
Traceback (most recent call last): File "C:/Users RENTES.py", line 22, in <module> resultado.to_csv (filename, index = True, header=True, decimal=',') File "C:\Users\ pandas\core\generic.py", line 3228, in to_csv formatter.save() File "C:\Useges\pandas\io\formats\csvs.py", line 183, in save compression=self.compression, File "C:\Users\santi\PycharmProjects\oanda\venv\lib\site-packages\pandas\io\common.py", line 399, in _get_handle f = open(path_or_buf, mode, encoding=encoding, newline="") FileNotFoundError: [Errno 2] No such file or directory: 'C:\\ api\\PRN.AXresultado.csv'
This is the code I use to download the info:
import eikon as ek import time ek.set_app_key('some number") a = pd.read_csv("2acciones.csv") lista = a['ACCIONES'].to_list() for j in lista: fecha_inicio = "2020-02-23" fecha_fin = "2020-04-20" resultado = ek.get_timeseries(j, start_date = fecha_inicio, end_date = fecha_fin, interval="minute",fields= ["HIGH", "LOW", "OPEN", "CLOSE", "VOLUME"] ) filename = (r"C:\ some direction api\{}resultado.csv".format(j)) print (resultado) resultado.to_csv (filename, index = True, header=True, decimal=',') time.sleep(1)