Can I download historical stock price data using the API for a list of CUSIPs (6-digit)?

I have a list of 6-digit CUSIPs from SDC Mergers and Acquisitions database. I need the historical monthly stock price data for these companies. Is there a way I can use the API to do so?

Best Answer

  • hi @sanhitha.jugulum thanks for your question - if you have cusip codes its a 2 step operation involving firstly our get_symbology API call which can convert between different symbology types (CUSIP to RIC in this case) and once we have our RICS we can get our monthly closing price data. Please see the code sample below:

    df1 = ek.get_symbology(['594918104','88160R101'],from_symbol_type  ='CUSIP',to_symbol_type='RIC')

    df2 = ek.get_timeseries(df1.RIC.to_list(), fields='CLOSE',
                           start_date='2010-03-01',end_date='2020-04-26',interval='monthly')
    df2

    I hope this can help you.

Answers

  • Thanks, Jason! That is definitely helpful! But there is a slight glitch. I have 6-digit CUSIPs (issuer CUSIPs). Will the API take that as a valid argument?

  • Hi @sanhitha.jugulum

    I suggest that you convert the CUSIP to RIC code first.

    If they are valid identifier, you can use it with get_timeseries()

    Here, I am demonstrating that the CUSIP and RIC can be converted:

    image


    Once you have the RIC, you can get the historical price.

    image


    For more information on historical price, you can use help(ek.get_timeseries) in your Python code.

    Or you can visit https://docs-developers.refinitiv.com/1595318014557/14684/book/en/eikon/index.html#get_timeseries

  • Hi @sanhitha.jugulum - sadly the symbology API works only with specific instruments (full CUSIP 9-digit codes) rather than CUSIP issuer codes (issuers might have a number of instruments). How big is your list - if its not too big you could just try copy pasting the 6 digit CUSIPS into eikon search bar which it seems to resolve correctly.

    One other approach would be to use our excellent new CODEBOOK app (type CODEBOOK into Eikon search bar) which provides you access to our new RDP libraries which provides a new search API service. I have tried that and it does work programatically.

    There is a full sample in the examples/02-Refinitiv Data Platform Library/1.5.0 - Function - Search.ipynb . So in there you can just replace the IBM RIC with your six digit CUSIP and it will return the following. So the top code is the most relevant I believe. So if you wrapped you list of six digit CUSIPs in a for-loop you will easily be able to achieve resolution.

    image