HTTP Requests
Basics of Tiger Open API
Note: Users who only need to use the SDK to call the API can skip this section
The API interface is mainly divided into transaction interface and market interface according to function, and can be divided into REST API interface and long connection push interface according to the calling form. Among them, the REST API interface includes the transaction interface and part of the market interface. Data such as order status, real-time market quotations, and in-depth market quotations have high real-time requirements, which are implemented through the persistent connection push interface. The protocols used for persistent connection push are WebSocket and Stomp , both the REST API interface and the push interface require authentication and interface signature when calling
Request address
The domain name has been embedded in the OpenAPI SDK. If you need to access it separately through the protocol, you can contact the administrator in the QQ group、Telegram、Discord to obtain it.
After the developer information is successfully registered, a demo account will be automatically generated. The demo account transaction is also accessed through the link of the official environment, but the underlying trading environment is isolated from each other.
Public request parameters
Parameter | Type | Required | Maximum Length | Description | Example Value |
---|---|---|---|---|---|
tiger_id | string | yes | 10 | ID assigned to developer | 20150129 |
method | string | yes | 128 | interface name | place_order |
charset | string | yes | 10 | The encoding format used by the request, currently supported: UTF-8 | UTF-8 |
sign_type | string | Yes | 10 | The signature algorithm type used by the merchant to generate the signature string, currently supports RSA | RSA |
timestamp | string | yes | 19 | request time, format "yyyy-mm-dd HH:mm:ss" | 2018-05-09 11:30:00 |
version | string | yes | 3 | Interface version, current versions include: 1.0, 2.0. Please refer to the interface documentation for the specific version | 1.0 |
biz_content | string | Yes | - | A collection of request parameters. All business parameters except public parameters are passed in this parameter. For details, refer to each interface access document | |
sign | string | Yes | 344 | The signature string of the request parameter | See the example for details |
account_type | string | No | - | Account type, must be passed during token authentication, the type includes: [GLOBAL, STANDARD] | |
access_token | string | No | - | The token must be passed during authentication. It is used to verify the user's identity and can be obtained through the login interface | |
trade_token | string | No | - | Token authentication is optional, and it must be passed through the relevant interface of order placement, which can be obtained through the transaction password interface |
Public response parameters
Parameter | Type | Required | Description | Example Value |
---|---|---|---|---|
code | string | yes | gateway return code, see: code field description | 40001 |
message | string | yes | gateway return code description, see: code field description | post param is empty |
data | string | No | Business return content, see the specific API interface documentation for details | - |
timestamp | string | yes | timestamp returned by gateway | 1525849042762 |
Pequest example
{
"tiger_id":"1",
"charset":"UTF-8",
"sign_type":"RSA",
"version":"1.0",
"timestamp":"2018-09-01 10:00:00",
"method":"order_no",
"biz_content":"{\"account\":\"DU575569\"}",
"Sign": "QwM4MCdffJ5WK59f + dbFvKMn5Qqw2A5GTA8g0XIAp / Fsvb5fbZUwYzxjznx0jO7VO9Npbzd + ywR6VrMz4liblTMPGDvDnPJP0rGUVF + xbj / 3MBr3vFZ25XheyjfHIpP6f + qhNkn9KdFsviohZAWeplkYjV + OyxwMQmpnkP / vll4 ="
}
Response example
{
"code": 0,
"message": "",
"timestamp": 1525849042762,
"data": {
"orderId": 10000164
}
}
Events
The events API currently supports two methods, one is through the subscription and push interfaces provided in the SDK, and the other is through the http callback address. The http callback address can be added and updated on the developer registration information page. Domain name configuration is supported, but IP and port address configuration is not supported (the developer information page supports filling in ip and port addresses, but does not actually push callback messages. ). The http callback interface can be used to obtain the latest changes in orders, assets and positions, but cannot obtain the latest price changes and deep order data. The subscription interface in the SDK can receive all types of callback messages. If there are no special requirements, it is recommended to use the push interface provided by the SDK first.
If the HTTP callback result push times out or fails, it will try to push it three times repeatedly. If the three pushes time out or fail, the message will not continue to be pushed, but it will not affect the push of subsequent messages.
If the format of the domain name is detected to be illegal, or the request cannot be received and processed normally, the domain name may be added to the blacklist, and no further messages will be sent to the domain name address in the future
The format of the message sent by the event API is:
{
"subject":"Asset",
"data":{
"type":"asset",
"usdCash":854879.28,
"account":"DU575567",
"timestamp":1528719139003
}
}
- Subjects has the following values: OrderStatus (order status change message), Asset (asset change message), Position (position change message), Quote (market price change message), QuoteDepth (deep bid and ask price change news)
- For the field content correspondes to each message type, you can refer to the subscription part of the document