The Open API 2.0 is the new version of the publicly available protobuf-based API developed by Spotware. It allows third-party service providers to integrate additional tools and applications for trading and analysis with the data and functionality from cTrader platform by getting all the required cTID data, market data and performing all possible trading operations on behalf of other cTrader users.
Full documentation can be found on Spotware Open API website
- Download this project.
- Import the project to the chosen IDE as a Maven project.
- Run command
mvn install
to download libraries and compile Protocol Buffer classes. - Register your application as described here. Set
CLIENT_PUBLIC_ID
andCLIENT_SECRET
in application.properties. - Login to Demo cTrader to create an account.
- Generate a token as described here. Set
ACCESS_TOKEN
andCTID_TRADER_ACCOUNT_ID
in application.properties. - Run examples from
openapi2-example
submodule.
- Google Protocol Buffers (Protobuf). Documentation reference. Official site.
- Netty. Official User Guide. Official site.
This is a main codebase to open a channel to the server and send requests in the Protobuf format. Protocol files are located in protobuf directory.
Please note that Protocol Buffer classes (from the package com.xtrader.protocol.openapi.v2
) are generated by the Maven plugin.
So in a just downloaded project java
files in this package are absent.
Several examples to send often used requests:
- authorization
- assets list
- symbols list
- find symbol by ID
- subscribe on price spots
- process Symbol Changed Event
- get symbol conversion chain
File application.properties contains properties to be set:
host
It can be found on Proxies/Endpoints page. Default demo host isdemo.ctraderapi.com
port
Default port is5035
CLIENT_PUBLIC_ID
(54 chars) Client ID from Credentials of your applicationCLIENT_SECRET
(50 chars) Secret from Credentials of your applicationACCESS_TOKEN
(43 chars) Get it in Playground of your applicationCTID_TRADER_ACCOUNT_ID
(number) It isdata.accountId
from "Trading Accounts" in Playground of your application
- For more information, you may contact us: connect@spotware.com.
You can find the terms of use of Spotware Open API 2.0 here.