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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
21 2 3 4

TR(Universe=’0#USTSY’)

I want to translate a excel function TR(Universe=’0#USTSY’) in python. How should I do it?

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
39.2k 75 11 27

There appears to be an error in the Excel function syntax you provided. Assuming what you're looking to do is to retrieve the constituents of 0#USTSY= chain, which is what =TR("0#USTSY=") function returns, then you can use for instance

ek.get_data('0#USTSY=',['DSPLY_NAME'])

The field name DSPLY_NAME in the above is arbitrary. It can be replaced or appended by any other field available in the real-time record for the constituents of 0#USTSY= chain, e.g.

ek.get_data('0#USTSY=',['DSPLY_NAME','PRIMACT_1','SEC_ACT_1'])
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Thanks. It is very helpful. The output instrument ticker is same as ID_CUSIP from Bloomberg, right? Can I get corresponding Bloomberg ticker and following Bloomberg field: SECURITY_DES, SECURITY_PRICING_DATE, MATURITY, ID_BB_UNIQUE, ID_BB_GLOBAL, MARKET_SECTOR_DES?

Besides, how can I find tickers to get other countries' bonds, i.e. German, France, British, Canada, Italy and Japan?

Thanks

Peng

Upvotes
39.2k 75 11 27

Hi Peng,
The symbols returned in the Instrument column are RICs, which is Thomson Reuters proprietary symbology. There's no direct mapping between RICs and Bloomberg symbols, however you could use other symbology such as ISINs, Cusips, Sedols etc as intermediary. E.g. using Eikon you can retrieve a Cusip given a RIC and vice versa. And using Bloomberg terminal you can retrieve Bloomberg symbols given a Cusip and vice versa.
It sounds like you could benefit from an introductory training for Eikon focusing no how to find the data items you might be interested in. You can request such training through your Thomson Reuters account team or from the main Eikon menu - Help - Tutorials and Training - Live Training.
Also please note that my answers are specific to Eikon and Eikon APIs. I understand your company is also considering using Datascope product. The calls to retrieve data from Datascope will be different. If you're looking to use Datascope, please visit Datascope page on this portal:
https://developers.refinitiv.com/en/datascope-select-dss

And if you have questions related to Datascope APIs you can post them on a dedicated forum.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
21 2 3 4

Thanks. I tried the following

ek.get_data('0#USTSY=',['DSPLY_NAME', 'CUSIP'])

but can't get CUSIP. Anything wrong?

Peng

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

It sounds like you're trying to guess the field name. If this is indeed what you're doing you're unlikely to succeed. The best way to discover the field names you can use in function calls is to search for them using the GUI helpers provided in the product. See this tutorial, which talks at length about metadata discovery.
For US treasuries the RIC symbology is based on CUSIP. You could simply drop the trailing "=" sign from the RIC such as "912810RY6=" to arrive at the CUSIP. The exception are the RICs denoting "when issued" benchmarks.

Alternatively you can retrieve CUSIPs for the constituents of 0#USTSY= chain using the following sample:

df, err = ek.get_data('0#USTSY=',['DSPLY_NAME'])
ustlist = df['Instrument'].tolist()
ek.get_data(ustlist,['TR.CUSIP'])
Upvotes
21 2 3 4

Thanks a lot. Appreciated!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea