Does the Eikon API provide the capability to correlate two equity instruments?

The Eikon terminal can correlate two stocks. Is this same capability abvailable through the Eikon Data API?

Best Answer

  • jason.ramchandani01
    Answer ✓

    Hi @mark.ringrose1 thanks for your question. At present we do not expose the capability to correlate two stocks via API - though we are expanding our calculated analytics all the time and this is a pretty common ask. However, it is a pretty trivial operation in python. For example if you want a correlation (taking stationarity into account):

    # download daily closing price data for pair
    df2 = ek.get_timeseries(['F','TSLA.O'], fields='CLOSE',
                           start_date='2015-03-01',end_date='2020-04-26',interval='daily')

    # calculate daily returns
    rets = np.log(df2 / df2.shift(1)).dropna()

    # Correlate daily returns
    rets.corr()

    image

    I hope this can help.

Answers

  • Jason, thank you very much for your prompt response. And the Python (Eikon API pandas dataframe) example.