Open API account numbers retrieved are different to the brokers account numbers
Open API account numbers retrieved are different to the brokers account numbers
10 Feb 2020, 03:13
Dear Support,
I am running the CTrader Open API and I have created a CTrader Open API application on their web site according to their instructions.
However when I run the sample application I do not see my list of accounts and I get a permission error when I attempt to trade on my demo account with you.
The problem is that the Open API account numbers are different to the account numbers that you have given me for my account acrigney@gmail.com
Here is the response from the Open API.
Send: ProtoMessage{AppAuthRequest{clientId:496_vI2DH0hQustu5QVfgvrAzjfXABcOsMjxvZ5CdS5YJJFPrGsgp7, clientSecret:Tp3VYWgbIE5QPbLNlVvdzVZf8v4RZ5uznovfOFJvHJHueqQuDo}}
Received: ProtoMessage{ApAuthResponse}
Send: ProtoMessage{GetAccountsByAccessTokenReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:17537049}}
Send: ProtoMessage{PotoOATraderReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:10453609}}
Send: ProtoMessage{PotoOATraderReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:17536979}}
Send: ProtoMessage{PotoOATraderReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:17537170}}
Send: ProtoMessage{PotoOATraderReq}
Received: ProtoMessage{GetAccountsByAccessTokenRes{ID: 17537049 Status: Demo
ID: 17537112 Status: Live
ID: 10453609 Status: Demo
ID: 17537165 Status: Live
ID: 17536979 Status: Demo
ID: 17537170 Status: Demo
}}
Received: ProtoMessage{AccAuthResponse}
Received: ProtoMessage{unknown}
Received: ProtoMessage{AccAuthResponse}
Received: ProtoMessage{unknown}
Received: ProtoMessage{AccAuthResponse}
Received: ProtoMessage{unknown}
Received: ProtoMessage{ErrorResponse{errorCode:INVALID_REQUEST, description:Trading account is not authorized}}
Received: ProtoMessage{AccAuthResponse}
Received: ProtoMessage{Heartbeat}
Received: ProtoMessage{Heartbeat}
And here are the accounts that I have with a few brokers and 3192091 is my demo pepperstone account number.
This app would like to view:
Your cTrader ID (acrigney)
Your email (acrigney@gmail.com)
Get full access for trading accounts (view accounts info and trading):
Demo 4000102 - Scandinavian Capital Markets
Demo 3192091 - Spotware
2038460 - IC Markets
Demo 10346288 - FxPro
Demo 3653646 - IC Markets
Live 8154580 - FxPro
So why is the account number from the Open API different to yours? Same for the other brokers I guess.
Best Regards,
Alistair
Replies
acrigney
10 Feb 2020, 06:40
RE: RE: My borker said that Open API only works for live accounts? that can't be right?
acrigney said: Now my broker peperstone has added a live account for me and linked it to my CTrader id but I get this error when I click GetAccountsList
My live account number is 1038733
Send: ProtoMessage{AppAuthRequest{clientId:496_vI2DH0hQustu5QVfgvrAzjfXABcOsMjxvZ5CdS5YJJFPrGsgp7, clientSecret:Tp3VYWgbIE5QPbLNlVvdzVZf8v4RZ5uznovfOFJvHJHueqQuDo}}
Received: ProtoMessage{ApAuthResponse}
Send: ProtoMessage{GetAccountsByAccessTokenReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:17616995}}
Send: ProtoMessage{PotoOATraderReq}
Received: ProtoMessage{GetAccountsByAccessTokenRes{ID: 17616995 Status: Live
}}
Received: ProtoMessage{ErrorResponse{errorCode:CANT_ROUTE_REQUEST, description:No environment connection}}
Received: ProtoMessage{ErrorResponse{errorCode:INVALID_REQUEST, description:Trading account is not authorized}}
acrigney said: Peperstone just told me that Open API only works for live accounts. Is that correct?
Dear Support,
I am running the CTrader Open API and I have created a CTrader Open API application on their web site according to their instructions.
However when I run the sample application I do not see my list of accounts and I get a permission error when I attempt to trade on my demo account with you.
The problem is that the Open API account numbers are different to the account numbers that you have given me for my account acrigney@gmail.comHere is the response from the Open API.
Send: ProtoMessage{AppAuthRequest{clientId:496_vI2DH0hQustu5QVfgvrAzjfXABcOsMjxvZ5CdS5YJJFPrGsgp7, clientSecret:Tp3VYWgbIE5QPbLNlVvdzVZf8v4RZ5uznovfOFJvHJHueqQuDo}}
Received: ProtoMessage{ApAuthResponse}
Send: ProtoMessage{GetAccountsByAccessTokenReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:17537049}}
Send: ProtoMessage{PotoOATraderReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:10453609}}
Send: ProtoMessage{PotoOATraderReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:17536979}}
Send: ProtoMessage{PotoOATraderReq}
Send: ProtoMessage{AccAuthRequest{CtidTraderAccountId:17537170}}
Send: ProtoMessage{PotoOATraderReq}
Received: ProtoMessage{GetAccountsByAccessTokenRes{ID: 17537049 Status: Demo
ID: 17537112 Status: Live
ID: 10453609 Status: Demo
ID: 17537165 Status: Live
ID: 17536979 Status: Demo
ID: 17537170 Status: Demo
}}
Received: ProtoMessage{AccAuthResponse}
Received: ProtoMessage{unknown}
Received: ProtoMessage{AccAuthResponse}
Received: ProtoMessage{unknown}
Received: ProtoMessage{AccAuthResponse}
Received: ProtoMessage{unknown}
Received: ProtoMessage{ErrorResponse{errorCode:INVALID_REQUEST, description:Trading account is not authorized}}
Received: ProtoMessage{AccAuthResponse}
Received: ProtoMessage{Heartbeat}
Received: ProtoMessage{Heartbeat}
And here are the accounts that I have with a few brokers and 3192091 is my demo pepperstone account number.This app would like to view:
Your cTrader ID (acrigney)
Your email (acrigney@gmail.com)
Get full access for trading accounts (view accounts info and trading):
Demo 4000102 - Scandinavian Capital Markets
Demo 3192091 - Spotware
2038460 - IC Markets
Demo 10346288 - FxPro
Demo 3653646 - IC Markets
Live 8154580 - FxProSo why is the account number from the Open API different to yours? Same for the other brokers I guess.
Best Regards,
Alistair
@acrigney
PanagiotisCharalampous
10 Feb 2020, 09:20
Hi Alistair,
These are not account numbers but account IDs (ProtoOATrader.ctidTraderAccountId). If you want to get the trading account number use the ProtoOATrader.traderLogin field.
Best Regards,
Panagiotis
@PanagiotisCharalampous
acrigney
10 Feb 2020, 10:21
RE:
PanagiotisCharalampous said:
Ok great but why do I get this error? I am sure I have the client id, secret code, account and I have added a trade access token for trade operations.
Received: ProtoMessage{ErrorResponse{errorCode:CANT_ROUTE_REQUEST, description:No environment connection}}
Received: ProtoMessage{ErrorResponse{errorCode:INVALID_REQUEST, description:Trading account is not authorized}}
Hi Alistair,
These are not account numbers but account IDs (ProtoOATrader.ctidTraderAccountId). If you want to get the trading account number use the ProtoOATrader.traderLogin field.
Best Regards,
Panagiotis
@acrigney
PanagiotisCharalampous
10 Feb 2020, 11:04
Hi Alistair,
No environment connection means that the server of the broker of this account is not linked to our Open API proxy. Do you get this message on a consistent basis or was it something temporary?
Best Regards,
Panagiotis
@PanagiotisCharalampous
acrigney
12 Feb 2020, 03:49
RE:
Thanks mate, its the first time I have used the Open API in a long time, it fails every time now. I contacted my broker and they sent me this
Pepperstone current account holders with a minimum of AUD$250m trading volume per month may apply for a FIX Demo Environment to test our FIX Capabilities.
If you'd like to discuss API trading, please email premium@pepperstone.com.
But the Open API is not a FIX api?
PanagiotisCharalampous said:
Hi Alistair,
No environment connection means that the server of the broker of this account is not linked to our Open API proxy. Do you get this message on a consistent basis or was it something temporary?
Best Regards,
Panagiotis
@acrigney
PanagiotisCharalampous
12 Feb 2020, 08:34
Hi Alistair,
Please send me clientID, clientSecret and a valid token at community@spotware.com and I will have a look at what is going on.
Best Regards,
Panagiotis
@PanagiotisCharalampous
acrigney
12 Feb 2020, 13:48
RE:
Mate my broker just got back to me today and told me they need to give me access to the Open API.
Here was the comment from them.
I have just spoken to our operation team manager, we are very happy to offer you the Open API from our end.
If you would like us to put this on your trading account, please reply to confirm with your trading account number, so I can lodge a request soon from my side.
Here is my client id/secret
private string _clientId = "496_vI2DH0hQustu5QVfgvrAzjfXABcOsMjxvZ5CdS5YJJFPrGsgp7";
private string _clientSecret = "Tp3VYWgbIE5QPbLNlVvdzVZf8v4RZ5uznovfOFJvHJHueqQuDo";
and here are some tokens from one of my brokers.
private string _accountToken = "oTDQmYI80fl841VS7JwSt3bG1lAG5YriqxA_cfpz4lM";
private string _tradeToken = "p0mvYdG78l369cjdeUmAh3r5Fs2GCqLUaAoewAglGOE";
private string _apiHost = "demo.ctraderapi.com";
PanagiotisCharalampous said:
Hi Alistair,
Please send me clientID, clientSecret and a valid token at community@spotware.com and I will have a look at what is going on.
Best Regards,
Panagiotis
@acrigney
... Deleted by UFO ...
... Deleted by UFO ...
... Deleted by UFO ...
... Deleted by UFO ...
acrigney
10 Feb 2020, 04:19
RE: My borker said that Open API only works for live accounts? that can't be right?
acrigney said: Peperstone just told me that Open API only works for live accounts. Is that correct?
@acrigney