[Eikon Data API - Streaming Prices - Python] Cannot receive streaming prices via API, error: Receive

1) Main issue: When using Eikon Data API for Python, there is an issue on receiving streaming data with a python script as simple as:

import eikon as ek

ek.set_app_key("xxxxx")
ek.set_log_level(1)


def on_update(item, fields, status, error):
   print(f"Item: {item}, Fields: {fields}")

stream = ek.StreamingPrices(instruments=['BRL='], 
                           fields=['CF_BID', 'CF_ASK'], 
                           on_update=on_update)

stream.open()

image (1).png

2) Actions tried:

- Enabling debug log on Configuration Manager: points that it is most likely to be a communication bug with the api proxy locally:
image (2).png

- System check: everything is ok, except for private network (which is not used).

- Using refinitiv.data module instead of eikon module: same error as before.

- Using Refinitiv Eikon Datastream add on for Excel: after logged in, the only functions displayed are the ones for charts. In addition, my account is not subscribed to Datastream Web Services.

- Tried to use the same Eikon version, and other version on different computers, with different operational systems: same error as before.

- Search for similar issues: https://community.developers.refinitiv.com/questions/107081/streamingprices-unknown-subscription.html, but is does not point to a solution to follow.

- Refinitiv Support: they said that they do not handle functionalities related to Eikon API, and have adviced to post a question in this developers forum.

3) In conclusion, I need to stream FX prices (bid and ask). I rather not use get_data because of api limits. Could you help me with this api issue in order to use StreamingPrices for python properly?

4) Versions:

Eikon: 4.0.63
Python: 3.7.2
Operational System: Windows Server 2012 R2

Best Answer

  • @Christiano

    Thank you for the updating.

    I have forwarded your information to the product team. I have also created a new case to the Eikon support team to verify what the problem is because this issue is out of the API scope.

    The support team will contact you directly. I am not sure if clearing Eikon cache can help because it looks like the API proxy still gets an invalid hostname.


Answers

  • @Christiano

    Thank you for reaching out to us.

    I tested the code and checked the log. The log showed that the Eikon or Refinitiv Workspace can establish a WebSocket connection to the server properly.

    1695704221737.png

    According to the error message, it could be the problem on the Eikon or Refinitiv workspace processes.

    1695702083173.png

    The Eikon or Refinitiv Workspace may not be able to establish a WebSocket connection to the server. Please kindly contact the Eikon or Refinitiv Workspace support team via MyRefinitiv to verify what the problem is.

  • Hi @Jirapongse, thank you for helping. Unfortunately, as I said before, the Refinitiv Support has told me they do not handle functionalities related to Eikon API, and have adviced to post a question in this developers forum. I will provide an update below related to my issue, that was discovered after my question was posted.

    [Issue Update]

    1) It was found that using Eikon's Codebook, a GUI in the software for Jupyter Notebook provided by the software itself, the StreamingPrices method works fine. Checking the versions:

    Python: 3.8.15, packaged by conda-forge (gcc 10.4.0)
    Numpy module: 1.22.4
    Pandas module: 1.3.5
    Eikon module: 1.1.16

    2) Testing on a virtual environment on the command prompt, I have used the following versions:

    Python: 3.8.1, pip
    Numpy module: 1.22.4
    Pandas module: 1.3.5
    Eikon module: 1.1.16

    Same error occurs.

  • @Christiano

    I contacted the internal team to check this issue.

    I will keep you posted after getting responses from that team.

  • @Christiano

    The product team found that the problem may relate to the WebSocket server that Eikon is connecting to.

    1695972155481.png

    The correct one should be amers2.

    They would like to see the Eikon Configuration at startup. You can enable it via the Refinitiv Eikon - Configuration Manager.

    1695972243376.png

    After restarting Eikon, the DumpedSAPURL.xml file will be created in the C:\ProgramData\Thomson Reuters\Eikon Data\Logs folder. Look for the <SAP sap="streamingweb.cp." ..> key to see the address that Eikon is using.

    For example:

    <SAP sap="streamingweb.cp." hosted="true" trusted="true" prefix="" address="apac1-ws-hmds.platform.refinitiv.com">apac1-ws-hmds.platform.refinitiv.com</SAP>
  • @Jirapongse

    1) Proceeding as described, on C:\ProgramData\Thomson Reuters\Eikon Data\Logs\DumpedSAPURL.xml, the tag aforementioned is highlighted below:

    image-3.png

    Note that even though it is configured for amers2, the API Proxy logs as amers1. I have noticed the following part in that log, it might indicate something:

    image (6).png

    The CpUrlService url conversion could be the problem somehow.

    2) After that, I tried to change the region from amer1 to amer2 at C:\Program Files (x86)\Thomson Reuters\Eikon\X\Config\CountryDataCenter.xml and C:\Program Files (x86)\Thomson Reuters\Eikon\Z\Config\CountryDataCenter.xml. However, modifying that and restarting the application did not change the websocket url to amers2.

  • 3) It also worths note that on the System Test, I had the following errors (that maybe linked to the main issue):

    image (4).png

  • @Jirapongse

    1) Proceeding as described, on C:\ProgramData\Thomson Reuters\Eikon Data\Logs\DumpedSAPURL.xml, the tag aforementioned is highlighted below:

    image (3).png

    Note that even though it is configured for amers2, the API Proxy logs as amers1. I have noticed the following part in that log, it might indicate something:

    [2023-09-29 21:26:19.794|1|data-api|3|DEBUG]  API Proxy::RdpAccessTokenProviderTokenRefreshDecorator - SocketDebug: rdp-access-token-provider-token-refresh-decorator - getAccessToken  this.refreshMap.has value is false
                for params {"applicationKey":"XXXXXX","scope":"trapi"}
    [2023-09-29 21:26:19.799|1|data-api|1|INFO] API Proxy::CsmLogger - [Data API Proxy CSM] DefaultLogger::PricingSocketCoordinatorProvider - Creating HMDS socket coordinator for pricing streams.
    [2023-09-29 21:26:19.799|1|data-api|1|INFO] API Proxy::CsmLogger - [Data API Proxy CSM] [WS #9af3f831-424b-4787-8e6c-e24b4de2368f] New websocket connection established WebSocket ID is 9af3f831-424b-4787-8e6c-e24b4de2368f
    [2023-09-29 21:26:19.799|1|data-api|3|DEBUG] API Proxy::CsmLogger - [Data API Proxy CSM] Sending event WebSocketOpened to usage tracking service
    [2023-09-29 21:26:19.799|1|data-api|0|WARN] API Proxy::CsmLogger - [Data API Proxy CSM] Unable to get valid project info. Event will be discarded
    [2023-09-29 21:26:22.350|1|data-api|1|INFO] API Proxy::RdpAccessTokenProvider - RDP Token for applicationKey ************************************XXXX and scope trapi was successfully retrieved.
    [2023-09-29 21:26:22.351|1|data-api|3|DEBUG] API Proxy::RdpAccessTokenProviderTokenRefreshDecorator - Retrieved new access token - expires in 599999 ms.
    [2023-09-29 21:26:22.351|1|data-api|1|INFO] API Proxy::RdpAccessTokenProviderTokenRefreshDecorator - Scheduling automatic access token refresh. appkey ************************************e1d5 and 'trapi' scope in 568999 ms
    [2023-09-29 21:26:22.354|1|data-api|1|INFO] API Proxy::CsmLogger - [Data API Proxy CSM] A request={"Domain":"Login","ID":1,"Key":{"Elements":{"AppKey":"************************************XXXX","ApplicationId":"XXX","Position":"XXXXXXX"},"NameType":"AuthnToken"}} client=0 logId=9af3f831-424b-4787-8e6c-e24b4de2368f
    [2023-09-29 21:26:22.354|1|data-api|3|DEBUG] API Proxy::CsmLogger - [Data API Proxy CSM] A request is accepted! Router has 1 active requests
    [2023-09-29 21:26:22.354|1|data-api|1|INFO] API Proxy::CsmLogger - [Data API Proxy CSM] [WS #6b91b445-25f7-4a45-a1eb-90b53ba6340f] A request is received
    [2023-09-29 21:26:22.355|1|data-api|3|DEBUG] API Proxy::CsmLogger - [Data API Proxy CSM] Sending event RequestReceived to usage tracking service
    [2023-09-29 21:26:22.355|1|data-api|0|WARN] API Proxy::CsmLogger - [Data API Proxy CSM] Unable to get valid project info. Event will be discarded
    [2023-09-29 21:26:22.517|1|data-api|3|DEBUG] API Proxy::CsmLogger - [Data API Proxy CSM] UDF Transaction ID: 6521defd-9c44-42b5-885f-479489adcd13
    [2023-09-29 21:26:22.517|1|data-api|3|DEBUG] API Proxy::CsmLogger - [Data API Proxy CSM] Sending event ResponseSent to usage tracking service
    [2023-09-29 21:26:22.518|1|data-api|1|INFO] API Proxy::CsmLogger - [Data API Proxy CSM] [WS #6b91b445-25f7-4a45-a1eb-90b53ba6340f] AppKey "************************************XXXX" provided by the client will be discarded.
    [2023-09-29 21:26:22.518|1|data-api|3|DEBUG] API Proxy::CsmLogger - [Data API Proxy CSM] DefaultLogger::CpUrlServiceImpl - Url passed to CpUrlService: cpurl://streamingweb.cp./WebSocket
    [2023-09-29 21:26:22.518|1|data-api|3|DEBUG] API Proxy::CsmLogger - [Data API Proxy CSM] DefaultLogger::CpUrlServiceImpl - Converted url by CpUrlService: https://amers1-streamingweb.platform.refinitiv.com/WebSocket
    [2023-09-29 21:26:22.518|1|data-api|0|WARN] API Proxy::CsmLogger - [Data API Proxy CSM] Unable to get valid project info. Event will be discarded
    [2023-09-29 21:26:22.518|1|data-api|3|DEBUG] API Proxy::CsmLogger - [Data API Proxy CSM] Creating upstream connection to the ADS. URL is wss://amers1-ws-hmds.platform.refinitiv.com/WebSocket. Protocol is tr_json2

    The CpUrlService url conversion could be the problem somehow.

    2) After that, I tried to change the region from amer1 to amer2 at C:\Program Files (x86)\Thomson Reuters\Eikon\X\Config\CountryDataCenter.xml and C:\Program Files (x86)\Thomson Reuters\Eikon\Z\Config\CountryDataCenter.xml. However, modifying that and restarting the application did not change the websocket url to amers2.

    3) It also worths note that on the System Test, I had the following errors (that maybe linked to the main issue):

    image (4).png

  • To close this issue, the Refinitiv support team has contacted my team directly, and the problem was solved. It appeared to be a disruption with the API service and it might has caused a global issue, which is now mitigated and working fine.