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
Best Answer
-
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.
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"
)0
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 中文论坛