question

Upvotes
Accepted
20 0 1 6

Python Library to make rd.discovery.search run/work

Hello, I would like to replicate this query for bonds within a Jupyter notebook using our API key. Can you please guide me on how i could do so?

rd.discovery.search(
view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
top = 10,
filter = "(DbType eq 'CORP' and RCSAssetCategory eq 'A:1A' and IsActive eq true and (RCSBondGradeLeaf eq '"Investment Grade"' or RCSBondGradeLeaf eq '"High Yield"' or RCSBondGradeLeaf ne '"Investment Grade"' and RCSBondGradeLeaf ne '"High Yield"') and (InstrumentTypeDescription xeq 'Commercial Paper' and RCSCurrencyLeaf eq 'US Dollar' and IndustrySubSectorDescription in ('Utility - Other' 'Oil and Gas' 'Oilfield Machinery and Services' 'Gas Utility - Pipelines' 'Service - Other' 'Pharmaceuticals' 'Cable/Media' 'Retail Stores - Food/Drug' 'Health Care Facilities' 'Retail Stores - Other' 'Health Care Supply' 'Lodging' 'Leisure' 'Restaurants' 'Electronics' 'Chemicals' 'Machinery' 'Conglomerate/Diversified Mfg' 'Industrials - Other' 'Information/Data Technology' 'Vehicle Parts' 'Containers' 'Aerospace' 'Building Products' 'Textiles/Apparel/Shoes' 'Automotive Manufacturer' 'Food Processors' 'Beverage/Bottling' 'Consumer Products' 'Gas Utility - Local Distrib' 'Telecommunications' 'Railroads' 'Transportation - Other' 'Publishing' 'Tobacco') and ((RatingsScope(RatingType eq 'MCP' and CurrentRatingRank ge 1 and CurrentRatingRank le 98)) or (RatingsScope(RatingType eq 'FCP' and CurrentRatingRank ge 1 and CurrentRatingRank le 8)))))",
select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,DescriptionDetail,IsExecutableQuoted,FaceIssuedTotal,RCSCurrencyLeaf,RCSCountryLeaf,DbTypeDescription,FaceOutstanding,WorstStandardYield,MaturityStandardYield,OptionAdjustedSpread,RCSDomicileLeaf,IndustrySubSectorDescription,RCSConvertibleLeaf,IsCallable,IsPutable,IsSinkable,BorrowerName,IsActive,InstrumentTypeDescription,IsPayInKind,RCSBondGradeLeaf,RCSCouponTypeGenealogy,CUSIP,IsPerpetualSecurity,IssuePrice,RatingsScope(filter:((RatingType xeq 'MCP') or (RatingType xeq 'FCP'))),RatingX1XRatingRank",
order_by = "IndustrySubSectorDescription,InstrumentTypeDescription"
)

rd.discovery.search(
view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
top = 10,
filter = "(DbType eq 'CORP' and IsActive eq true and ((MaturityDate ge 2025-08-23 and MaturityDate le 2042-08-23) and RCSCurrency eq 'C:6' and DbTypeDescription xeq 'Corporate' and MaturityStandardYield gt 0.0000000 and IsExecutableQuoted eq true and IsPutable eq false and IsSinkable eq false and IsCallable eq false and ((RatingsScope(RatingType eq 'MDY' and CurrentRatingRank ge 4 and CurrentRatingRank le 19 and Preliminary eq 'n')) or (RatingsScope(RatingType eq 'FTC' and CurrentRatingRank ge 5 and CurrentRatingRank le 20 and Preliminary eq 'n')))))",
select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,DescriptionDetail,IsExecutableQuoted,FaceIssuedTotal,RCSCurrencyLeaf,RCSCountryLeaf,RCSDomicileLeaf,DbTypeDescription,FaceOutstanding,WorstStandardYield,MaturityStandardYield,OptionAdjustedSpread,IndustrySubSectorDescription,RCSConvertibleLeaf,IsCallable,IsPutable,IsSinkable,BorrowerName,IsActive,InstrumentTypeDescription,IsPayInKind,RCSBondGradeLeaf,RCSCouponTypeGenealogy,CUSIP,IsPerpetualSecurity,IssuePrice,RatingsScope(filter:((RatingType xeq 'MDY') or (RatingType xeq 'MDY.Actual') or (RatingType xeq 'FTC.Actual') or (RatingType xeq 'MDY.Outlook') or (RatingType xeq 'FTC.Outlook') or (RatingType xeq 'MDY.Watch') or (RatingType xeq 'FTC') or (RatingType xeq 'FTC.Watch') or (RatingType xeq 'MDY' and Preliminary xeq 'n') or (RatingType xeq 'FTC' and Preliminary xeq 'n'))),RatingX1XRatingRank,RCSCurrency"

)

I want to access these search results through a Jupyter notebook using our API

python#technologyrefinitiv-data-platform-librariesrdp search
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @dianne.palmario

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,
AHS

1 Answer

· Write an Answer
Upvotes
Accepted
79.2k 251 52 74

@dianne.palmario

Thanks for reaching out to us.

The product is Refinitiv Data Library for Python and the examples are available on GitHub. To use the search feature, you can refer to the EX-1.01.05-Search.ipynb example.

In the refinitiv-data.config.json configuration file, you need to use the desktop.workspace session with your application key.

1668745752324.png


I can run the code properly after removing double quote characters in the filter string.

rd.discovery.search(
view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
top = 10,
filter = "(DbType eq 'CORP' and RCSAssetCategory eq 'A:1A' and IsActive eq true and (RCSBondGradeLeaf eq 'Investment Grade' or RCSBondGradeLeaf eq 'High Yield' or RCSBondGradeLeaf ne 'Investment Grade' and RCSBondGradeLeaf ne 'High Yield') and (InstrumentTypeDescription xeq 'Commercial Paper' and RCSCurrencyLeaf eq 'US Dollar' and IndustrySubSectorDescription in ('Utility - Other' 'Oil and Gas' 'Oilfield Machinery and Services' 'Gas Utility - Pipelines' 'Service - Other' 'Pharmaceuticals' 'Cable/Media' 'Retail Stores - Food/Drug' 'Health Care Facilities' 'Retail Stores - Other' 'Health Care Supply' 'Lodging' 'Leisure' 'Restaurants' 'Electronics' 'Chemicals' 'Machinery' 'Conglomerate/Diversified Mfg' 'Industrials - Other' 'Information/Data Technology' 'Vehicle Parts' 'Containers' 'Aerospace' 'Building Products' 'Textiles/Apparel/Shoes' 'Automotive Manufacturer' 'Food Processors' 'Beverage/Bottling' 'Consumer Products' 'Gas Utility - Local Distrib' 'Telecommunications' 'Railroads' 'Transportation - Other' 'Publishing' 'Tobacco') and ((RatingsScope(RatingType eq 'MCP' and CurrentRatingRank ge 1 and CurrentRatingRank le 98)) or (RatingsScope(RatingType eq 'FCP' and CurrentRatingRank ge 1 and CurrentRatingRank le 8)))))",
select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,DescriptionDetail,IsExecutableQuoted,FaceIssuedTotal,RCSCurrencyLeaf,RCSCountryLeaf,DbTypeDescription,FaceOutstanding,WorstStandardYield,MaturityStandardYield,OptionAdjustedSpread,RCSDomicileLeaf,IndustrySubSectorDescription,RCSConvertibleLeaf,IsCallable,IsPutable,IsSinkable,BorrowerName,IsActive,InstrumentTypeDescription,IsPayInKind,RCSBondGradeLeaf,RCSCouponTypeGenealogy,CUSIP,IsPerpetualSecurity,IssuePrice,RatingsScope(filter:((RatingType xeq 'MCP') or (RatingType xeq 'FCP'))),RatingX1XRatingRank",
order_by = "IndustrySubSectorDescription,InstrumentTypeDescription"
)

1668745405441.png



1668745752324.png (30.0 KiB)
1668745405441.png (47.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.