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

How can I sum a field within a chain RIC?

Looking to get the sum of OPINT_1 for an options chain RIC (0#KODK*.U) by puts and calls. I separated out the puts and calls into different lists. But I cannot find any instruction on how to now sum these values. As you can tell, I'm a beginner here. My goal is to look at the summed data in a time series.

fields = ['PUTCALLIND', 'STRIKE_PRC', 'OPINT_1']

kodk = ek.get_data('0#KODK*.U' , fields=fields)[0]

kodkputs = kodk[kodk['PUTCALLIND'] == 'PUT ']

kodkcalls = kodk[kodk['PUTCALLIND'] == 'CALL']

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apichain-rictimeseries
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
39.4k 77 11 27

Use the "sum" method on pandas series:

op_int_puts = kodkputs['OPINT_1'].sum()
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
18.2k 21 13 21

Hi @michael.t.smith

If you would like to know how to sum() the data on a dataframe.

Here is the dataframe document.

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sum.html

Here is the sample code:

kodkcalls['STRIKE_PRC'].sum()
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 for the link to help. It will be very useful going forward.

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.