Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
7 2 4 4

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?
eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apipricingsymbology
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.

Upvotes
Accepted
10.1k 18 6 9

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.

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.

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 - 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.

1595320065046.png (222.8 KiB)
Upvotes
18.2k 21 13 21

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:


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


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


ahs1.png (25.8 KiB)
ahs2.png (65.5 KiB)
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.

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.