OpenAPI v2 CANT_ROUTE_REQUEST after receiving the account listing

07 Feb 2019, 11:14OpenAPI v2 CANT_ROUTE_REQUEST after receiving the account listing#1
abierbrauerposts: 8since: 29 Jan 2019

Hello again ;) After playing around with the FIX API and realizing that it's not possible to create an order with take-profit and stop-loss and once, I decided to switch to the OpenApi 2.0. So far, so good.

I'm receiving the error CANT_ROUTE_REQUEST after connecting to live.ctraderapi.com:5035, obtaining the accounts with a token and trying to authenticate them. The output below is from my program, but I'm receiving the same behaviour with the Open-API-2.0-.Net-Sample (with the data included in the sample and with my own data).

Maybe anyone has a clue what's going on?

Regards, Alex

Certificate is ok
authenticateWithServer()
Listening...
Send: ProtoMessage{AppAuthRequest{clientId:"XXXX", clientSecret:"XXXX}}
Received: ProtoMessage{ApAuthResponse}
Type: ProtoMessage
Listening...
getAccountList()
Send: ProtoMessage{GetAccountsByAccessTokenReq}
Received: ProtoMessage{GetAccountsByAccessTokenRes{ID: 15361432 Status: Demo
ID: 15516543 Status: Demo
ID: 15516616 Status: Demo
ID: 15419356 Status: Demo
ID: 15480662 Status: Demo
ID: 15466373 Status: Demo
}}
Type: ProtoMessage
Listening...
authorizeTrader('XXXX',15361432)
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:15361432}}
Received: ProtoMessage{ErrorResponse{errorCode:CANT_ROUTE_REQUEST, description:No environment connection}}
Type: ProtoMessage
Listening...
Send: ProtoMessage{PotoOATraderReq}
authorizeTrader('XXX',15516543)
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:15516543}}
Received: ProtoMessage{ErrorResponse{errorCode:INVALID_REQUEST, description:Trading account is not authorized}}
Type: ProtoMessage
Listening...
Received: ProtoMessage{ErrorResponse{errorCode:CANT_ROUTE_REQUEST, description:No environment connection}}

 

07 Feb 2019, 11:41#2
Panagiotis Charalampousposts: 2168since: 13 Jan 2017

Hi Alex,

Probably you are using the wrong host. Can you tell me version of the API, the host you are using and if it is a demo or live account?

Best Regards,

Panagiotis


Head of Community Management at cTrader
07 Feb 2019, 11:46#3
abierbrauerposts: 8since: 29 Jan 2019

Sure, here we go:

 

Host: live.ctraderapi.com

Port: 5035

OpenAPI V2 

and I'm using the generated protobuf messages from Open-API-2.0-.Net-Sample.

The accounts are demo accounts on the live system.

 

 

07 Feb 2019, 11:49#4
Panagiotis Charalampousposts: 2168since: 13 Jan 2017

Hi Alex,

For demo accounts you need to use demo.ctraderapi.com

Best Regards,

Panagiotis


Head of Community Management at cTrader
07 Feb 2019, 12:02#5
abierbrauerposts: 8since: 29 Jan 2019

Works so far, thanks.