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
22 4 5 8

How to get historical monthly open interest data in Eikon with Python API?

I used the following code as mentioned in this question

https://community.developers.refinitiv.com/questions/42502/what-is-the-best-way-to-retrieve-open-interests-da.html

but it gives daily data not monthly data. Is there any way to modify it somehow to retrieve monthly data?


Code:

df, e = ek.get_data('NGc1', ['TR.OPENINTEREST.Date', 'TR.OPENINTEREST'], {'SDate':'2011-01-01','EDate':'2020-12-31'})

df

Any leads will be highly appreciated. Thanks in advance.

eikon-data-apipython apihistorical
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.

Upvote
Accepted
14k 30 5 10

hi @saad.ali ,

You can add parameter 'Frq' to set the frequency of the data returned. Please note that M is used for monthly, Y=yearly, Q=quarterly, W=weekly, D=day

for example,

df, e = ek.get_data('NGc1', ['TR.OPENINTEREST.Date', 'TR.OPENINTEREST']
                    , {'SDate':'2011-01-01','EDate':'2020-12-31','Frq':'M'})
df

1636362911358.png


1636362911358.png (29.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.

Upvote
22 4 5 8

@raksina.samasiri Thanks a lot. It works :)

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.