Failed returns on get_data
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.
Best Answer
-
Hi @dgarrard,
I believe that this is a content-related question. The API is behaving as expected - I tested it myself.
The best resource for content questions is the Refinitiv Helpdesk, which can be reached by either calling the Helpdesk number in your country or submitting a new ticket to the support team via MyRefinitiv.
0
Answers
-
Here is the script:
import sys
import refinitiv.dataplatform.eikon as ek
import pandas
ek.set_app_key()
DataSwitch_T = sys.argv[1] # High, Low
Exch_T = sys.argv[2] # XNYS, XTSE
Date_T = sys.argv[3] # 20211203
# EIKON QUERY
instrument = "SCREEN(U(IN(Equity(active,public,primary,countryprimaryquote))),IN(TR.ExchangeMarketIdCode,'" + Exch_T + "'),BETWEEN(TR.Price52Week"+DataSwitch_T+"Date," + Date_T + "," + Date_T + "))"
df, err = ek.get_data(instrument,['TR.CommonName','TR.PRICECLOSE'])
file1 = open('C:\PNC\Logs\MIA_'+DataSwitch_T+'_'+Exch_T+'_'+ Date_T +'.txt', 'w')
df.to_csv(file1, index=False)
file1.close()
new_df = pandas.read_csv('C:\PNC\Logs\MIA_'+DataSwitch_T+'_'+Exch_T+'_'+ Date_T +'.txt')
print('~Beginning of Data\n')
print(new_df)
print('\n~End of Data')0 -
This was an Eikon service (not specifically API) outage which lasted for about 4 days. It has since come back on line.
1 -
Thank you for the feedback. It is very much appreciated.0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛