unable to successfully pull time series for US BMK
Hello - I want to pull a historic yield time series for at least US10YT=RR, but I'd like to include other RICs too (for instance US1YT=RR). I've tried many variations of the following and I can't successfully pull any yields. Should I prefer get_data to get_timeseries? Does it matter if I want to pull for more than one RIC? Here are examples of my failing codes. The equivalent codes in Excel do pull data.
import eikon as ek
ek.set_app_key('xxx')
df1, err = ek.get_data('US10YT=RR', 'B_YLD_1', {'SDate':'2020-01-01','Frq':'D','EDate':'2022-01-31'})
print(df1)
df2, err = ek.get_timeseries('US10YT=RR', 'B_YLD_1', start_date='2020-01-01', end_date='2022-01-31')
print(df2)
Best Answer
-
The get_timeseries method support the 'TIMESTAMP', 'VALUE', 'VOLUME', 'HIGH', 'LOW', 'OPEN', 'CLOSE', 'COUNT' fields. Therefore, the code looks like this.
df2 = ek.get_timeseries('US10YT=RR', start_date='2020-01-01', end_date='2022-01-31')
df2You can also use the get_data method with the TR.BIDYIELD field, as shown below.
df1, err = ek.get_data('US10YT=RR', ['TR.BIDYIELD','TR.BIDYIELD.Date'],
{'SDate':'2020-01-01','Frq':'D','EDate':'2022-01-31'})
df1The output is:
You can use the Data Item Browser tool to find available fields which can be used with the get_data method. For more information, please refer to this video.
1
Answers
-
hi @ELLing ,
First of all, the ek.get_timeseries function only returns a dataframe so the code should be like this instead (remove assigning the output to err variable for get_timeseries function)
df2 = ek.get_timeseries('US10YT=RR', 'B_YLD_1', start_date='2020-01-01', end_date='2022-01-31')
Next, printing an error from ek.get_data function shows that the field used (B_YLD_1) was not found in response for this instrument, which is a content-related issue that it's recommended to ask the content specialist by raising a ticket via MyRefinitiv
However, I'll try to find the proper function/field to be used here so, could you please provide the Excel formula that you used?
0 -
Hi Raksina,
thank you for your response. If we can fix the field, will I be able to get data for more than one RIC at the same time with the same call? Also, for time series, should I prefer get_data or get_timeseries?
The formula in Excel that works is below:
=RDP.HistoricalPricing("US10YT=RR","B_YLD_1","START:02-Jan-2022 END:23-May-2022 INTERVAL:P1D SOURCE:RFV",,"CH:Fd RH:Timestamp",B2)
0 -
Hi @LRE42 ,
In addition to my colleague's reply, I
would recommend you look at the newer RD Library for Python - which is currently in Beta and
due for release in the coming months.It will also have fuller
documentation - I have been advised by the RD Library team that they are
awaiting the completion of the documentation to confirm the release date.import refinitiv.data as rd
rd.open_session()
rd.get_history(universe="US10YT=RR", fields="B_YLD_1", interval="1D", start="2022-01-02", end="2022-05-23")I've compared the output with your Excel formula and the result are matched
Please let me know in case you have any further questions
0 -
Thank you, all. This is helpful. @raksina.samasiri, is there a refinitiv.data equivalent for get_data for this same RIC and field?
0 -
Hi @LRE42
There are a number of GitHub examples demonstrating the functionality within the Refinitiv Data Library for Python. In there, you can see examples related to get_data.
1 -
this was also helpful - thanks0
Categories
- All Categories
- 6 AHS
- 37 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
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛