I have a routine that has been running fine for several months but now fails if I pass yesterdays date as a parameter, but if I pass the prior sessions date it works fine.
It seems that the data is not prepared for yesterday's session yet. Usually it runs successfully in the mid evening for New York and Toronto. Sometimes we need to wait, but it is always ready in the morning.
C:\PNC\Stats\Python>python.exe GetHighsLows.py High XNYS 20220418 -> FAILS
C:\PNC\Stats\Python>python.exe GetHighsLows.py High XNYS 20220414 ->SUCCEEDS
In ther traceback below, it suggests the header is not being found in yesterday's data.
Any ideas?
C:\PNC\Stats\Python>python.exe GetHighsLows.py High XNYS 20220418
Traceback (most recent call last):
File "C:\PNC\Stats\Python\GetHighsLows.py", line 13, in <module>
df, err = ek.get_data(instrument,['TR.CommonName','TR.PRICECLOSE'])
File "C:\Users\PC3\AppData\Local\Programs\Python\Python39\lib\site-packages\refinitiv\dataplatform\legacy\data_grid.py", line 224, in get_data
return get_data_frame(result, field_name)
File "C:\Users\PC3\AppData\Local\Programs\Python\Python39\lib\site-packages\refinitiv\dataplatform\legacy\data_grid.py", line 278, in get_data_frame
headers = [header["displayName"] for header in data_dict["headers"][0]]
KeyError: 'headers'
C:\Users\PC3\AppData\Local\Programs\Python\Python39\lib\site-packages\httpx\_client.py:2012: UserWarning: Unclosed <httpx.AsyncClient object at 0x000002814ED6A280>. See https://www.python-httpx.org/async/#opening-and-closing-clients for details.