Elektron Real Time in Cloud connection errors using Python and websocket.
Hello,
There is a following link, which helps retrieve data in Elektron https://github.com/Refinitiv/websocket-api/tree/master/Applications/Examples/RDP/python . Inside this folder are 2 python files. I am trying to run both of the codes however got the following error
Sending authentication request with password to https://api.refinitiv.com:15000/auth/oauth2/v1/token ...
EDP-GW authentication exception failure: HTTPSConnectionPool(host='api.refinitiv.com', port=15000): Max retries exceeded with url: /auth/oauth2/v1/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001F4E99B9488>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))
Process finished with exit code 1
I have set following variables:
# Global Default Variables
app_id = '256'
auth_url = 'https://api.refinitiv.com:443/auth/oauth2/v1/token'
hostname = '127.0.0.1'
password = 'PASSWORD WHEN REGISTER MACHINE ID'
position = ''
sts_token = ''
refresh_token = ''
user = 'MY EMAIL ADDRESS'
clientid = 'APP KEY VIA https://emea1.apps.cp.thomsonreuters.com/apps/AppkeyGenerator'
port = '443'
client_secret = ''
scope = 'trapi'
ric = '/TRI.N'
service = 'ELEKTRON_DD'
What should I do to retreive the market prices?
Best Answer
-
Hello @g.suhharukov
Please be informed that the username for the Refinitiv Real-Time Optimized (formerly known as Elektron Real-Time in Cloud) should be a "machine id" (GE-XXXXXX..), not your email address. I suggest you contact your Refinitiv representative to help you get the machine id.
0
Answers
-
From
Sending authentication request with password to https://api.refinitiv.com:15000/auth/oauth2/v1/token ...
It looks like you have modified or set authentication host and port to override the default value, and it's the wrong one.
Auth URL should be below link as defined in the global default variable.
https://api.refinitiv.com:443/auth/oauth2/v1/token
What example are you using now? And What command-line argument are you using?
You can follow the instruction from the following quick-start guide to run the example.
https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api/quick-start0 -
moragodkrit.chumsri_1 Now I used
auth_url = 'https://api.refinitiv.com:443/auth/oauth2/v1/token'
port = '443'
And the error is the same:
Sending authentication request with password to https://api.refinitiv.com:443/auth/oauth2/v1/token ...
EDP-GW authentication HTTP code: 400 Bad Request
0 -
Does the api.refinitiv.com:443 is blocked on your site?
You can verify by using Postman example (RDP-> Authenticate -> Get Access Token, download here)
0 -
wasin.waeosri Yes, exactly. I just changed user to be a Machine ID and it seems it started connecting, however following error appeared
Sending authentication request with password to https://api.refinitiv.com:443/auth/oauth2/v1/token ...
EDP-GW Authentication succeeded. RECEIVED:
{
"access_token":"",
"expires_in":"300",
"refresh_token":"",
"scope":"trapi.auth.cloud-credentials trapi.cfs.claimcheck.read trapi.data.symbology.advanced.read trapi.data.symbology.read trapi.metadata.read trapi.streaming.pricing.read",
"token_type":"Bearer"
}
Connecting to WebSocket wss://127.0.0.1:443/WebSocket ...
[WinError 10061] No connection could be made because the target machine actively refused it
WebSocket Closed
0 -
400 Bad request is not the problem with the host. It seems to be the format of the request application sent.
- Can you please restore the source codes to the original one and do not change any codes.
Then run the following command line and replaced Your RDP Username, Your RDP Password, and Client ID with your RDP login.
python.exe market_price_edpgw_service_discovery.py --user "<Your RDP Username>" --password "<Your RDP Password>" --clientid "Client ID"0 -
moragodkrit.chumsri_1 I restored everything added Username, Password and Client ID. Additionally I added
hostname = '127.0.0.1'
because without it I got an error user, clientid, password, and hostname are required options. And when inserted these 4 things, I got the same error (described above)
[WinError 10061] No connection could be made because the target machine actively refused it
WebSocket Closed
0 -
wasin.waeosri Yes, when I put api.refinitiv.com:443 I am redirected to https://apidocs.refinitiv.com/Apps/ApiDocs and the red banner shows "Authentication failed:Error getting token". However when I run in Python it seems I got auth. token and new error authentication
0 -
I also found that in email sent By Reuters was written "python.exe market_price_edpgw_authentication.py --hostname emea-1.pricing.streaming.edp.thomsonreuters.com --user YourMachine --clientid YourMachine --password YourPassword"
So, I changed hostname to emea-1.pricing.streaming.edp.thomsonreuters.com, but it has the same issues as with previous hostname. Regarding "--user YourMachine --clientid YourMachine" I also tried different combinations such as app key + machine id, in both only machine id... and the same issue described below.
I now updated global variables and have the following errors:
Connecting to WebSocket wss://127.0.0.1:443/WebSocket ...
[WinError 10061] No connection could be made because the target machine actively refused it
WebSocket Closed
And in the second file https://github.com/Refinitiv/websocket-api/blob/master/Applications/Examples/RDP/python/market_price_edpgw_service_discovery.py
Here I see, that it has not smth. As a result ,trying to refresh everything
SENT on session1:
{
"Type":"Pong"
}
RECEIVED on session1:
[
{
"Type":"Ping"
}
]
SENT on session1:
{
"Type":"Pong"
}
0 -
Hello @g.suhharukov,
To re-iterate the info from @wasin.waeosri and @moragodkrit.chumsri_1, hostname = 127.0.0.1 will not work, as it is your local hostname, not ERT endpoint.
The latest version of example market_price_edpgw_authentication.py ,can be found at Websocket API -> Downloads, the mandatory parameters are:
--user, --clientid, --password, and --hostname.
I am testing from Americas region, my command line is:
python market_price_edpgw_authentication.py --hostname amer-1.pricing.streaming.edp.thomsonreuters.com --user MYMACHINEID --password MYLONGPASSWORD --clientid MYAPIKEY
If you are connecting from Europe, replace "amer-1" with "emea-1"
Hope this helps
0 -
Hello @g.suhharukov
Please try to run the example "as is" as suggested by my colleague @zoya.farberov.
I also strongly suggest you check the following WebSocket API resources which will give you a better detail of ERT in Cloud and WebSocket API:
- Introduction and Connect to Elektron Real Time in Cloud sections of WebSocket API tutorials.
- Refinitiv Real-Time - Optimized Install and Config Guide document in WebSocket API document page.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛