Hello Team, client needs a python script that would aggregate the Amount Outstanding based on Issue Rating for all US Municipal Bonds using python.
We have this script but it is limited to 10,000 rows and the total result is 992,151.
import refinitiv.data as rd
rd.open_session()
rd.discovery.search(
view = rd.discovery.Views.MUNICIPAL_INSTRUMENTS,
top = 10000,
filter = "(IsActive eq true and SearchAllCategoryv2 eq 'US Municipal Bonds')",
select = "LongName,Ticker,CouponRate,MaturityDate,CUSIP,RIC,MuniStateDescription,CouponClassDescription,EJVAssetID,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,IssueDate,BankQualified,BondInsuranceDescription,IsCallable,IsPutable,IsSinkable,FaceOutstanding"
)
After getting all the results, she would like to aggregate the Amount Outstanding per Issue Rating. She is looking to achieve
1) US Muni bond with Moody's rating Aaa = X amount outstanding
US Muni bond with Moody's rating Aa = Y amount outstanding
US Muni bond with Moody's rating Baa = Z amount outstanding ........ and for all Moody's ratings
2) All US Muni Bonds = DDD amount outstanding (doesn't matter if it was rated by Moody's or is missing any rating )