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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 2

Intraday asset prices best practices


i'm trying to pull out intraday asset prices to compute intraday asset returns. I used =ek.get_timeseries and then specify the interval as minute. Is this the best way to do it? I saw there is another function StreamingPrices but i'm not sure it works for equity assets.

Also is there a function that can handle more than 300 instruments?

thanks


Francis

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonhistorical
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
18k 21 12 20

Hi @diarmuid.omahony

get_timeseries() is used to get historical data.

It can be interday or intraday.


StreamingPrices is a realtime subscription.

It means that you will get the data from the time you open a subscription and subsequence updates(if any). You have to handle what to do with the updates you get.

It does not provide historical data retrieval capabilities.

You can try the StreamingPrices in "CODEBOOK" app (Type in CODEBOOK in Eikon Search and launch the app).

Then browse to \Examples\02 - Refinitiv Data Platform Library



ahs.jpg (390.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
18k 21 12 20

Also is there a function that can handle more than 300 instruments?

- I would suggest that you contact your Customer Success Manager to discuss your requirements.

Eikon Data API is a desktop product.

There are other Enterprise products which may serve your requirement better.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
6.7k 8 6 7

@diarmuid.omahony You would use the get_timeseries API call to get intraday history. In short API limits are applied to all our APIs and you can find out details here - for get_timeseries:

  • get_timeseries: The current limit value (10-Oct-2019) is 3,000 data points (rows) for interday intervals and 50,000 data points for intraday intervals. This limit applies to the whole request, whatever the number of requested instrument

So you have upto 50k datapoints per API call which you can configure in any way you need them - so say you want equity data that trades for say 8 hrs a day that would be 8hrs x 60min =480 mins per ric per day say (you need to check these Im just giving the logic here). So you can chunk a longer list of RICs into appropriate chunks to get a full dataframe back and then concatenate them - here please look at the sample code below which does this for the S&P 500 index:

First define our chunks routine:

def chunks(l, n):     
  for i in range(0,len(l),n):         
    yield l[i:i+n]

next we get a long list of RICs in this case for 0#.SPX (S&P500) - we then iterate over chunks and concatenate resultant dataframes:

data1 = pd.DataFrame() 
univ,err = ek.get_data('0#.SPX','TR.CommonName') 
long_ric_list = univ['Instrument'].astype(str).values.tolist() 
ric_chunk = list(chunks(long_ric_list, 100)) 

for r in ric_chunk:     
  df = ek.get_timeseries(r,['CLOSE'],start_date='2021-03-26',interval='minute',count=500)     
  if len(data1):         
    data1 = data1 = data1.join(df)    
  else:     
    data1 = df              

data1

Obviously - you can change the amount in each chunk to suit your needs - or say if you wanted a long history for 1 RIC you could just iterate for each RIC in universe and get 50k rows per instrument back. I hope this can help.


1616770652597.png (288.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes

Hi Team and @jason.ramchandani, many thanks for helping as the user is happy with your input as posted above. However, he has a follow up in relation to the codes given above. Below is his verbatim.

"I see in the Example notebook StreamingPrices works only with currencies, does it also work with equity assets? I’m trying to run the code with AMZN.OQ but I got N/A"

Can someone please advise? Thanks in advance!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Hi @diarmuid.omahony

It works with AMZN.OQ

Can you try again?

ahs.jpg (77.5 KiB)
Click below to post an Idea Post Idea