Future Option time series data using Python EikonDesktopData API

Hi, I am trying to build historical volatility surface using Python EikonDesktopData API. I'd need to extract the following fields

PREMIUM, SPOT, STRIKE_PRC, STRIKE_PRC, DELIVERY MONTH, INTRST_RTE,

I am getting Null values for all the queries in the code below. Could you please help here, where I'm making mistake? Thanks.

import eikon as ek
ek.set_app_id('<my app id>')
strike = ek.get_timeseries(["LCO100N1MO=R"], start_date = "2018-05-01T15:04:05", end_date = "2018-05-05T15:04:05", interval="daily", fields=["STRIKE_PRC.Timestamp","STRIKE_PRC.Value"])

interest = ek.get_timeseries(["LCO100N1MO=R"], start_date = "2018-05-01T15:04:05", end_date = "2018-05-05T15:04:05", interval="daily", fields=["INTRST_RTE.Timestamp","INTRST_RTE.Value"])

spot = ek.get_timeseries(["LCO100N1MO=R"], start_date = "2018-05-01T15:04:05", end_date = "2018-05-05T15:04:05", interval="daily", fields=["SPOT.Timestamp","SPOT.Value"])

Best Answer

  • @Sanjit.Rath you can get a snapshot using the get_data Python API call using the following:

    fields1 = ['PREMIUM', 'STRIKE_PRC', 'RISK_FREE', 'CF_CLOSE', 'EXPIR_DATE']

    newins = ek.get_data('LCO100N1MO=R', fields=fields1)[0]

    newins.head()

    But as Zhenya states, you will have to wait for the history to be available in Q2 to calculate the historical vol surface.

Answers

  • @Sanjit.Rath none of the views that you need ('STRIKE_PRC', 'INTRST_RTE' and 'SPOT') are supported by the beta timeseries API. You can only get the close price, that refers to the default view ('LAST_QUOTE'):

    image

    This functionality will be added in the first official release some time in Q2.

  • Hi @Zhenya Kovalyov, Thanks for the explanation. Is it possible to get the the values using COM API . I tried AdxRtHistory but it expects fields in the old format not as shown below.. Do you know if we have old field names for the below?

    ["STRIKE_PRC.Timestamp, "STRIKE_PRC.Value"]
  • @Sanjit.Rath if you are using it outside of Excel, the best choice would be the .NET API, as with AdxRtHistory you might run into a completely different set of issues. Have a look at Views and Intervals section of the time series tutorial, if you can use .NET for this task.

    If you can do VBA inside of Excel, I can recommend RHistory COM API, here is the tutorial.

  • If you're looking to retrieve the data into Excel VBA you can use RHistory COM API. Here's the link to the tutorial. For custom applications the only API that can currently provide these values is Eikon .NET API. Here's the tutorial for retrieving this data into .NET application.

  • Hi @Alex Putkov., Thanks for the reply. Yes I was looking at RHistory COM API but it is not registered by default. This is required for loading it into python win32com. I tried to call "regsvr32 RhistoryAPI.dll" but it fails with an error. I presume DllRegisterServer function is not implemented or there are other issues preventing registration.

    Regarding the .NET API, it is much better than the COM APIs but client is interested in keeping all coding to Python. It would be possible to use python if RHistoryApi.Dll can be registered.

    Do you know if is possible to register?

  • RHistory COM library can only be used in Excel VBA. It has dependencies on components provided only by Eikon Excel add-in.
    If the data retrieval must be done in Python, then you can try using .NET assemblies in Python with either pythonnet or IronPython. I personally have not used either one of them. But I have used Eikon .NET API successfully in other dev environments including Java and Matlab. Whenever you need to bridge two development environments the project is significantly complicated. But at the moment there's no alternative.