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.
0
Answers
-
hi @LRE42 ,
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.
0 -
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 616 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 653 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛