Playground

Getting access to the Trading API

Establishing SSL connection using following host:port

The list of Trading API entry points (the list will be updated with secondary entry points which are to be used in cases when the primary point is down):

See trading API protocol description to learn more about how it works. Or read Getting Started Guide to start your own app quickly.

OAuth usage examples

Note 1: if you are not aware of what cTrader ID is, why you need this and how it works, please see the corresponding section below. Because you have to have it to play with OAuth services.

Note 2: if you are not aware of OAuth technology please look trough the OAuth standard reference RFC6749: The OAuth 2.0 Authorization Framework.

Getting access token flow

  • Step 1 Initiate request to our OAuth Authorization Server with the link below. You will be asked to log in with your cTrader ID, please create it before start, if you do not already have one.

If you try to get access to accounts Trade Info, please use this link:

https://sandbox-connect.spotware.com/apps/auth?
client_id={your Partner's Public Client ID}&
redirect_uri={your Redirection URI}&
scope=accounts

Send Accounts API OAuth Request >>>

If you try to get access to trading API, please use this link:

https://sandbox-connect.spotware.com/apps/auth?
client_id={your Partner's Public Client ID}&
redirect_uri={your Redirection URI}&
scope=trading

Send Trading API OAuth Request >>>

  • Step 2 Your request will be responded with authorization code which should be exchanged with access token by your server

Note: bear in mind that the authorization code is expiring in 10 seconds, so you should exchange it immediately after receiving. If the code is expired though, so you can send initial request again (Step 1).

Exchange the code with following request:

https://sandbox-connect.spotware.com/apps/token?
grant_type=authorization_code&
code={the authorization code from the response on the previous request}&
redirect_uri={your Redirection URI}&
client_id={your Partner's Public Client ID}&
client_secret={your Partner's Client Secret}

You will be responded with JSON text file. Open it with Notepad to see access token and refresh token.

To refresh access token just send following request replacing the placeholders with correct data.

https://sandbox-connect.spotware.com/apps/token?
grant_type=refresh_token&
refresh_token={your Refresh Token previously received with Access Token}&
redirect_uri={your Redirection URI}&
client_id={your Partner's Public Client ID}&
client_secret={your Partner's Client Secret}

Available tools to play with

See below how to create a cTrader ID, what is it and how to link accounts to it.

cTrader ID

Understanding what cTrader ID (cTID) is

cTrader ID is a personal trader's profile which contains such info like trader's nickname, email, avatar, etc. cTID is common over all cTrader products and can be used to manage all trading accounts in one place (even if they're opened with different brokers) as well as getting access to cTrader's cloud features like Cloud Favorites, Alerts, etc. Also using cTrader ID trader can grant access to his trading accounts to 3rd party online applications, solutions and products like trading performance publishers, signal copiers, etc.

How to create cTrader ID and link accounts to it

  1. Open cTrader Web sandbox2-ct.spotware.com
  2. Using "Open DEMO accout" you can create your own demo account. Password will be sent to your specified email while creating the account.
    • NOTE: by repeating this action you can create as many accounts as you need for your demands of investigation and testing
  3. Sign In with your DEMO account.
  4. Using "Sign Up" menu from the top-right corner of the cTrader terminal window, you can create your own cTrader ID. Just fill 3 fields:
    • nickname (your personal profile nickname)
    • email (please specify correct email, the confirmation code will be sent to you)
    • password
  5. Go to your email specified for cTID and click the confirmation link from there to conform creation of your cTID.
  6. If you use the same browser for your email and cTWeb - cTWeb will be opened and you will be logged in with your new cTID automatically.
  7. All available accounts will automatically be linked to your cTID.

After that you can use your cTID to grant access to your trading accounts to third party apps integrated with cTrader Platform.