How to retrieve a history of yields for each day over the past month for all bonds with currency CHF
Hello,
I'm trying to use the Python Refinitive Data Library via CodeBook in order to retrieve the history of yields for each day over the past month for each bond with currency CHF and exchange SIX.
As a first step I was trying to use the following query as an input to the `universe` parameter of the `get_data()` function:
rd.discovery.search(
view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
filter = "((DbType eq 'GOVT' or DbType eq 'CORP' or DbType eq 'AGNC' or DbType eq 'OMUN' or DbType eq 'OTHR') and IsActive eq true and (RCSCurrencyLeaf eq 'Swiss Franc' and SukukExchangeName xeq 'SIX SWISS EXCHANGE'))",
select = "ISIN"
)
... but then the output of `get_data()` is empty, no matter which `fields`I select.
Could you point me in the right direction how to achieve this? Also, it's not entirely clear to me how to further parametrize the `get_data()` function in order to retrieve the historical yields.
Any help is very much appreciated. Thanks in advance!
Best Answer
-
Hi @agnes.mallinger ,
Thank you for your question. I believe you are on the right direction. The only thing is to note rd.get_data or get_history (which I would advise using in your case) requires RIC universe as in put not the ISIN. So the first step is to modify your Search query to select RIC:
rics_df = rd.discovery.search(
view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
filter = "((DbType eq 'GOVT' or DbType eq 'CORP' or DbType eq 'AGNC' or DbType eq 'OMUN' or DbType eq 'OTHR') and IsActive eq true and (RCSCurrencyLeaf eq 'Swiss Franc' and SukukExchangeName xeq 'SIX SWISS EXCHANGE'))",
select = "ISIN, RIC"
)Then you can retrieve the pics to a list and pass it to get_history function:
rics = rics_df['RIC'].to_list()
df = rd.get_history(rics)
dfAnd from here you can modify the get_history function to request for a specific fields and dates.
Hope this helps.
Best regards,
Haykaz
0
Answers
-
Hi Haykaz,
Thank you so much for your answer! This indeed does what I wanted. Just one follow-up question:
In the "Bond Search" explorer (available at this link), there is a field called "Yield to Maturity" which I cannot seem to find within the data retrieved vie `get_history()`. Therefore I wanted to ask, which of the available historical fields matches the "Yield to Maturity" (at any fixed point each day) the closest?
Thank you very much again!!
0 -
Hi @agnes.mallinger ,
Happy to hear that it worked for you. As for your follow up question, I am afraid I will not be able to provide much help as it is a content related query and we don't have the complete knowledge on the content. The best place to ask is our Helpdesk which can be reached via MyRefinitiv. Then the support team will contact you directly to assist with this.
Best regards,
Haykaz
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
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛