For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
18 0 0 2

Debt Structure using Python

This question is related to:

https://community.developers.refinitiv.com/questions/85452/python-to-download-debt-structure-with-issuer-and.html?childToView=101534#answer-101534


I cannot create a script that works when following https://developers.refinitiv.com/en/article-catalog/article/debt-structure-analysis-on-an-organizational-level

Can you please provide a full script that gets the list of company's debt by maturity, currency and cost of debt (kd) MRFG3.SA similar to what is shown in Debt Structure? Thank you.

#technologypython api
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.

Upvotes
7.9k 10 6 9

@dianne.palmario So here is an API call using the latest Refinitiv Data (RD) Library:

import refinitiv.data as rd
rd.open_session()
rd.discovery.search(
    view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
    top=10000,
    filter = "ParentOAPermID eq '4295859830' and IsActive eq true and not(AssetStatus in ('MAT'))",
    select = "ISIN,MainSuperRIC,DBSTicker,IssueDate,Currency,RCSCurrencyLeaf,FaceIssuedTotal,EOMAmountOutstanding,NextCallDate,CouponRate,IsPerpetualSecurity,MaturityDate,CdsSeniorityEquivalentDescription"
)

This will produce a list of bonds satisfying the filter query.

1674578930468.png

Is this what you mean?



1674578930468.png (273.1 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.

Upvotes
18 0 0 2

@jason.ramchandani01 - thank you.


Can you change the script where the input would be the RIC MRFG3.SA instead of the ParentOAPermID?

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.

Upvotes
13.7k 61 39 63

Hi @dianne.palmario

I just updated the Jupyter Notebook to work with the latest libraries and should work. Could you try again? You didn't provide any details what specifically did not work - it may have been a result of outdated code..

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.

@nick.zincone The provided script above by @jason.ramchandani01 worked well on my end. However, what I need is a script where the input is the RIC MRFG3.SA and not the ParentOAPermID 4295859830


Please help and advise.

Upvotes
13.7k 61 39 63

Hi @dianne.palmario

>> Can you change the script where the input would be the RIC MRFG3.SA instead of the ParentOAPermID?

You can try the following instead

filter = "PrimaryRIC xeq 'MRFG3.SA'"
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 @nick.zincone - it is not returning result. Please check script.


import refinitiv.data as rd

rd.open_session()


rd.discovery.search(

view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,

top=10000,

filter = "PrimaryRIC xeq 'MRFG3.SA' and IsActive eq true and not(AssetStatus in ('MAT'))",

select = "ISIN,MainSuperRIC,DBSTicker,IssueDate,Currency,RCSCurrencyLeaf,FaceIssuedTotal,EOMAmountOutstanding,NextCallDate,CouponRate,IsPerpetualSecurity,MaturityDate,CdsSeniorityEquivalentDescription"

)

Hi @dianne.palmario ,

How about this?


df = rd.discovery.search(
    view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
    top=10000,
    query="MARFRIG GLOBAL",
    filter = "MaturityDate ge 2023-01-01 and IsActive eq true",  # can use "IsActive eq true and MaturityDate ge {datetime.now().strftime('%Y-%m-%d')}" wit `from datetime import datetime`
    select = str("ParentPortRIC,RicRoot,ParentPortRIC,PrimaryRIC,RIC,IsActive,MainSuperRIC,DBSTicker,IssueDate,Currency,RCSCurrencyLeaf," +
                 "FaceIssuedTotal,EOMAmountOutstanding,NextCallDate,CouponRate," +
                 "IsPerpetualSecurity,MaturityDate,CdsSeniorityEquivalentDescription"))
df

1674810618504.png

1674810618504.png (110.7 KiB)
Upvotes
13.7k 61 39 63

Hi @dianne.palmario

You are correct. I was not testing against the GOV_CORP_INSTRUMENTS View.

As it turns out, it does not appear this specific View is keyed off of the RIC: MRFGT.SA. There may be an indirect route to derive a related RIC, but that would require a content expert to be involved to define that relationship. Regardless, there is some conversion that is required.

That being said, I was able to provide a 2-step way to get the data based on the RIC MRFGT.SA.

import refinitiv.data as rd
from refinitiv.data.discovery import search_templates as st

...

ric = "MRFG3.SA"

rd.discovery.search(
    view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
    filter = f"ParentOAPermID eq '{st.RICToIssuer.search(ric='MRFG3.SA').loc[0, 'IssuerOAPermID']}' and \
               IsActive eq true and not(AssetStatus in ('MAT'))",
    select = "ISIN, MainSuperRIC, DBSTicker, IssueDate, Currency, RCSCurrencyLeaf, FaceIssuedTotal, \
              EOMAmountOutstanding, NextCallDate, CouponRate, IsPerpetualSecurity, MaturityDate, \
              CdsSeniorityEquivalentDescription"
)

ahs.png


ahs.png (91.7 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.