How to get all bonds issued by companies in an index, e.g. 0#.GDAXHI using python?

How to get all bonds issued by companies in an index, e.g. 0#.GDAXHI using python?

Is there a way we can list down all constituent RICs under 0#.GDAXHI, then use the result in rd.discovery.search > rd.discovery.Views.GOV_CORP_INSTRUMENTS to retrieve all the bonds issued?

Answers

  • Hi @dianne.palmario ,


    To list all the constituents you can use the following code:

    constituents = rd.get_data("0#.GDAXHI", 'TR.OrgidCode')
    constituents 

    screenshot-2024-10-25-at-100128.png

    As you probably noticed I have additionally requested Issuer OrgID which is going to be used under search:

    issuer_org_ids = ' '.join(f"'{org_id}'" for org_id in constituents['ORG ID'])
    rd.discovery.search(
    view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
    top = 10000,
    filter = f"(DbType eq 'CORP' and IsActive eq true and IssuerOrgid in ({issuer_org_ids}))",
    select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,RCSCurrencyLeaf,RCSCountryLeaf,DbTypeDescription,InstrumentTypeDescription,RCSCouponTypeGenealogy,FaceIssuedUSD,RCSBondGradeLeaf,IssuerOrgid"
    )


    screenshot-2024-10-25-at-100241.png

    Hope this helps.


    Best regards,

    Haykaz


  • @aramyan.h thank you for your response. Can you please assist with client follow up below:

    "Can you modify the query such that I download bonds issued by the HDAX100 constituents and their subsidiaries? Additionally, I am only interested in Corporate Bonds (Notes, Bonds, Bills) issued from 2013 until 2024. Can you add these features into the code? "

  • Hi @John.Cajayon ,


    I am not sure we have an api query to get subsidiaries. Where do you see that info on Workspace? if you direct me to that, I may be able to find something. Alternatively, if you know the orgids of those subsidiaries, it can be added into issuer_org_ids variable.

    As for the dates, you can use the following modified search request:

    issuer_org_ids = ' '.join(f"'{org_id}'" for org_id in constituents['ORG ID'])
    rd.discovery.search(
    view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
    top = 10000,
    filter = f"(DbType eq 'CORP' and IsActive eq true and (IssuerOrgid in ({issuer_org_ids})) and (IssueDate ge 2013-01-01 and IssueDate le 2024-01-01))",
    select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,SearchAllCategoryv3,SearchAllCategoryv2,SearchAllCategory,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,RCSCurrencyLeaf,RCSCountryLeaf,DbTypeDescription,InstrumentTypeDescription,RCSCouponTypeGenealogy,FaceIssuedUSD,RCSBondGradeLeaf,IssuerOrgid"
    )

    Additionally for building search queries you can use the Advanced Search app in Worksppace, build your query and Export the code as shown below:

    screenshot-2024-10-28-at-101820.png


    Hope this helps.


    Best regards,

    Haykaz

  • John.Cajayon
    edited November 2024

    Hello @aramyan.h

    To retrieve the Level - 1 subsidiaries (along with Joint Ventures and Affiliates), we have these data items:

    • TR.ImmediateParent

    • TR.RelatedOrgId

    • TR.RelatedOrgName

    • TR.RelatedOrgType

    • TR.RelatedOwnPct

    • TR.RelatedOrgISO2

    • TR.RelatedOrgCountry


    Here is a sample formula in Excel:

    =@RDP.Data("ENGP.WA","TR.RelatedOrgId;TR.RelatedOrgName;TR.RelatedOrgType;TR.RelatedOwnPct;TR.RelatedOrgISO2;TR.RelatedOrgCountry","CH=Fd RH=IN",B2)

    Here is a related article on how to get the parent company and subsidiary in Workspace.

    This information can also be accessed via the TREE App on LSEG Workspace desktop.

  • Hi @John.Cajayon ,


    Thanks for sharing this. The equivalent code for RD Libraries is going to be the following:

    rd.get_data("ENGP.WA",fields = ["TR.RelatedOrgId", "TR.RelatedOrgName", "TR.RelatedOrgType", "TR.RelatedOwnPct", "TR.RelatedOrgISO2", "TR.RelatedOrgCountry"])

    screenshot-2024-10-29-at-132303.png

    So, the orgids from here can be used in the search query I have above.


    Best regards,

    Haykaz