OpenAPI v2 CANT_ROUTE_REQUEST after receiving the account listing

Created at 07 Feb 2019, 11:14
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AB

abierbrauer

Joined 29.01.2019

OpenAPI v2 CANT_ROUTE_REQUEST after receiving the account listing
07 Feb 2019, 11:14


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}}

 


@abierbrauer
Replies

PanagiotisCharalampous
07 Feb 2019, 11:41

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


@PanagiotisCharalampous

abierbrauer
07 Feb 2019, 11:46

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.

 

 


@abierbrauer

PanagiotisCharalampous
07 Feb 2019, 11:49

Hi Alex,

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

Best Regards,

Panagiotis


@PanagiotisCharalampous

abierbrauer
07 Feb 2019, 12:02

Works so far, thanks.


@abierbrauer