Error Message "Shape of passed values is (24, 2), indices imply (22, 2)" .
Hi, I want to get timeseries data for a list of 300 rics. I found some rics in the list return error message as mentioned in the question. For example, 'USD1MD=EU', 'USD1MD=EQBK'. If I get the timeseries for each Ric individually, each ric works. But if I put both rics together in a list, they return error message. I know the length of the data returned from the two Rics are different. Is there a solution to get the data with 1 single list of all the rics? I want to get the same timeseries data with a list of 300 rics.
Below is the data I want to get and it didn't work.
data_both = ek.get_timeseries(['USD1MD=EU', 'USD1MD=EQBK'],start_date='2021-01-01',end_date='2021-01-31',fields='CLOSE')
Below is what I used to get the data individually and it works perfectly for each ric
data_individual = ek.get_timeseries(['USD1MD=EQBK'],start_date='2021-01-01',end_date='2021-01-31',fields='CLOSE')
Best Answer
-
The specialist updates the ticket 09661076 as the following:
The problem you are encountering is related to the different shapes of the resulting dataframes. This is one of the limitations of the method, ek.get_timeseries, therefore normally I would advise going with the ek.get_data() method, BUT for this specific example, we have an issue with USD1MD=EQBK, which lacks the correct TR fields. The syntax for the second instrument will look like this:df,err = ek.get_data(instruments = ['USD1MD='], fields = ['TR.BIDPRICE', 'TR.BIDPRICE.date'], parameters = {'SDate':'20210101', 'EDate':'20210225'})
dfBut for your problem, I figured out a workaround. It requires some work on adjusting the time series, but the result looks ok.
Try this code:
first = ek.get_timeseries(['USD1MD=EQBK'], start_date='2021-01-01', end_date='2021-01-31', fields='CLOSE', raw_output=False)
second = ek.get_timeseries(['USD1MD=EU'], start_date='2021-01-01', end_date='2021-01-31', fields='CLOSE', raw_output=False)
first = first.reset_index()
first['Date'] = first['Date'].drop_duplicates()
first = first.dropna()
first = first.set_index('Date')
first = first.asfreq('D',method = 'bfill')
second = second.asfreq('D', method = 'bfill')
combined = pd.merge(first, second)
combined0
Answers
-
Hi @anni.wang
I submitted ticket no. 09661076 on your behalf.
A support team will contact you about the issue.
These 2 codes work fine:
But when combining the instruments, the API could not handle the returning data.
(The request is valid, API receives response from the backend)
0 -
Hi, since I need to do a 1000 rics, the above code didn't work but you have pointed out the problem. I built a For loop to get the data one at a time for each Ric. However, I had some new issues. A lot of the rics not returning data. However if I search the rics in reuters, they do come up with data. For example USD1MD=UBTA, USD1MD=HVBG return error messages. Some rics do work well in the code below. For example USD1MD=LOYL, USD1MD=VBAH work well
See my code below and error message below.
The ContributorRics ['1M'] includes the rics mentioned above and the ones shown in the error message below.
code:
---------------------------------------------------------------------------
ric_dict=dict()
for ric in ContributorRics['1M']:
try:
data_sr = ek.get_timeseries(ric,start_date='2021-02-01',end_date='2021-03-2',fields='CLOSE').squeeze()
data_sr = data_sr.drop_duplicates()
ric_dict[ric]=data_df
except:
print(ric)
print("Unexpected error:", sys.exc_info()[0])
continue
------------------------------------------------------------------------------------------
Below is the list of Rics that returns errors: USD1MD=UBTA, USD1MD=HVBG etc
USD1MD=BOGF Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=UBTA Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=LBWX Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=HVBG Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=BERA Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=NDEA Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=DGZF Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=BILX Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=BUMZ Unexpected error: <class 'AttributeError'> USD1MD=FBIT Unexpected error: <class 'AttributeError'> USD1MD=BIIA Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=SCNN Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=STKN Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=SCGH Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=SCCI Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=VIBD Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=SCGM Unexpected error: <class 'eikon.eikonError.EikonError'> USD1MD=NXIP Unexpected error: <class 'AttributeError'> USD1MD=ALFT Unexpected error: <class 'AttributeError'> USD1MD=ACLB Unexpected error: <class 'eikon.eikonError.EikonError'> EUR1MD=BOGF Unexpected error: <class 'eikon.eikonError.EikonError'> EUR1MD=VBAH Unexpected error: <class 'eikon.eikonError.EikonError'> EUR1MD=KBCB Unexpected error: <class 'eikon.eikonError.EikonError'>
0 -
Hi @anni.wang
I saw that Zoya already pointed out the issue with invalid RIC or other error at https://community.developers.refinitiv.com/questions/74268/error-message-for-some-rics-but-not-the-others.html
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
- 370 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 中文论坛