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
1 0 1 1

How to get multiple instrument/field rights in get_data() [Python]

I am trying to get open interest and implied volatility for a few options as a time series, but it seems like I can only access OI&IV through get_data instead of time_series.


instruments = ['TKMB700K1', 'TKMB800W1']

df_, _ = ek.get_data(
instruments = [instrument],
fields = [f'TR.OPENINTEREST(Frq=D,SDate=2019-01-01,EDate=2021-01-01).Timestamp',
f'TR.OPENINTEREST(Frq=D,SDate=2019-01-01,EDate=2021-01-01).Value']
)

It works if I get the data for each instrument separately, but it doesn't give the right dataframe back if I send a list of different instruments.

I also tried to add [f'TR.IMPLIEDVOLATILITY(Frq=D,SDate=2019-01-01,EDate=2021-01-01).Timestamp',
f'TR.IMPLIEDVOLATILITY(Frq=D,SDate=2019-01-01,EDate=2021-01-01).Value'] into the field list and again that doesn't work.


I am very new to this API and would like to have some guidance in terms of how to proceed with this. Thanks!

eikonpythonrefinitiv-dataplatform-eikon
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.

Hello @bgner

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

@bgner

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
10.2k 18 6 9

@bgner So the code below does work - i could not find the instruments you tried - are they valid RICs? I tried this for the crude oil future and it returns open interest (obviously IV is only for options so it returns nothing for a future). There is no need to add parameters to each field - you can add them once at the end to apply to all fields.

instruments = ['CLc1','CLc2']
fields = ['TR.OPENINTEREST.timestamp','TR.OPENINTEREST','TR.IMPLIEDVOLATILITY']

df, err = ek.get_data(instruments,fields,
                      parameters={'SDate':'2019-01-01',
                                  'EDate':'2021-01-01',
                                  'Frq':'D'})

df

1634314494207.png

I hope this can help.


1634314494207.png (143.8 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.