I want to translate a excel function TR(Universe=’0#USTSY’) in python. How should I do it?
For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
I want to translate a excel function TR(Universe=’0#USTSY’) in python. How should I do it?
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'])
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
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.
Thanks. I tried the following
ek.get_data('0#USTSY=',['DSPLY_NAME', 'CUSIP'])
but can't get CUSIP. Anything wrong?
Peng
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'])