Hello, I am having problems with the function ek.get_data(). When I do a request no error message or data is returned and the code keeps running indefinitely without a response. Could someone help me with this issue?
Thanks
I don't see the log level command before set_app_key call. Did you invoke it?
ek.set_log_level(logging.DEBUG)
Can you also please follow all the steps in this troubleshooting article to see if it gets any better.
I also wanted to mention, that these forums are development support only. We do not have any visibility into the servers/operations support. If it comes to that, you will have to open a support ticket at my.refinitiv.com.
Hello @rone.almeida
Could you please share your snippet code and the versions of Python/Eikon Data API?
This is my code:
datas, err = ek.get_data(['.BVSP'],
['TR.PriceClose.date','TR.PriceClose'],
{'SDate': '2021-04-29', 'EDate':'2021-04-30', 'FRQ': 'D'})
Last week, this code was running normally. Python version is 3.9.5 and Eikon version is 4.0.53072.
Hello @rone.almeida,
There is nothing wrong with your API query. Can you try restarting your computer and Eikon and try again. You can also enable logging on the system to capture the raw requests and responses from Eikon. Use something like this, and it should pinpoint the problem area:
import logging.configimport eikon as ekek.set_log_level(logging.DEBUG)ek.set_app_key('**app key**')datas, err = ek.get_data(['.BVSP'], ['TR.PriceClose.date','TR.PriceClose'], {'SDate': '2021-04-29', 'EDate':'2021-04-30', 'FRQ': 'D'})
The output should be something like:
20..2] Send GET request to http://127.0.0.1:9060/api/status to detect API Proxy...20..2] Request to http://127.0.0.1:9060/api/status headers = {'x-tr-applicationid': '***'} params = None20..2] Checking port 9060 response : 200 - {"statusCode":"ST_PROXY_READY","version":"2.8.0"}20..2] Port 9060 was retrieved from .portInUse file20..2] Try to handshake on url http://127.0.0.1:9060/api/handshake...20..2] Request to http://127.0.0.1:9060/api/handshake headers = {'Content-Type': 'application/json', 'x-tr-applicationid': '***'} params = None20..2] Response : 200 - {"access_token":"****","expires_in":1209600,"token_type":"bearer"}20..2] Application ID: ***20..2] Init a Desktop session with new app_key20..2] Port 9060 on local proxy was detected20..2] Request:{'Entity': {'E': 'DataGrid_StandardAsync', 'W': {'requests': [{'instruments': ['.BVSP'], 'fields': [{'name': 'TR.PriceClose.date'}, {'name': 'TR.PriceClose'}], 'parameters': {'SDate': '2021-04-29', 'EDate': '2021-04-30', 'FRQ': 'D'}}]}}}20..2] Request to http://127.0.0.1:9060/api/v1/data headers = {'Content-Type': 'application/json', 'x-tr-applicationid': '***', 'Authorization': 'Bearer ****'} params = None20..2] HTTP Response code: 20020..2] HTTP Response: {"responses":[{"columnHeadersCount":1,"data":[[".BVSP","2021-04-29T00:00:00Z",120065.75],[".BVSP","2021-04-30T00:00:00Z",118893.84]],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"Date","field":"TR.PRICECLOSE.DATE"},{"displayName":"Price Close","field":"TR.PRICECLOSE"}]],"rowHeadersCount":1,"totalColumnsCount":3,"totalRowsCount":3}]}
I should also add that you can try to use the Codebook app in the Eikon to try your script in a cloud hosted jupyer environment.
Type in Codebook in Eikon desktop to launch it, or see this article for more details.
I restarted my computer and Eikon and still it isn´t getting any response. Even the ek.set_app_key() is not working (Picture attached). Could you guys check your server?
I tried to run this code:
screener_exp = 'SCREEN(U(IN(Equity(active or inactive,public))),IN(TR.ExchangeCountryCode,"BR"), CURN=USD)'
companies_data, err = ek.get_data(instruments=[screener_exp], fields=['TR.InstrumentType','TR.CommonName','TR.PriceClose.date'])
And I got this output:
@rone.almeida
I can run it properly.
What is the version of Python you are using?
Please run the 'pip list" command to verify the versions of Python Libraries used by the machine.