question

Upvotes
Accepted
0 1 0 1

Retrieve current historic volatility surface

Hi,

I am wondering what the most elegant way to retrieve a full surface through the Python API is. For example LCOSURF3 contains a lot of RICs like LCO100N1MO=R for which historic as well as live values can be retrieved. Is there another way except pulling the data RIC by RIC?

eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apitime-seriesvolatility
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 @peter.stein,

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

-AHS

1 Answer

· Write an Answer
Upvotes
Accepted
4.6k 27 7 22

I can not see any elegant ways to achieve this, moreover, the api does not consider a chain of instruments without 0# as a series, so you will have to extract RICs first with something like this:

import pandas as pd
import eikon as tr

tr.set_app_id('your_app_id')

fields = ['LONGLINK' + str(i) for i in range(1, 14)] + ['LONGNEXTLR']

def expand_chain(ric, fields, data):
    df, e = tr.get_data([ric], fields)
    data = data + list(df.iloc[0])[1:-1]
    nextlr = df['LONGNEXTLR'][0]


    if (pd.isnull(nextlr)):
        return data
    else:
        return expand_chain(nextlr, fields, data)

rics = expand_chain('LCOSURF3', fields, [])[1:-1]

after this you can get the time series for each RIC.

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.