Fetching a company’s peers

Hide code cell content
import refinitiv.data as rd

rd.open_session()
/home/runner/.local/share/virtualenvs/refinitiv-data-python-cookbook-I-HIyNf4/lib/python3.10/site-packages/refinitiv/data/_access_layer/session.py:71:FutureWarning: 
You open a platform session using the default value of the signon_control parameter (signon_control=True).
In future library version v2.0, this default will be changed to False.
If you want to keep the same behavior as today, you will need to set the signon_control parameter to True either in the library configuration file
({'sessions':{'platform':{'your_session_name':{'signon_control':true}}}}) or in your code where you create the Platform Session.
These alternative options are already supported in the current version of the library.
<refinitiv.data.session.Definition object at 0x7f8ba08ccfd0 {name='rdp'}>

You can use the Refinitiv Data Library for Python to retrieve a list of the companies judged to be peers of a given company.

To do so, pass a company’s Refinitiv Instrument Code to the Peer component of the package’s discovery submodule. By default, the method only returns the code of each peer. You’ll need to pass the resulting list to another query to retrieve additional information about each company.

Here’s how to retrieve each of the Thomson Reuters’ peers:

rd.discovery.Peers("TRI.N")
<refinitiv.data.discovery._universe_expanders._peers.Peers at 0x7f8ba8462890>

You’ll need to convert it to a list object to see the results.

list(rd.discovery.Peers("TRI.N"))
['SPGI.N',
 'MSCI.N',
 'FDS.N',
 'WLSNc.AS',
 'REL.L',
 'EXPN.L',
 'HEIJ.AS',
 'MORN.OQ',
 'CJRb.TO',
 'QBRb.TO',
 'CCA.TO',
 'CGX.TO',
 'RAYa.TO',
 'T.TO',
 'RCIb.TO',
 'BCE.N',
 'RHI.N',
 'MCO.N',
 'EFX.N',
 'CTAS.OQ',
 'TRU.N',
 'VRSK.OQ',
 'BFAM.N',
 'WILD.TO',
 'IT.N',
 'ADT.N',
 'IRM.N',
 'VSTS.N',
 'CLVT.N',
 'DNB',
 'TCLa.TO',
 'FORA.TO',
 'MAN.N',
 'ROL.N',
 'BV.N',
 'UNF.N',
 'TOY.TO',
 'FICO.N',
 'STER.OQ',
 'BRMI.TO',
 'ILLM.TO',
 'ARMK.N',
 'KBR.N',
 'CACI.N',
 'SAIC.OQ',
 'PSN.N',
 'ARCAY.PK',
 'FCN.N',
 'NLSN.N^J22',
 'BAH.N']
Hide code cell content
rd.close_session()