Last update: June 2024
Have you ever had a workflow that requires searching for any content that matches your criteria?
For example,
The search criteria for Kungfu bonds, or Chinese-issued U.S. dollar bonds are dollar-denominated bonds issued by Chinese financial institutions and corporations.:
1 ) Parent Domicile includes China (Mainland), Hong Kong
2 ) Principal Currency includes USD
3 ) Country of Issue excludes China
This article is going to show you how to:
1 ) Use the "Advanced Search" app on Eikon/Workspace desktop to define a search criteria
2 ) Export the query for the specific search as a Python Code for RD Library for Python - search function
Advanced Search Application
Advanced Search - Government and Corporate Bonds App is an application available in Eikon Desktop/ Refinitiv Workspace app. It allows discovering any instruments that match the criteria specified in the app, available filters are listed below
Field | Note/Example of available value |
---|---|
Universe |
|
Search |
|
Filters | To put the criteria of
|
After the search criteria are applied, you can save them for the future use, add/remove columns of the search results, and export the result as a CSV file, or export the search criteria as a Python code to be used with RD Library as demonstrated in this article.
To launch the application, type in "Advanced Search" or "AS" on Eikon/Workspace search bar and press enter
Advanced Search app is going to be launched, here's a screenshot of the app
1 ) Apply filters on the app, in this article, I'm going to search for Kungfu bonds, or Chinese-issued U.S. dollars bonds, which are dollar-denominated bonds issued by Chinese financial institutions and corporations, with the criteria below
1a) Parent Domicile includes China (Mainland), Hong Kong
1b) Principal Currency includes USD
1c) Country of Issue excludes China
2) Now the search results are Kungfu bonds based on the filters applied, these results can be exported to a CSV file or exported as a query, which is focused on this article.
To export the query, click the dropdown at the top right (number 2 in the screenshot below) and select Export Query
Here’s the screenshot of Advanced Search app with the filters applied
The Export query window will pop up, click the CODEBOOK tab to get the Python code, select the layer to be used (Access Layer is selected here) then click Copy.
2-types of layers are described below
- The Access Layer is the easiest way to get Refinitiv data. It provides simple interfaces allowing you to quickly prototype solutions in interactive environments such as Jupyter Notebooks.
- The Content Layer is the foundation of the Access Layer. It provides developers with interfaces suitable for more advanced use cases (synchronous function calls, async/await, event driven).
Here's the code we get,
- The properties under select parameter can be adjusted to be the properties needed for an analysis
- Number in top parameter can be updated to get more results of the bonds
rd.discovery.search(
view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
top = 10,
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 (RCSParentDomicileGenealogy in ('G:53' 'G:3H') and RCSCurrencyLeaf eq 'US Dollar' and RCSCountryGenealogy ne 'M:DQ\G:B6'))",
select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,RCSCurrencyLeaf,RCSCountryLeaf,DbTypeDescription,InstrumentTypeDescription,RCSCouponTypeGenealogy,FaceIssuedUSD,RCSBondGradeLeaf,RCSParentDomicileLeaf,RCSParentDomicileGenealogy,RCSCountryGenealogy"
)
An example code of RD Library for Python usage is available in the CODEBOOK app or you can follow EX-1.01.06-Search.ipynb in RD Library - Tutorial and for more detail regarding Search function can be found in these articles:
- Building Search into your Application Workflow
- Build queries easily using Refinitiv's Search API with Python and Jupyter
Please note that the Eikon Desktop or Workspace app needed to be running to be able to open the Desktop Session of the RD library, check the RD Library quick start guide for more detail on this.
Here's the Search function code for Access Layer and its output
import refinitiv.data as rd
rd.open_session()
df = rd.discovery.search(
view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
top = 10,
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 (RCSParentDomicileGenealogy in ('G:53' 'G:3H') and RCSCurrency in ('C:6') and RCSCountryGenealogy ne 'M:DH\G:K\G:S\G:6\G:53'))",
select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,RCSCurrencyLeaf,RCSCountryLeaf,DbTypeDescription,InstrumentTypeDescription,RCSCouponTypeGenealogy,FaceIssuedUSD,RCSBondGradeLeaf,RCSParentDomicileLeaf,RCSParentDomicileGenealogy,RCSCurrency,RCSCountryGenealogy"
)
display(df)
Here's the Search function code for Content Layer (its output response.data.df is the same as assess layer above)
import refinitiv.data as rd
from refinitiv.data.content import search
rd.open_session()
response = search.Definition(
view = search.Views.GOV_CORP_INSTRUMENTS,
top = 10,
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 (RCSParentDomicileGenealogy in ('G:53' 'G:3H') and RCSCurrency in ('C:6') and RCSCountryGenealogy ne 'M:DH\G:K\G:S\G:6\G:53'))",
select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,RCSCurrencyLeaf,RCSCountryLeaf,DbTypeDescription,InstrumentTypeDescription,RCSCouponTypeGenealogy,FaceIssuedUSD,RCSBondGradeLeaf,RCSParentDomicileLeaf,RCSParentDomicileGenealogy,RCSCurrency,RCSCountryGenealogy"
).get_data()
response.data.df
Conclusion
With this functionality of Eikon Advanced Search, the search query code can be generated within just a few clicks then the code is ready to be integrated into your workflow. I hope you enjoy this article and that it helps you in discovering what you're looking for.
If you have any questions regarding an API usage. Please feel free to leave it in the Q&A Forum (Developer Community). We're more than happy to help!
- Register or Log in to applaud this article
- Let the author know how much this article helped you