question

Upvotes
Accepted
21 1 3 10

How to Efficiently Retrieve TR.PrimaryInstrument for Delisted Equities?

Hello everyone,

I'm currently working on a project where I retrieve RICs and PrimaryRICs for a set of ordinary shares from various global markets using the Refinitiv Research API (EQUITY_QUOTES) through codebook. Then I use the PrimaryRICs to gather fundamental data for these companies.

However, I've encountered a problem with equities that have been delisted and haven't traded since. These do not have a 'PrimaryRIC' field. I was advised to use TR.PrimaryInstrument for these cases, but unfortunately, the Refinitiv Research API (EQUITY_QUOTES) does not have TR.PrimaryInstrument.

Retrieving TR.PrimaryInstrument using ek.get_data is not feasible as it would take a substantial amount of time due to the large number of RICs involved.

Could anyone suggest an efficient method to retrieve TR.PrimaryInstrument for the described RICs? Are there any best practices or alternative approaches within the Refinitiv suite that could help optimize this process?

Thank you in advance for your assistance!

Example of the code I use to retrieve RICs and PrimaryRICs for a set of ordinary shares:

 response = search.Definition(
        view=search.Views.EQUITY_QUOTES,
        filter=filter_query,
        select="RIC, PrimaryRIC, IssuerOAPermID",
        top=10000
    )

Please let me know if you need more details.

pythonworkspace#technology#contentdataricssearchcodebookequities
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
Upvote
Accepted
36 1 0 2

Hi,

I've also faced issues retrieving TR.PrimaryInstrument for delisted equities. Here's a method that worked for me:

  1. Batch Requests: Split the RICs into smaller batches to manage the load.
  2. Caching: Store retrieved data to avoid redundant API calls.
  3. Parallel Processing: Use parallel processing to speed up requests.

Here's a sample code for batching:

pythonCopy codedef get_primary_instruments_in_batches(ric_list, batch_size):
    primary_instruments = [] 
    for i in range(0, len(ric_list), batch_size):
        batch = ric_list[i:i + batch_size]
        response = compass mobile login ek.get_data(batch, ['TR.PrimaryInstrument'])
        primary_instruments.extend(response)
    return primary_instruments

# Example usage
ric_list = [...]  # Your list of RICs
batch_size = 100  # Adjust as needed
primary_instruments = get_primary_instruments_in_batches(ric_list, batch_size)

Hope this helps! Any other suggestions are welcome.

Best,

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.

It helped indeed, thanks a lot!

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.