question

Upvotes
3 0 0 3

How can I use the result of first code as universe for the second set of codes in python API?

For example

=@TR(TR(TR(M20,"TR.FiIssuerOrganization","CODE:ISIN"),"TR.CreditRatioPD")

This one retrieves first the issuer organization id from the ISIN of the bond

Then after getting the organization ID, it gets the default probability. All in one go.

So the formula has 2 layers, one for getting org id, then another for getting def prob.

So would you know a way in python, where we can use the result of the first set of codes as the universe of the second?

eikon-data-apiworkspace-data-api#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.

1 Answer

· Write an Answer
Upvotes
85k 289 53 77

@johnnavi.quinones

Thank you for reaching out to us.

The TR Excel function is similar to the get_data method in the LSEG Data Library for Python. You can refer to the examples on GitHub.

You can use the output of the first call as an input of the second call. For example:

df = ld.get_data(universe = ['US449276AA20'], 
            fields = ['TR.FiParentIssuerOrganization'])


df1 = ld.get_data(
    universe=df["Parent Issuer Organization"].to_list(),
    fields=['TR.CreditRatioPD','TR.CommonName'])


df1

1725527946346.png



1725527946346.png (18.6 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.

Thanks!

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.