[原文網址](https://connect.spotware.com/docs/available-resources/playground)
### Getting access to the Trading API
使用以下方式建立SSL連接**host:port**
Trading API入口點列表(該列表將使用輔助入口點進行更新,這些入口點將在主要點出現故障時使用):
* Primary:[sandbox-tradeapi.spotware.com:5032](ssl://sandbox-tradeapi.spotware.com:5032)
* Secondary1: coming soon
* Secondary2: coming soon
* Secondary3: coming soon
See[trading API protocol description](https://connect.spotware.com/docs/api-reference/trading-api)to learn more about how it works. Or read[Getting Started Guide](https://connect.spotware.com/docs/api-reference/getting-started)to start your own app quickly.
### OAuth usage examples
**Note 1:**如果您不知道cTrader ID是什么,為什么需要它以及它如何工作,請參閱[the corresponding section](https://connect.spotware.com/docs/available-resources/playground#ctraderID)below. 因為您必須使用OAuth服務。
**Note 2:**如果您不了解OAuth技術,請查看OAuth標準參考[RFC6749: The OAuth 2.0 Authorization Framework](http://tools.ietf.org/html/rfc6749).
#### Getting access token flow
* **Step 1**使用以下鏈接向我們的OAuth授權服務器發起請求。 您將被要求使用您的cTrader ID登錄,請在開始之前創建它,如果您還沒有。
如果您嘗試訪問帳戶貿易信息,請使用此鏈接:
~~~
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 >>>](https://sandbox-connect.spotware.com/apps/auth?&client_id=139_a8QoCbMhGpWyWxpGKhkWeNdrADKzsFV6Ex7FDiDCTEeO5kiqqZ&redirect_uri=https%3A%2F%2Fconnect.spotware.com%2Fdocs%2Favailable-resources%2Fplayground&scope=accounts)
如果您嘗試訪問交易API,請使用以下鏈接:
~~~
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 >>>](https://sandbox-connect.spotware.com/apps/auth?&client_id=139_a8QoCbMhGpWyWxpGKhkWeNdrADKzsFV6Ex7FDiDCTEeO5kiqqZ&redirect_uri=https%3A%2F%2Fconnect.spotware.com%2Fdocs%2Favailable-resources%2Fplayground&scope=trading)
* **Step 2**您的請求將使用授權碼進行響應,授權碼應由您的服務器與訪問令牌交換
**Note:**請記住**授權碼在10秒內到期**,所以你應該在收到后立即交換。 如果代碼已過期,那么您可以再次發送初始請求(步驟1)。
使用以下請求交換代碼:
~~~
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}
~~~
[Exchange the Code with Access Token](https://sandbox-connect.spotware.com/apps/token?grant_type=authorization_code&code=&redirect_uri=https%3A%2F%2Fconnect.spotware.com%2Fdocs%2Favailable-resources%2Fplayground&client_id=7_5az7pj935owsss8kgokcco84wc8osk0g0gksow0ow4s4ocwwgc&client_secret=49p1ynqfy7c4sw84gwoogwwsk8cocg8ow8gc8o80c0ws448cs4)
您將使用JSON文本文件進行響應。 使用記事本打開它以查看訪問令牌和刷新令牌。
要刷新訪問令牌,只需發送以下請求,用正確的數據替換占位符。
~~~
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}
~~~
#### 可用的工具
* cTrader Web:[sandbox-ctweb.spotware.com](https://sandbox-ctweb.spotware.com/)
請參閱下文,了解如何創建cTrader ID,它是什么以及如何將帳戶鏈接到它。
### cTrader ID
了解cTrader ID(cTID)是什么
cTrader ID是個人交易者的個人資料,其中包含交易者的昵稱,電子郵件,頭像等信息.cTID在所有cTrader產品中很常見,可用于在一個地方管理所有交易賬戶(即使他們是用不同的經紀人開設的) )以及訪問cTrader的云功能,如云收藏夾,警報等。此外,使用cTrader ID交易者可以授予他的交易賬戶訪問第三方在線應用程序,解決方案和產品,如交易性能發布者,信號復制器等。
如何創建cTrader ID并將帳戶鏈接到它
1.打開cTrader Web sandbox2-ct.spotware.com
2.使用“Open DEMO accout”,您可以創建自己的模擬賬戶。密碼將在創建帳戶時發送到您指定的電子郵件。
????* **注意:**通過重復此操作,您可以根據需要為調查和測試創建盡可能多的帳戶
3.使用您的DEMO帳戶登錄。
4.使用cTrader終端窗口右上角的“注冊”菜單,您可以創建自己的cTrader ID。只需填寫3個字段:
* nickname (your personal profile nickname)
* email (please specify correct email, the confirmation code will be sent to you)
* password
5.轉到為cTID指定的電子郵件,然后單擊此處的確認鏈接以符合您的cTID創建。
6.如果您使用相同的瀏覽器處理電子郵件和cTWeb - 將打開cTWeb,您將自動使用新的cTID登錄。
7.所有可用帳戶將自動鏈接到您的cTID。
之后,您可以使用您的cTID將您的交易賬戶訪問權限授予與cTrader平臺集成的第三方應用程序。
- 空白目錄
- API Reference 2.0
- Getting Started
- Open Authentication
- Protocol Buffers
- Protobuf Messages Reference
- Open API Messages
- Open API Model Messages
- Open API Error Codes
- Example Projects .NET
- Spotware Proxy Cloud
- Getting Started in C#
- Test Environment
- Playground
- Frequently Asked Questions
- Lesson 1. Your First App
- Lesson 2. Get Trading Data
- Lesson 3. Get Market Data
- Lesson 4. Using Trading API