The Eikon terminal can correlate two stocks. Is this same capability abvailable through the Eikon Data API?
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 pairdf2 = ek.get_timeseries(['F','TSLA.O'], fields='CLOSE', start_date='2015-03-01',end_date='2020-04-26',interval='daily')# calculate daily returnsrets = np.log(df2 / df2.shift(1)).dropna()# Correlate daily returnsrets.corr()
I hope this can help.
Jason, thank you very much for your prompt response. And the Python (Eikon API pandas dataframe) example.