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

Getting data from api

I'm trying to get data from the Eikon api. My code is as following:


import eikon as ek

ek.set_app_key('xxxxxxxx')

fields = ['TR.HeadquartersCountry','CF_LAST','TR.CompanyMarketCap(Scale=6 Curn=EUR)','TR.PricePctChgYTD','TR.PriceToBVPerShare','TR.PE','TR.FwdPE','TR.PriceToCFPSTrailing12m','TR.FwdPriceToCFPerShare','TR.EVToSales','TR.RelValEVSalesNTM','TR.EVToEBITDA','TR.FwdEVToEBITDA','TR.EVToEBIT','TR.FwdEVToEBIT','TR.PEG','TR.ROEPercentTrailing12M','TR.ROEMEAN','TR.ROAMEAN','TR.NetDebtToEBITDA','TR.OperatingMarginPercent','CURRENCY','TR.WACCCostofEquity','TR.WACC','TR.EBITMarginPercent','TR.EBITDAMarginPercent','TR.NetDebt','TR.Cash']

tickers = ['MARL.IC','G1AG.DE','JBT','MIDD.O']

And to get data I do

data = ek.get_data(tickers,fields,None,False,True,False)


I'm not sure if I'm able to connect to eikon, so I don't know if I've established connection. The Eikon application is up an running, so that is not the issue. Maybe my issue is with ek.set_app_key('xxxxxxxx'), where I get no logging after that part of the code.


eikoneikon-data-apiworkspacerefinitiv-dataplatform-eikonworkspace-data-apiconnection-error
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.

Upvotes
Accepted
10.6k 20 6 9

@olafur so please try adding:

ek.set_log_level(1)

after your import and se what the output is.

We also have a useful troubleshooting guide for you to follow. I hope this can help.

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.

Upvotes
23.7k 61 15 21

Hi @olafur,

If the API wasn't connecting to Eikon, it would throw an exception. What is the output of dataframe?

print(data)

To enable logging and see the information on console, you can set:

import logging.config
ek.set_log_level(logging.DEBUG)
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.

Upvotes
1 0 2 4

Hi, after some digging I'm getting the following error


"EikonError(404, 'Client Error: <!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /api/v1/data</pre>\n</body>\n</html>\n')"


when I use the ek.get_data(tickers,fields,None,False,True,False) function. Any ideas?

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.

Upvotes
39.4k 78 11 27

@olafur

Were you able to resolve the issue? Or is it still outstanding? If you're still experiencing the problem, could you share the full logging output after setting the log level to the max using ek.set_log_level(1) call?

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.