]: runfile('D:/my drive/Python Projects/eikon/test001.py', wdir='D:/my drive/Python Projects/eikon') Error on checking port 9000 : HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /api/v1/data (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002664A5BEB70>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)) Error on checking port 9000 : HTTPConnectionPool(host='localhost', port=9000): Max retries exceeded with url: /api/v1/data (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002664A5BE748>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)) Error on checking port 36036 : HTTPConnectionPool(host='localhost', port=36036): Max retries exceeded with url: /api/v1/data (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002664A5BE6D8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)) Error on handshake port None : Failed to parse: localhost:None Port number was not identified. Check if Eikon Desktop or Eikon API Proxy is running. Traceback (most recent call last): File "<ipython-input-6-816572c984fb>", line 1, in <module> runfile('D:/my drive/Python Projects/eikon/test001.py', wdir='D:/my drive/Python Projects/eikon') File "C:\Users\MArmia\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace) File "C:\Users\MArmia\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "D:/my drive/Python Projects/eikon/test001.py", line 3, in <module> ek.set_app_key("af6ed7495e654418af715318c4d90a9afd864f31") File "C:\Users\MArmia\Anaconda3\lib\site-packages\eikon\Profile.py", line 48, in set_app_key get_profile().set_app_key(app_key) File "C:\Users\MArmia\Anaconda3\lib\site-packages\eikon\Profile.py", line 207, in set_app_key self.check_profile() File "C:\Users\MArmia\Anaconda3\lib\site-packages\eikon\Profile.py", line 322, in check_profile raise EikonError(-1, 'Port number was not identified. Check if Eikon Desktop or Eikon API Proxy is running.') NameError: name 'EikonError' is not defined
@michael.armia
It appears that you're not a Refinitiv customer. You're a customer of the company named Metastock using their product named Metastock Xenith, which includes a low tier variant of Eikon. Metastock Xenith users are not entitled to Eikon Data APIs. If you'd like to use Eikon Data APIs, you need to subscribe to a higher tier Eikon variant from Refinitiv. You cannot get access to Eikon Data APIs through Metastock.
I get the same error if Eikon Desktop or Eikon API Proxy isn't running on the machine.
Please make sure that Eikon Desktop or Eikon API Proxy is running properly on the same machine. Eikon Data API needs to connect to Eikon Desktop or Eikon API Proxy running on the same machine in order to work properly.
@michael.armia
From the trace you included it looks like Eikon API Proxy, which is embedded in Eikon Desktop application, is not running on the machine where your Python script is executed. Could you confirm that you indeed are running Eikon Desktop (and not Eikon Web) on the same machine where your Python scripts are running and that Eikon Desktop is up and signed in at the time the script is executed? Can you see if the following file exists on your machine and what the content is in this file? You can open the file with a text editor like Notepad. It should contain the single number (typically 9000), which is the port number Eikon API Proxy is listening on. The file is created on the startup of Eikon.
%APPDATA%\Thomson Reuters\Eikon API Proxy\.portInUse
I have created a PowerShell script to verify the basic environment for Eikon Data API, such as Eikon Processes, listening ports, PortInUse file, and connection. Please run the script and share the output.txt file.
PS C:\Users\MArmia\Desktop> .\checkeikondataapi.ps1
.\checkeikondataapi.ps1 : File C:\Users\MArmia\Desktop\checkeikondataapi.ps1 cannot be loaded
because running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/
go.microsoft.com/fwlink/?LinkID=135170
.
At line:1 char:1
+ .\checkeikondataapi.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
3. Check portInUse file
=======================
C:\Users\MArmia\AppData\Roaming\Thomson Reuters\Eikon API Proxy\.portInUse is found
9000
4. Verify the connection to TCP Port: 9000
======================================
GET: http://127.0.0.1:9000/sxs/v1
Exception: Unable to connect to the remote server
GET: http://127.0.0.1:9000/ping
Exception: Unable to connect to the remote server
POST: http://127.0.0.1:9000/api/v1/data
Exception: Unable to connect to the remote server
From the output, there is no Eikon process listening on TCP port 9000. Below is my output.
The Eikon process that owns this port is Eikonbox.exe (16544).
The context for this process is THOMSONREUTERS.EIKON.DESKTOPSXSSVC.
I couldn't find this process on your output. This is why you are unable to use Eikon Data API.
You may need to restart the machine, run Eikon, and then re-run the script. If there is still no Eikon process listening on TCP port 9000, your account may not have permission to use this service.
@michael.armia
Are you by any chance using Metastock Xenith product? If not, which variant of Eikon do you subscribe to? Could you also check which version of Eikon you're running? You can check the latter by selecting Help - About Thomson Reuters Eikon from the main Eikon menu.
This exception message says you're trying to connect to the same host ( 127.0.0.1 ), while you're stating that your server is running on a different host. This 127.0.0.1 represents a 'loopback' . It allows the computer to communicate with itself via network protocol .
Dns.GetHostEntry(IPAddress.Loopback).HostName returns the host name of your machine. When you pass a host name to TcpClient , it will resolve it to one or more IP addresses using Dns.GetHostAddresses(hostName) . This includes the public and local IP addresses of your machine (e.g. 192.168.12.10), but not 127.0.0.1 (loopback address). So your client is trying to connect to any of the non-loopback addresses of your machine, while your server is listening only on the loopback address . So,
no connection
can be established. The solution to this problem is that connect to the same end point your server is listening on.