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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 1 6

What is the best way to get a list of fields for a list of instruments for a historical date range with get_data?

Let's say I want to get around 500 fields for around 4000 instruments (stocks) for about 20 year (SDate = 2020-01-01). Given the multiple limits I cannot just use

get_date(instrument, fields, {'SDate': '2000-01-01', 'EDate': today_as_string}) 

as this will give all kinds of errors / limits breaching.

Currently I will chunk the instruments 50 at a time, select 1 field and query for the full date range.

dfs = []
for field in fields:
    for instruments_chunk in split_list(instruments, max_items_in_list=50): 
        df = ek.get_data(instruments_chunk, [field + 'date', field], {'SDate': '2000-01-01', 'EDate': today_as_string})
        df.rename(columns={df.columns[1]: 'date'}, inplace=True)
        df['date'] = pd.to_datetime(df['date']).dt.date.astype('datetime64')
        dfs.append(df)
final_df = pd.concat(dfs)

Although this works it is very slow and will take several days to complete.

Is there a better solution to this kind of problem?

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

1 Answer

Upvotes
Accepted
13k 32 12 18

@jokari69,

Eikon data api is not geared towards this kind of use. Refinitiv offers Datascope and Tickhistory products which can provide very granular data for a wide range of instruments. Please contact your Refinitiv account manager for getting access to these products.


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.

Understood. Thank you for your detailed answer.
Click below to post an Idea Post Idea