Introduction
API Introduction
Welcome to use HotBit API!
This file serves as the only official file of Hotbit API. All API interfaces provided by Hotbit will be continuously updated here. Please follow us frequently.
You may switch and obtain the API of different businesses by clicking the menu above. You may also switch the language of the file by clicking the language button on top right corner.
The examples regarding the requested parameters and response results are listed on the right hand side of the file.
<!-- 1. Provide your UID (The UID must not be involved in any commission return); 2. Provide the snapshots as proofs of maker trading volumes on other trading platforms (for example, 30-day trading volumes or VIP level etc.); 3. Please briefly state your method of market making with no details required. -->.
Update Subscription
Hotbit will publish relevant announcement in advance regarding the adding, update and delisting of any API. It is recommended that you pay attention to and subscribe to our announcement for all latest information.
You may click here here to subscribe to our announcement.
The process of subscription is: Click the "Follow" button on the top right corner of "API Announcement" and login with your account, then click "follow" button again and choose the type of content you intend to follow. By clicking the button, the word displayed on the button will be changed to "following", which means that you have subscribed the content(s) successfully. If you do not have an account, click the "register" button at the bottom left corner and finish the registration process.
Contact Us
If you encounter any problems or that you have any ideas or suggestions regarding our API services, you may contact us via any of the following channels:
- Join our Telegram channel: https://t.me/Hotbit_English
- Send your email to: business@hotbit.io。
Quick Start
Connection Prerequisites
If you intend to use API, please login to web end and finish the application and permission setting of API key first, then start developing and trading based on the detail of this file.
You may click here to create API Key。
After successfully creating the API key, please do remember the following information:
API Key
The encrypted key that allows you to gain access to your APISecret Key
The encrypted key used by the encryption process of signature verification (only visible during application process)
Interface | Description |
---|---|
GET /v2/p1/server.time | Retrieve System Time |
POST /v2/p2/balance.query | Retrieve User Asset |
GET /v2/p2/asset.list | Retrieve all available asset types and asset precision, prec means the number of decimal places |
POST /v2/p2/order.put_limit | Limit Order |
POST /v2/p2/order.cancel | Cancel Order |
POST /v2/p2/order.deals | Retrieve Details of Settled Orders POST /v2/p2/order.finished_detail | Inquiry on settled orders based on order numbers GET /v2/p1/order.book | Retrieve Trading List GET /v2/p1/order.depth | Retrieve Trading Depth POST /v2/p2/order.pending | Inquiry on Unexecuted Orders POST /v2/p2/order.finished | Inquiry on User's Settled Orders GET /v2/p1/market.list | Retrieve List of Transaction Pairs GET /v2/p1/market.last | Retrieve The Latest Price of Designated Transaction Pair GET /v2/p1/market.deals | Inquiry on Transaction Records of Transaction Pair GET /v2/p2/market.user_deals | Inquiry on User's Trading Records GET /v2/p1/market.kline | k chart inquiry GET /v2/p1/market.status | Retrieve various real-time status of market within a designated period of time in the past, such as the latest range of increase or decrease, trading volume, maximum/minimum price etc.GET /v2/p1/market.status_today | Retrieve today's market status GET /v2/p1/market.status24h | Retrieve various status of market within the past 24 hours, such as range of increase or decrease, trading volume, maximum/minimum price etc. GET /v2/p1/market.summary | market summary GET /v2/p1/allticker | Retrieve the latest information of all available transaction pairs
Interface Type
Hotbit provides users with two types of interface, you may choose the appropriate method that suits your own application scenario or preference for the inquiry on market trend, trading or withdrawal.
REST API
REST,which is the abbreviation of Representational State Transfer,is a type of communication mechanism based on HTTP that has gained comparatively more popularity recently. Each URL represents one type of resource.
It is recommended for developers to conduct one-off operations such as trading or withdrawals by using REST API.
WebSocket API
WWebSocket is a new type of HTML5 protocol that realizes the full duplex communications between client end and server, which allows the connection between client end and server to be established through one simple handshake. The server may actively push information to client end based on business rules and regulations.
It is recommended for developers to use WebSocket API to retrieve information such as market trend and transaction depth etc.
Verifications Regarding The Permission Of Interface
Both of the above two types of interfaces include two types of interface, namely public interface and private interface.
Public interface can be used to retrieve basic information and market data. The public interface call can be conducted without verification.
Private interface can be used for the management of trading and account. Each private request must be verified through signature verification process by using your API key.
Connect URLs
You may compare the latency status between api.hotbit.io and ws.hotbit.io and choose to use the one with lower level of latency.
REST API
https://api.hotbit.io/v2/p1/
https://api.hotbit.io/v2/p2/
Websocket Feed
wss://ws.hotbit.io/v2/
Signature Verification
Signature Introduction
It is highly likely that the API request will be tampered during its transmission through the Internet. In order to ensure that your request will not be tampered, apart from public interface (basic information interface, market data interface), all private interface must conduct signature verification process by using your API key for the verification of parameters or parameter values to check if the parameters or parameter values have been tampered during their transmission or not. In order to visit certain interface, each API key is required to obtain appropriate permission. Each newly-created API key requires permission distribution. Before using the interface, please check the permission type of each interface and make sure that your API key enjoy(s) relevant permission.
A legal request is composed of the following sections:
- Method Request Address:which refers to the address of access server api.hotbit.io,for example api.hotbit.io/v2/p2/order/orders。
- API Access Id(AccessKeyId):The Access Key included in the API Key that you applied.
- Signature Method(SignatureMethod):The protocol based on md5 used for the process of calculation on user's signature, in this case, please apply md5.
- Signature Version(SignatureVersion):The version of signature protocol, in this case please apply 2.
- Required and optional parameter:Each method includes a group of required parameters and optional parameters that are used for the definition of API call. You may check these parameters and their meanings in the description of each method.
- It is required to place the request parameter of POST in body.
- Signature:The value generated from signature computation is used to ensure the effectiveness of the signature and that the signature has not been tampered.
Signature Process
Standardize the request that requires signature computation. Considering the fact that during signature computation, the results of computation by using different contents will be totally different, please do standardize the request before signature computation. Please refer to the example below that demonstrates the request regarding the inquiry on the details of the order: The complete request URL regarding the inquiry on the details of the order
https://api.hotbit.io/v2/p2/balance.query?
api_key=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx
&sign=C88F04701D3349D0A93A0164DC5A4CD9
&assets=["BTC","ETH"]
1. Conduct URL programming on parameter and conduct sorting on parameter based on ASCII order
For example, the original order of the request parameter is listed below
api_key=6b97d781-xxxx-xxxx-576d96d0bbebc8c6
&assets=["BTC","ETH"]
After sorting
api_key=6b97d781-5ffd-958f-576d96d0bbebc8c6
&assets=["BTC","ETH"]
2. Connect all parameters by "&" character according to the order above
api_key=6b97d781-5ffd-958f-576d96d0bbebc8c6&assets=["BTC","ETH"]
3. Splice parameter of private key and form the final string that requries signature computation as below.
api_key=6b97d781-5ffd-958f-576d96d0bbebc8c6&assets=["BTC","ETH"]&secret_key=de8063ea6e99bc967ba6395d06fabf50
4. Form the final string that requires signature computation as below
- Use the request string and API private key generated from the previous step as two parameters, call MD5 value.
MD5(api_key=6b97d781-5ffd-958f-576d96d0bbebc8c6&assets=["BTC","ETH"]&secret_key=de8063ea6e99bc967ba6395d06fabf50)
- Turn MD5 value into capitalized, and use the generated value as the digital signature of this interface call.
C88F04701D3349D0A93A0164DC5A4CD9
5.Add the generated digital signature into the path parameter requested
- Add all required verification parameter into the path parameter of interface call
- Add digital signature into path parameter after URL code, parameter name "sign"
The final API request sent to the server should be
POST\n
https://api.hotbit.io/v2/p2/balance.query?api_key=6b97d781-5ffd-958f-576d96d0bbebc8c6&assets=["BTC","ETH"]&sign=C88F04701D3349D0A93A0164DC5A4CD9
Access Instruction
Brief Introduction of Interface
Type of Interface | Link To Different Types of Interface | Introduction |
---|---|---|
System Type | /v2/p1/server.time | Basic Types of Interface |
Order Type | /v2/p2/order.* | Order type of interface, which include order placement, order cancellation, order inquiry and order settlement etc. |
Market Type | /v2/p1/market.* | Public market type of interface, which include market settlement, market depth, market trends etc. |
Asset Type | /v2/p2/balance.* | Asset type of interface, which include records of changes in asset volumes and user assets. |
This category only follows a general rules of classification. Please be aware that part of the interfaces do not follow this category. Please check relevant interface files according to actual situations and requirements. <!--
Rules And Regulations Regarding The Limit On The Frequencies Of Interface Call
- The system only allows each API Key to conduct no more than 10 interface calls within each second.
- If the interface does not require API Ley, then each IP address is allowed to conduct no more than 10 interface calls within each second.
For Example:
- According to the limit on the frequencies of interface call, asset or order type of interfaces are only allowed to conduct no more than 10 times of interface calls within each second.
- According to the limit on the frequencies of interface call, each IP address is allowed to conduct no more than 10 interface calls within each second. -->
Request Format
All API requests are restful,currently, there are only two formats:GET and POST
- GET Request:All parameters are included in the path parameter.
- POST Request,All parameters are sent in the request body in JSON format.
Return Format
The format of all interfaces are in JSON format. There are three fields on the upmost layer of JSON: error, result, id, with the actual data of business included in "result" field.
Please refer to the example of return format below:
Name of Parameter | Data Type | Description |
---|---|---|
error | Object | API returned incorrect content,when API returns correct content, it displayed as "null" |
result | Object | The interface returned data body,when the result is incorrect, it displayed as "null" |
id | int | Request id |
Error Information
API Error Information
Error Code | Description |
---|---|
invalid argument | Incorrect Parameter |
Recommendations
1、For data information of market type, it is recommended to use WebSocket to receive real time data and conduct cache operation on data received.
2、For retrieving latest market price, it is recommended to use market.deals interface or subscribe deals.subscribe by using WebSocket.
Frequently Asked Questions
Relevant Information Regarding Connection and Verification of Signature
Q1:Why do I often experience server offline and timeout?
A:Please check if your experience can be attributed to the following situations:
- If the client end server is located in mainland China, the stability of connection is hard to be guaranteed. It is recommended to use the AWS cloud server located in Singapore instead.
- It is recommended to use the domain name of api.hotbit.io/v2 and ws.hotbit.io/v2 All other domain names are not recommended.
Q2:Why WebSocket has always been disconnected?
A:The common causes of the problem include:
No Pong has been responded, the connection of WebSocket requires the response of Pong after receiving the Ping information sent by the server end for the stability of connection.
Due to certain network connection problems, the server end has not received the Pong information sent from the client end
The disconnection was caused by ceertain network problems.
It is recommended that users should set up reconnection mechanism for the disconnection problem of WebSocket, so that the program will automatically conduct reconnection in case that any unexpected disconnection occurs after the heartbeat (Ping/Pong) information is responded correctly.
Q3:Why the return of signature verification always fails?
A:Please distinguish the difference between the string without using the signature of Secret Key and the string below
POST\n
api.hotbit.io\n
/p2/balance.query\n
api_key=6b97d781-5ffd-958f-576d96d0bbebc8c6&assets=["BTC","ETH"]
Please pay attention to the information listed below:
1、The parameter of the signature should be based on the order of ASCII code, for example, the original parameter is listed as below:
api_key=6b97d781-5ffd-958f-576d96d0bbebc8c6
assets=["BTC","ETH"]
After sorting, the parameter should be:
api_key=6b97d781-5ffd-958f-576d96d0bbebc8c6
assets=["BTC","ETH"]
2、The signature is required to be converted to capitalized form after conducting MD5 computation
3、The request parameter of POST should be included in the signature string.
4、Check whether the time of your computer deviates from the standard time of your area (the deviation should be less than 1 minute)
5、When sending the information of signature verification by WebSocket, the message body does not require URL coding.
6、The Host included by the time of signature should be the same as the Host of interface request.
7、Check if the API Key and Secret Key involve any hidden special characters that may affect the signature
Information Relevant To Market Trend
Q1:Is it possible that the trading volume reflected by the data interface of 24-hour market interface (/market.status24h) will grow negatively?
A:The trading volume and trading value reflected by /market.status24h interface are constantly updated 24-hour data (calculated in every 24 hours), which means it is possible that the accumulated trading volume and trading value of the next 24-hour will be less than the trading volume and trading value of the previous 24-hour.
Q2:How to Retrieve The Latest Final Price?
A:It is recommended to use REST API GET /allticker interface to request the latest final price, or to use WebSocket to subscribe to the theme of deals.update and retrieve the latest final price according to the price included in the returned data.
Q3:When Does The Calculation of K Chart Begin?
A: The calculation period of K Chart is based on Singapore time. For example, the calculation of daily K Chart starts from Singapore time 00:00 and ends at 00:00 of the next day.
Trading Related Information
Q1:How to Retrieve The Information Regarding The Number, Value, Limit on Decimal Places and Precision of Orders Placed
A: You may use Rest API GET /v2/p2/asset.list to retrieve information on relevant transaction pair. By placing orders, please pay attention to the difference between minimum volume of order placement allowed and minimum value of order placement allowed.
Relevant Contents Of Available Assets In The Accounts
Retrieve User's Assets
API Key Permission:Read
Check the balance of designated account, supports the following accounts:
HTTP Request
- GET /p2/balance.query
Request Parameter
Name of Parameter | Required or not | Type | Description | Default Value | Range of Parameter |
---|---|---|---|---|---|
api_key | true | string | The API KEY Requested By The User | ||
sign | true | string | The Signature Value of the requested string | ||
assets | true | json array | The array of token symbol, blank array means retrieve all token assets |
Response Data
Response:
{
"error": null,
"id": 1585283976,
"result": {
"0xBTC":
{
"available": "0",
"freeze": "0"
},
"ETH":
{
"available": "0",
"freeze": "0"
}
}
}
Name of Parameter | Required Or Not | Data Type | Description | Range of Parameter |
---|---|---|---|---|
available | Yes | string | Volume Available | |
freeze | Yes | string | Frozen Volume |
Basic Information
Asset Type And Precision
This interface returns all asset types and precisions
HTTP Request
- GET /p2/asset.list
curl "https://api.hotbit.io/v2/p1/asset.list"
Returned Field
Name of Field | Data Type | Description |
---|---|---|
name | string | Token Type |
prec | int | Number of Decimal Places Rounded |
Response
{
"result":[
{
"name": "BTC",
"prec": 8
},
{
"name": "ETH",
"prec": 8
},
{
"name": "USDT",
"prec": 8
},
],
"error": null,
"id": 1585283976
}
Retrieve The Timestamp of Current System
This interface returns the timestamp of current system.
curl "https://api.hotbit.io/v2/p1/server.time"
HTTP Request
- GET /p1/server.time
Request Parameter
This interface does not accept any parameter
Response
{
"error": null,
"id": 0,
"result": 1585282798
}
Latest Information Of Order Settlement
This interface returns the latest order settlement information of all transaction pairs retrieved
curl "https://api.hotbit.io/v2/p1/allticker"
HTTP Request
- GET /p1/allticker
Request Parameter
This interface does not accept any parameter
Response
{
"date": 1585282798,
"ticker": [
{
"buy": "6711.35",
"close": "6709.14",
"high": "6837.32",
"last": "6709.14",
"low": "6523.3",
"open": "6679.74",
"sell": "6714.73",
"symbol": "BTC_USDT",
"vol": "155414.70091"
},
{
"buy": "137.9",
"close": "138.09",
"high": "140.91",
"last": "138.09",
"low": "133.53",
"open": "136.76",
"sell": "138.01",
"symbol": "ETH_USDT",
"vol": "2919662.76839"
}
]
}
Returned Fields
Name of Field | Data Type | Description |
---|---|---|
symbol | string | Name of Transaction Pair |
buy | string | Buy One Price |
sell | string | Sell One Price |
open | string | Opening Price |
close | string | Closing Price |
high | string | Highest Price |
low | string | Lowest Price |
last | string | Latest Price |
vol | string | Trading Volume |
Market Data
Retrieve The List Of Transaction Pairs
HTTP Request
GET /p1/market.list
Request Parameter
The interface does not accept any parameter.
Response:
{
"error": null,
"result": [
{
"name": "QASHBTC",
"stock": "QASH",
"money": "BTC",
"fee_prec": 4,
"stock_prec": 2,
"money_prec": 8,
"min_amount": "0.1"
},
{
"name": "QASHETH",
"stock": "QASH",
"money": "ETH",
"fee_prec": 4,
"stock_prec": 2,
"money_prec": 8,
"min_amount": "0.0001"
}
],
"id": 1521169333
}
Response Data
Name of Parameter | Required Or Not | Type | Description |
---|---|---|---|
name | Yes | string | Transaction Pair |
stock | Yes | string | Token Type Traded |
money | Yes | string | Token Type Used |
fee_prec | Yes | dobule | Decimal precision set as 4 digits |
stock_prec | Yes | dobule | stock precision |
money_prec | Yes | dobule | money precision |
min_amount | Yes | dobule | Minimum value required for order placement |
Retrieve The Latest Price Of Designated Transaction Pairs
HTTP Request
POST /p1/market.last
Request Parameter
Name of Parameter | Required Or Not | Type | Description |
---|---|---|---|
market | Yes | string | market Type,For example:"BTC/USDT","BCC/USDT" |
Response:
{
"error": null,
"result": "0.07413600",
"id": 1521169525
}
Response Data
Parameter Name | Required Or Not | Type | Description |
---|---|---|---|
result | Yes | dobule | Price |
Inquiry On The Trading Records Of Transaction Pairs
_HTTP _Request
POST /p1/market.deals
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
market | Yes | string | market Type,For example:"BTC/USDT","BCC/USDT" |
limit | Yes | Integer | Limit on number of inquiries(limit <= 1000) |
last_id | Yes | Integer(No Symbol 64 Digit) | Return trading data greater than order_id > last_id |
Response:
{
"error": null,
"result": [],
"id": 1521169562
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
result | Yes | Record |
Inquiry On User's Trading Records
HTTP Request
POST /p2/market.user_deals
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
api_key | Yes | string | User's API KEY |
sign | Yes | Integer | User's Signature Value |
market | Yes | Integer(No Symbol 64 Digit) | Return market name,for example:"BTC/USDT","BCC/USDT" |
offset | Yes | Integer(No symbol 64 Digit) | Offset Position |
limit | Yes | Integer(No Symbol 64 Digit) | Check limit on number |
Response:
{
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
result | Yes | Record |
k Chart Inquiry
HTTP Request
GET /p1/market.kline
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
market | Yes | string | market name,for example:"BTC/USDT","BCC/USDT" |
start_time | Yes | Integer(No Symbol 64 Digit) | Starting Time Stamp(Second) |
end_time | Yes | Integer(No Symbol 64 Digit) | Ending Time Stamp(Second) |
interval | Yes | Integer(32 Digit) | Interval Period,unit second, (Starting time to ending time,total number of periods) |
Response:
{
"error": null,
"result": [
[1525067600, "11714.04", "11710.01", "11778.69", "11697.18", "13.604065", "159329.23062211", "BTCUSDT"],
[1565067660, "11703.47", "11716.65", "11720.55", "11703.47", "14.401973", "168649.82127032", "BTCUSDT"],
[1565067720, "11714.24", "11715.09", "11724.5", "11707.78", "12.287975", "143952.77384769", "BTCUSDT"]
],
"id": 1521169586
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
Array0 | Yes | Integer(No Symbol 64 Digit) | Time Stamp |
Array1 | Yes | double | Opening Price |
Array2 | Yes | double | Closing Price |
Array3 | Yes | double | Highest Price |
Array4 | Yes | double | Lowest Price |
Array5 | Yes | double | Range of Increase |
Array6 | Yes | double | Trading Volume |
Array7 | Yes | string | Market Name |
Retrieve various status such as the range of increase or decrease, trading volume, maximum / lowest price of the market within any designated period of time in the past etc.
HTTP Request
GET /p1/market.status
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
market | Yes | string | market Name,for example:"BTC/USDT","BCC/USDT" |
period | Yes | Integer(32 Digit) | Duration inquired, with second as unit, which means anytime starting from now to the past, for example: 86400 means the past 24 hours. |
Response:
{
"error": null,
"result": {
"period": 10,
"last": "0.0743",
"open": "0.074162",
"close": "0.0743",
"high": "0.0743",
"low": "0.074162",
"volume": "0.314",
"deal": "0.023315531"
},
"id": 1521169247
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
period | Yes | Integer | Duration inquired |
last | Yes | double | Latest Price |
open | Yes | Integer | Opening Price |
close | Yes | Integer | Closing Price |
high | Yes | Integer | Highest Price |
low | Yes | Integer | Lowest Price |
volume | Yes | Integer | Range of Increase |
deal | Yes | Integer | Trading Volume |
Retrieve the market status of the current day
HTTP Request
GET /p1/market.status_today
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
market | Yes | string | market name,for example:"BTC/USDT","BCC/USDT" |
Response:
{
"error": null,
"result": {
"open": "0.074015",
"last": "0.074287",
"high": "0.074485",
"low": "0.073",
"volume": "1141.63",
"deal": "83.11985574"
},
"id": 1521169293
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
last | Yes | double | Latest price |
open | Yes | Integer | Opening Price |
close | Yes | Integer | Closing Price |
high | Yes | Integer | Highest Price |
low | Yes | Integer | Lowest Price |
volume | Yes | Integer | Range of Increase |
deal | Yes | Integer | Trading Volume |
Retrieve the market status of the current day
HTTP Request
GET /p1/market.status24h
Request Parameter
This interface does not accept any parameter.
Response:
{
"TRXETH": {
"period": 86400,
"last": "0.00013199",
"open": "0.00013523",
"close": "0.00013199",
"high": "0.00013723",
"low": "0.00013199",
"volume": "887054.18",
"deal": "119.2565600483",
},
"error": null,
"result": {
"open": "0.074015",
"last": "0.074287",
"high": "0.074485",
"low": "0.073",
"volume": "1141.63",
"deal": "83.11985574"
},
"id": 1521169293
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
period | Yes | double | Cycle |
last | Yes | double | Latest Price |
open | Yes | Integer | Opening Price |
close | Yes | Integer | Closing Price |
high | Yes | Integer | Highest Price |
low | Yes | Integer | Lowest Price |
volume | Yes | Integer | Range of Increase |
deal | Yes | Integer | Trading Volume |
market Introduction
HTTP Request
GET /p1/market.summary
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
markets | Yes | json array | market name json array,for example:["BTCUSD","BCCUSD"],if blank array:[],return all market。 |
Response:
{
"error": null,
"result": [
{
"name": "ETHBTC",
"ask_count": 0,
"ask_amount": "0",
"bid_count": 0,
"bid_amount": "0"
},
{
"name": "QUNBTC",
"ask_count": 2,
"ask_amount": "28",
"bid_count": 2,
"bid_amount": "23"
}
],
"id": 1521169429
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|
Transaction Data
Limit Order Transaction
HTTP Request
POST /p2/order.put_limit
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
api_key | Yes | string | The API KEY applied by the user |
sign | Yes | string | The signature value of the requested string |
market | Yes | string | market name,for example:"BTC/USDT","ETH/USDT" |
side | Yes | Integer | 1 = "sell",2="buy" |
amount | Yes | double | Trading amount |
price | Yes | double | Trading Price |
isfee | Yes | Integer | apply the discount of discount tokens or not 0 = "No(no)",1="Yes(yes)" |
Response:
{
"error": null,
"result":
{
"id":8688803,
"market":"ETHBTC",
"source":"web",
"type":1,
"side":2,
"user":15731,
"ctime":1526971722.164765,
"mtime":1526971722.164765,
"price":"0.080003",
"amount":"0.4",
"taker_fee":"0.0025",
"maker_fee":"0",
"left":"0.4",
"deal_stock":"0",
"deal_money":"0",
"deal_fee":"0",
"status":0 ,
"fee_stock":"HTB",
"alt_fee":"0.5",
"deal_fee_alt":"0.123"
},
"id": 1521169460
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
id | Yes | Integer(No Symbol 64 Digit) | order-ID |
market | Yes | string | Transaction Pair |
source | Yes | string | The identifier of data request source |
type | Yes | string | Order placement type 1-limit order |
side | Yes | string | Identifier of buyer and seller 1-seller, 2-buyer |
user | Yes | Integer(No Symbol 64 Digit) | Identifier of buyer and seller 1-buyer,2-seller |
ctime | Yes | double | #Time of order creation(second) |
mtime | Yes | double | #Time of order update(second) |
price | Yes | double | |
amount | Yes | string | |
taker_fee | Yes | string | |
maker_fee | Yes | string | |
left | Yes | string | |
deal_stock | Yes | string | |
deal_money | Yes | string | |
deal_fee | Yes | string | |
status | Yes | string | #Identifier of order status When true with 0x8, it means the current order is cancelled, when true with 0x80, it means the current order enjoys the discount. |
fee_stock | Yes | string | #Name of Discount Token |
alt_fee | Yes | string | #The discount of discount token |
deal_fee_alt | Yes | string | #Volume deducted from the discount |
Cancel Transaction
HTTP Request
POST /p2/order.cancel
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
api_key | Yes | string | User's API KEY |
sign | Yes | string | User's signature value |
market | Yes | string | market name,for example:"BTC/USDT","ETH/USDT" |
order_id | Yes | Integer(No Symbol 64 Digit) | id that requires the cancellation of transaction |
Response:
{
"error": null,
"result":
{
"id":8688803,
"market":"ETHBTC",
"source":"web",
"type":1,
"side":2,
"user":15731,
"ctime":1526971722.164765,
"mtime":1526971722.164765,
"price":"0.080003",
"amount":"0.4",
"taker_fee":"0.0025",
"maker_fee":"0",
"left":"0.4",
"deal_stock":"0",
"deal_money":"0",
"deal_fee":"0",
"status":0 ,
"fee_stock":"HTB",
"alt_fee":"0.5",
"deal_fee_alt":"0.123"
},
"id": 1521169460
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
id | Yes | Integer(No Symbol 64 Digit) | order-ID |
market | Yes | string | Transaction Pair |
source | Yes | string | Identifier on source of data request |
type | Yes | string | Order placement type 1-limit order |
side | Yes | string | Identifier of buyer and seller 1-Seller,2-Buyer |
user | Yes | Integer(No Symbol 64 Digit) | Identifier of buyer and seller 1-Seller,2-Buyer |
ctime | Yes | double | #Time of order creation(second) |
mtime | Yes | double | #Time of order update(second) |
price | Yes | double | |
amount | Yes | string | |
taker_fee | Yes | string | |
maker_fee | Yes | string | |
left | Yes | string | |
deal_stock | Yes | string | |
deal_money | Yes | string | |
deal_fee | Yes | string | |
status | Yes | string | #Identifier of order status When true with 0x8, it means the current order is cancelled, when true with 0x80, it means the current order enjoys discount. |
fee_stock | Yes | string | #Name of Discount Token |
alt_fee | Yes | string | #Discount Applied to the Discount Token |
deal_fee_alt | Yes | string | #he Volume Deducted as Discount |
Retrieve The Details of Settled Orders
HTTP Request
POST /p2/order.deals
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
api_key | Yes | string | User's API KEY |
sign | Yes | string | User's Signature Value |
offset | Yes | Integer(32 Digit) | Equals to 0, which means search from the latest transaction to previous transactions. |
order_id | Yes | Integer(No Symbol 64 Digit) | Transaction ID,refer to the returned result of "order.put_limit" method |
limit | Yes | Integer(32 Digit) | The maximum volume of "records" allowed to be returned |
Response:
{
"error": null,
"result":
[
{
"id":8688803,
"market":"ETHBTC",
"source":"web",
"type":1,
"side":2,
"user":15731,
"ctime":1526971722.164765,
"mtime":1526971722.164765,
"price":"0.080003",
"amount":"0.4",
"taker_fee":"0.0025",
"maker_fee":"0",
"left":"0.4",
"deal_stock":"0",
"deal_money":"0",
"deal_fee":"0",
"status":0 ,
"fee_stock":"HTB",
"alt_fee":"0.5",
"deal_fee_alt":"0.123"
}
],
"id": 1521169460
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
id | Yes | Integer(No Symbol 64 Digit) | order-ID |
market | Yes | string | Transaction Pair |
source | Yes | string | Identifier on source of data request |
type | Yes | string | Order placement type 1-limit order |
side | Yes | string | Identifier on buyer and seller 1-seller,2-buyer |
user | Yes | Integer(No Symbol 64 Digit) | Identifier on buyer or seller 1-seller,2-buyer |
ctime | Yes | double | #Time of order creation(second) |
mtime | Yes | double | #Time of order update(second) |
price | Yes | double | |
amount | Yes | string | |
taker_fee | Yes | string | |
maker_fee | Yes | string | |
left | Yes | string | |
deal_stock | Yes | string | |
deal_money | Yes | string | |
deal_fee | Yes | string | |
status | Yes | string | #Identifier of order status When true with 0x8, it means the current order is cancelled, when true with 0x80, it means the current order enjoys discount. |
fee_stock | Yes | string | #Name of discount token |
alt_fee | Yes | string | #The discount applied to the discount token |
deal_fee_alt | Yes | string | #The volume deducted as discount |
Inquiry On Settled Orders According To Order Number
HTTP Request
POST /p2/order.finished_detail
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
api_key | Yes | string | User's API KEY |
sign | Yes | string | User's Signature Value |
offset | Yes | Integer(32 Digit) | Equals to 0, which means search from the latest transaction to previous transactions |
order_id | Yes | Integer(No Symbol 64 Digit) | Transaction ID |
Response:
{
"error": null,
"result":
[
{
"id":8688803,
"market":"ETHBTC",
"source":"web",
"type":1,
"side":2,
"user":15731,
"ctime":1526971722.164765,
"mtime":1526971722.164765,
"price":"0.080003",
"amount":"0.4",
"taker_fee":"0.0025",
"maker_fee":"0",
"left":"0.4",
"deal_stock":"0",
"deal_money":"0",
"deal_fee":"0",
"status":0 ,
"fee_stock":"HTB",
"alt_fee":"0.5",
"deal_fee_alt":"0.123"
}
],
"id": 1521169460
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
id | Yes | Integer(No Symbol 64 Digit) | order-ID |
market | Yes | string | Transaction Pair |
source | Yes | string | The identifier on the source of data request |
type | Yes | string | Order placement type 1-limit order |
side | Yes | string | Identifier of buyer and seller 1-seller,2-buyer |
user | Yes | Integer(No Symbol 64 Digit) | Identifier of buyer and seller 1-seller,2-buyer |
ctime | Yes | double | #Time of order creation(second) |
mtime | Yes | double | #Time of order update(second) |
price | Yes | double | |
amount | Yes | string | |
taker_fee | Yes | string | |
maker_fee | Yes | string | |
left | Yes | string | |
deal_stock | Yes | string | |
deal_money | Yes | string | |
deal_fee | Yes | string | |
status | Yes | string | #Identifier of order status When true with 0x8, it means the current order is cancelled, when true with 0x80, it means the current order enjoys discount. |
fee_stock | Yes | string | #Name of Discount Token |
alt_fee | Yes | string | #The discount applied to the discount token |
deal_fee_alt | Yes | string | #Volume deducted as discount |
Retrieve List of Transactions
HTTP Request
POST /p2/order.book
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
market | Yes | string | market name,for example:"BTC/USDT","BCC/USDT" |
side | Yes | string | 1 = "sell",2="buy" |
offset | Yes | Integer(32 Digit) | Offset Position |
limit | Yes | Integer(No Symbol 64 Digit) | The maximum number of "records" to be returned |
Response:
{
"error": null,
"result": {
"offset": 0,
"limit": 10,
"total": 0,
"orders": []
},
"id": 1521169117
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
offset | Yes | Integer(No Symbol 64 Digit) | |
limit | Yes | Integer | |
offset | Yes | Integer | |
total | Yes | Integer(No Symbol 64 Digit) | |
orders | Yes | array |
Retrieve Trading Depth
HTTP Request
POST /p1/order.depth
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
market | Yes | string | market name,for example:"BTC/USDT","BCC/USDT" |
interval | Yes | string | Price Precision |
limit | Yes | Integer(No Symbol 64 Digit) | The maximum number of "records" to be returned |
Response:
{
"error": null,
"result":
{
"asks": [["0.0733858", "0.319"], ["0.0741178", "0.252"], ["0.0742609", "0.03"], ... ["0.1250465", "0.272"]],
"bids": [["0.0730197", "0.275"], ["0.0723", "1.052"], ["0.0722876", "0.302"], ... ["2.0e-7", "1"]]},
"id": 1527559250
}
Response Data
Inquiry On Unexecuted Orders
HTTP Request
POST /p2/order.pending
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
api_key | Yes | string | User's API KEY |
sign | Yes | string | User's Signature Value |
market | Yes | string | market name,for example:"BTC/USDT","BCC/USDT" |
offset | Yes | Integer(32 Digit) | Offset Position |
limit | Yes | Integer(No Symbol 64 Digit) | Maximum number of "records" to be returned |
Response:
{
"error":null,
"result":{
"ETHBTC":{
"limit":50,
"offset":0,
"total":1,
"records":[
{
"id":8688803,
"market":"ETHBTC",
"source":"web",
"type":1,
"side":2,
"user":15731,
"ctime":1526971722.164765,
"mtime":1526971722.164765,
"price":"0.080003",
"amount":"0.4",
"taker_fee":"0.0025",
"maker_fee":"0",
"left":"0.4",
"deal_stock":"0",
"deal_money":"0",
"deal_fee":"0",
"status":0 ,
"fee_stock":"HTB",
"alt_fee":"0.5",
"deal_fee_alt":"0.123"
}
]
}
},
"id":1526971756
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
limit | Yes | Integer(No Symbol 64 Digit) | |
offset | Yes | Integer | |
total | Yes | Integer(No Symbol 64 Digit) | |
records | Yes | array | Refer to order.put_limit |
Inquiry On Users' Settled Orders
HTTP Request
POST /p2/order.finished
Request Parameter
Name of Parameter | Required or Not | Type | Description |
---|---|---|---|
api_key | Yes | string | User's API KEY |
sign | Yes | string | User's Signature Value |
market | Yes | string | market name,for example:"BTC/USDT","BCC/USDT" |
start_time | Yes | Starting Time(second) | Starting Time(second) |
end_time | Yes | Ending Time(second) | The maximum number of "records" to be returned |
offset | Yes | Integer(No Symbol 64 Digit) | Offset Position |
limit | Yes | Integer(No Symbol 64 Digit) | Maximum number of "records" to be returned |
side | Yes | Integer | 1 = "sell",2="buy" |
Response:
"response": {
"error": null,
"id": 1393490,
"result": []
}
Response Data
Name of Parameter | Required or Not | Type | Description |
---|
System Interface
Send Heartbeat
WEBSOCKET
Request:
{
"method":"server.ping",
"params":[],
"id":100
}
Response:
{
"error":null,
"result":"pong",
"id":100
}
- method: server.ping
- params: []
Request Parameter
No
Response Data
No
Retrieve System Time
Request:
{
"method":"server.time",
"params":[],
"id":100
}
Response:
{
"error":null,
"result":1511941406,
"id":100
}
- method: server.time
- params: []
Request Parameter
No
Response Data
Server Time
User Verification
Request:
{
"method":"server.auth",
"params":[api_key,sign],
"id":100
}
Response:
{
"error": null,
"result": {
"status": "success"
},
"id": 100
}
- method: server.auth
- params:
Request Parameter
Name of Parameter | Type of Parameter | Required | Description |
---|---|---|---|
api_key | String | Yes | User's api_key |
sign | String | Yes | Signature Value |
Response Data
Successful or not
Inquiry Interface
Line Data Inquiry
WEBSOCKET
Request:
{
"method":"kline.query",
"params":["EOSETH",145231637,145232657,5],
"id":100
}
Response:
{
"error": null,
"result": [
[
1525798800, # Timestamp
"0.00001790", # Opening Price
"0.00001881", # Closing Price
"0.00001886", # Highest Price
"0.00001790", # Lowest Price
"169033000", # Trading Volume
"3025.69", # Trading Value
"ACATETH" # Transaction Market Name
],
...],
"id": 123
}
- method: kline.query
- params:
Request Parameter
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market | String | Yes | Market Name |
start | Integer | Yes | Starting Time |
end | Integer | Yes | Ending Time |
interval | Integer | Yes | Data Retrieval Period |
Response Data
Please refer to the picture on the right hand side
Inquiry on Latest Price
WEBSOCKET
Request:
{
"method":"price.query",
"params":["BTCBCC"],
"id":100
}
Response:
{
"error": null,
"result": "8000.00000000",
"id": 100
}
- method: price.query
- params: ["market_name"]
Request Parameter
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market | String | Yes | Market Name |
Response Data
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
result | double | Yes | Price |
Inquiry on Current Market Status
WEBSOCKET
Request:
{
"method":"state.query",
"params":["BTCBCC",86400],
"id":100
}
Response:
{
"period": 86400, # period,unit second
"last": "8000", # latest price
"open": "0", # opening price
"close": "0", # closing price
"high": "0", # highest price
"low": "0", # lowest price
"volume": "0", # trading volume
"deal": "0" # trading value
},
- method: state.query
- params:
Request Parameter
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market list | json array | Yes | List of Transaction Pair's Market Name |
interval | Integer | Yes | Period,Unit:Second,for example:86400 means 24 hours |
Response Data
Name of Parameter | Required or not | Type | Description |
---|---|---|---|
period | Yes | Integer | Period |
last | Yes | double | Latest Price |
open | Yes | double | Opening Price |
close | Yes | double | Closing Price |
high | Yes | double | Highest Price |
low | Yes | double | Lowest Price |
volume | Yes | double | Trading Volume |
deal | Yes | double | Trading Volume |
Inquiry on The Market Status of The Current Day
WEBSOCKET
Request:
{
"method":"today.query",
"params":["BTCBCC"],
"id":100
}
Response:
{
"last": "8000", # Latest Price
"open": "0", # Opening Price
"close": "0", # Closing Price
"high": "0", # Highest Price
"low": "0", # Lowest Price
"volume": "0", # Trading Volume
"deal": "0" # Trading Value
},
- method: today.query
- params:
Request Parameter
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market | String | Yes | Market Name |
Response Data
Name of Parameter | Required or not | Type | Description |
---|---|---|---|
last | Yes | double | Latest Price |
open | Yes | double | Opening Price |
close | Yes | double | Closing Price |
high | Yes | double | Highest Price |
low | Yes | double | Lowest Price |
volume | Yes | double | Trading Volume |
deal | Yes | double | Trading Volume |
Inquiry on User's Order Settlement
WEBSOCKET
Request:
{
"method":"deals.query",
"params":["BTCBCC",5,1],
"id":100
}
Response:
{
"error": null,
"result": [
{ "id": 26, "time": 1512454847.188796, "price": "8000", "amount": "1", "type": "buy" },
{ "id": 25, "time": 1512445625.751971, "price": "8000", "amount": "0.125", "type": "buy" },
{ "id": 24, "time": 1512442938.956193, "price": "8000", "amount": "0.125", "type": "buy" },
{ "id": 23, "time": 1512442929.0405071, "price": "8000", "amount": "0.125", "type": "buy" },
{ "id": 22, "time": 1512442927.2021289, "price": "8000", "amount": "0.125", "type": "buy" } ],
"id": 100
}
- method: deals.query
- params:
Request Parameter
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market | String | Yes | Market Name |
limit | Integer | Yes | Maximum Return Volume |
last_id | integer | Yes | The last id starting from the latest order id to the last id in the past (from smaller id number to bigger id number), for example, if there are 5 id altogether, namely 1,2,3,4 and 5, and that the last_id is set as 3, then even if the limit is set as 5, only the data of the two groups of orders under order id 4 and 5 will be returned. |
Response Data
Name of Parameter | Required or not | Type | Description |
---|---|---|---|
id | Yes | double | deal_id |
time | Yes | Integer(No Symbol 32 Digit) | Trading Time |
price | Yes | double | Trading Price |
amount | Yes | double | Volume of Settled Orders |
type | Yes | Integer | Type of Settlement |
Inquiry on The Depth of Order
WEBSOCKET
Request:
{
"method":"depth.query",
"params":["EOSUSDT",100,"1"],
"id":100
}
Response:
{
"error": null,
"result": { "asks": [[ "8000", "20"] ], "bids": [[ "800", "4"] ] },
"id": 100
}
- method: depth.query
- params:
Request Parameter
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market | String | Yes | Market Name |
limit | Integer | Yes | Maximum Volume Returned |
interval | String | Yes | Precision,for example"0.001",the data retrieved will be the type of numbers such as:12.975. Another example"5",you will retrieve numbers such as "15" "20" "10" . |
Response Data
Name of Parameter | Required or not | Type | Description |
---|
Inquiry on User's Unsettled Orders
WEBSOCKET
Request:
{
"method":"order.query",
"params":[["BTCBCC","BTCETH"],0,50],
"id":100
}
or
{
"method":"order.query",
"params":[[],0,50],
"id":100
}
Response:
{
"error": null,
"result": {
"ACATETH": {
"limit": 100,
"offset": 0,
"total": 3,
"records": [
{
"id": 8675864, # Order ID
"market": "ACATETH", # Market Name
"type": 1, # Order Type 1-Limit Order 2-Market Order
"side": 1, # Trading Direction 1-ASK 2-Bid
"user": 15731, # User ID
"ctime": 1524482296.075341, # The Order's Time of Creation
"mtime": 1524482296.075341, # The Order's Time of Modification
"price": "0.00001899", # Price
"amount": "1", # Volume
"taker_fee": "0", # taker fee rate
"maker_fee": "0", # maker fee rate
"left": "1", # Remaining Unsettled Volume
"deal_stock": "0e-8", # Settled Volume
"deal_money": "0e-16", # Settled Value
"deal_fee": "0e-12" # Fee of Settlement
},
...
]
},
……,
"SPHTXBTC":{……}
}
"id": 13
}
- method: order.query
- params:
Request Parameter
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market list | list | Yes | List of market name, if blank, return all market data |
offset | Integer | Yes | offset |
limit | Integer | Yes | Maximum volume returned, less than 101 |
Response Data
Name of Parameter | Type | Description |
---|---|---|
id | double | Order ID |
market | string | Market Name |
type | double | Order Type 1-Limit order 2-market order |
side | double | Trading direction 1-ASK 2-Bid |
user | Integer(No Symbol 32 Digit) | User ID |
ctime | Integer(No Symbol 32 Digit) | The order's time of creation |
mtime | Integer(No Symbol 32 Digit) | The order's time of modification |
price | Integer(No Symbol 32 Digit) | Price |
amount | Integer(No Symbol 32 Digit) | Volume |
taker_fee | Integer(No Symbol 32 Digit) | taker fee rate |
maker_fee | Integer(No Symbol 32 Digit) | maker fee rate |
left | Integer(No Symbol 32 Digit) | Remaining Unsettled Volume |
deal_stock | Integer(No Symbol 32 Digit) | Settled Volume |
deal_money | Integer(No Symbol 32 Digit) | Settled Value |
deal_fee | Integer(No Symbol 32 Digit) | Fee of Settlement |
Inquiry on The User's Settled Orders
WEBSOCKET
Request:
{
"method":"order.history",
"params":["BTCBCC",1511941006,1511941406,0,50],
"id":100}
Response:
{
"error": null,
"result": { "limit": 50, "offset": 0, "total": 0, "records": [] },
"id": 100
}
- method: order.history
- param
Request Parameter
Type of Parameter | Required | Description |
---|---|---|
market | String | Yes |
start_time | Integer | Yes |
end_time | Integer | Yes |
offset | Integer | Yes |
limit | Integer | Yes |
Response Data
Name of Parameter | Type | Description |
---|---|---|
limit | double | |
offset | string | |
total | string | |
records | string |
*Returned Value:Refer to order.query method for returned value. *
Inquiry on User's Asset
WEBSOCKET
Request:
{
"method":"asset.query",
"params":["ETH","BTC"],
"id":100
}
Response:
{
"error": null,
"result": {
"ETH": {
"available": "0", # Available Asset
"freeze": "0" # Frozen Asset
},
"BTC": { "available": "0", "freeze": "0" }
},
"id": 100
}
- method: asset.query
- params: []
Request Parameter
Returned Value:Refer to the example above.
Response Data
Name of Parameter | Type | Description |
---|---|---|
available | double | Available Asset |
freeze | string | Frozen Asset |
Inquiry Regarding The Records of Changes in User's Asset
WEBSOCKET
Request:
{
"method":"balance.history",
"params":["BTC","deposit",1501940406,1513328112,0,100],
"id":100
}
Response:
{
"error": null,
"result": {
"offset": 0,
"limit": 100,
"records": [
{
"time": 1511856143.3754101, # Timestamp
"asset": "USD", # Asset Type
"business":"deposit", # Business Identifier deposit-deposit,freeze-freeze/defreeze,withdraw-withdrawal
"change": "100000", # Change of Asset
"balance": "300000", # Balance of user's asset after the change
"detail": { "id": 10003 } # Other Details
},
...
]
},
"id": 100
}
- method: balance.history
- params:
Request Parameter
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
asset | String | Yes | asset name, which can be null |
business | String | Yes | Name of Business |
start_time | Integer | Yes | Starting Time |
end_time | Integer | Yes | Ending Time |
offset | Integer | Yes | offset |
limit | Integer | Yes | Maximum returned volume, less than 101 |
Response Data
Name of Parameter | Type | Description |
---|---|---|
time | double | Timestamp |
asset | string | Asset Type |
business | string | Business Identifier deposit-deposit,freeze-freeze/defreeze,withdraw-withdrawal |
change | string | Change of Asset |
balance | string | Balance of user's asset after the change |
detail | string | Frozen Asset |
Interface Subscription/Cancellation of Interface Subscription
Subscription of Market Trend
WEBSOCKET
Request:
{
"method":"kline.subscribe",
"params":[ "BTCBCC", 60 ],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: kline.subscribe
- params:
Request Parameter:
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market | String | Yes | Market Name |
interval | Integer | Yes | Period of Data Retrieval |
After the subscription is finished successfully, the subscribed data will be pushed to client end. Please refer to [Market Trend Push] for the content of data.
Market Trend Push
WEBSOCKET
Request:
{
"method": "kline.update",
"params": [[1513135140, "8000", "8000", "8000", "8000", "0", "0", "BTCBCC"]],
"id": null
}
Request Parameter: "params": [ [ 1492358400, # Timestamp "7000.00", # Opening Price "8000.0", # Closing Price "8100.00", # Highest Price "6800.00", # Lowest Price "1000.00" # Settled Volume "123456.00", # Settled Value "BTCBCC" # Market name of transaction pair traded ] ]
Cancellation of Subscription on Market Trend
WEBSOCKET
Request:
{
"method":"kline.unsubscribe",
"params":[],
"id":100
}
Response:
{
"error": null,
"result": {"status": "success"},
"id": 100
}
- method: kline.unsubscribe
- params: []
Request Parameter
Response Data
Subscription of Latest Price
WEBSOCKET
Request:
{
"method":"price.subscribe",
"params":["BTCBCC"],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: price.subscribe
- params: [market]
Request Parameter:
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market | String | Yes | Market Name |
Response Data
Name of Parameter | Description --------- | status | Successful or not
Push of Latest Price
WEBSOCKET
Request:
{
"method": "price.update",
"params": ["BTCBCC", "8000.00000000"],
"id": null
}
- method: price.update
- params: [market,price]
Request Parameter
Name of Parameter | Type | Description |
---|---|---|
market | string | Market Name |
price | string | Latest Price |
Cancellation of Subscription on Latest Price
- method: price.unsubscribe
- params: []
WEBSOCKET
Request:
{
"method":"price.unsubscribe",
"params":[],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
Request Parameter
Response Data
Subscription on Market Status
- method: state.subscribe
- params: market
WEBSOCKET
Request:
{
"method":"state.subscribe",
"params":["BTCBCC","BTCUSD"],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
Request Parameter
Name of Parameter | Description |
---|---|
market | List of the market name of transaction pair traded |
Response Data
Name of Parameter | Description |
---|---|
status | Successful or not |
Push of Market Status
- method: state.update
- params: []
Response:
{
"method": "state.update",
"params": [
"BTCBCC", {
"period": 86400,
"last": "8000",
"open": "0",
"close": "0",
"high": "0",
"low": "0",
"volume": "0",
"deal": "0"
}
],
"id": null
}
Request Parameter
No
Response Data
Please refer to state.query method for returned value
Cancellation of Push on Market Status
WEBSOCKET
Request:
{
"method":"state.unsubscribe",
"params":[],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: state.unsubscribe
- params: []
Subscription on The Market Status of The Current Day
WEBSOCKET
Request:
{
"method":"today.subscribe",
"params":["BTCUSD","BTCBCC"],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: today.subscribe
- params:
Request Parameter:
Name of Parameter | Parameter Type | Required | Description |
---|---|---|---|
market list | String | Yes | List of Market Name |
Push on The Market Status of The Current Day
After the subscription is finished successfully,the server will actively push data to client end.
Response:
{
"method": "today.update",
"params": [
"BTCBCC", {
"open": "8000",
"last": "8000",
"high": "8000",
"low": "8000",
"volume": "0",
"deal": "0"
}
],
"id": null
}
- method: today.update
- params: []
Request Parameter
No
Response Data
Name of Parameter | Required or not | Type | Description |
---|---|---|---|
period | Yes | double | Period |
last | Yes | double | Latest Price |
open | Yes | Integer | Opening Price |
close | Yes | Integer | Closing Price |
high | Yes | Integer | Highest Price |
low | Yes | Integer | Lowest Price |
volume | Yes | double | Settled Volume |
deal | Yes | Integer | Trading Volume |
Cancellation of Subscription on The Market Status of The Current Day
WEBSOCKET
Request:
{
"method":"today.unsubscribe",
"params":[],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: today.unsubscribe
- params: []
Request Parameter
No
Response Data
status Successful or not
Subscription on Order Settlement
WEBSOCKET
Request:
{
"method":"deals.subscribe",
"params":["BTCBCC","BTCUSD"],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: deals.subscribe
- params: [maket]
Request Parameter
| market | List of The Market Name of Transaction Pair Traded
Response Data
status Successful or not
Push on Order Settlement
WEBSOCKET
Request:
{
"method": "deals.update",
"params": [
"BTCBCC", [
{"id": 26, "time": 1512454847.188796, "price": "8000", "amount": "1", "type": "buy"},
{"id": 25, "time": 1512445625.751971, "price": "8000", "amount": "0.125", "type": "buy"},
{"id": 24, "time": 1512442938.956193, "price": "8000", "amount": "0.125", "type": "buy"},
...
{"id": 22, "time": 1512442927.2021289, "price": "8000", "amount": "0.125", "type": "buy"},
{"id": 3, "time": 1512442109.0283101, "price": "8000", "amount": "0.125", "type": "buy"},
{"id": 2, "time": 1512441964.500567, "price": "8000", "amount": "0.125", "type": "buy"},
{"id": 1, "time": 1512441751.9356339, "price": "8000", "amount": "0.125", "type": "buy"}
]
],
"id": null
}
Please refer to the result returned by deals.query
Cancellation of Subscription on Order Settlement
WEBSOCKET
Request:
{
"method":"deals.unsubscribe",
"params":[],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: deals.unsubscribe
- params: []
Request Parameter
No
Response Data
status Successful or not
Subscription on Order Depth
WEBSOCKET
Request:
{
"method":"depth.subscribe",
"params":["EOSUSDT",100,"0.1"],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: depth.subscribe
- "params":[ "BTCBCC", # Market Name 100, # Available price level of order:1, 5, 10, 20, 30, 50, 100 "0.0001" # Precision on price range, available values:"0","0.00000001","0.0000001","0.000001","0.00001", "0.0001", "0.001", "0.01", "0.1" ]
Request Parameter
Name of Parameter | Description |
---|---|
market | Market Name |
price | Order Price |
precision | Precision on Price Range |
Response Data
status Successful or not
Subscription on The Depth of Order in Large Quantities
WEBSOCKET
Request:
{
"method":"depths.subscribe",
"params":[["ETCUSDT",100,"0.1"]],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: depths.subscribe
- params: [[ market. , # market name price, # available price level of order:1, 5, 10, 20, 30, 50, 100 precision # available precisions of price range:"0","0.00000001","0.0000001","0.000001","0.00001", "0.0001", "0.001", "0.01", "0.1" ]]
Request Parameter
Name of Parameter | Description |
---|---|
market | Market Name |
price | Order Price |
precision | Precision of Price Range |
Response Data
status successful or not
Push of Data on Order Depth
WEBSOCKET
Request:
{
"method": "depth.update",
"params": [true, {"asks": [["8000", "20"]], "bids": [["800", "4"]]}, "BTCBCC"],
"id": null
}
- method: depth.update
- params: [
true, #clean: Boolean, true: complete result,false: last returned updated result
{
"asks": [
[
"8000", # price
"20" # volume
],
[ "8000.1", # price "20" # the sum of the total number of all orders with their prices being price≥8000,less than8000.1 ] ], "bids": [ [ "800", "4" ], [ "800.1", "5" ] ] }, "BTCBCC" # Market name of transaction pair traded ]
Description on returned result: Take the example of the precision of price range as 0.1
Cancellation of Subscription on Order Depth
WEBSOCKET
Request:
{
"method":"depth.unsubscribe",
"params":[],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: depth.unsubscribe
- params: []
Subscription on User's Order Status
WEBSOCKET
Request:
{
"method":"order.subscribe",
"params":["BTCBCC","BTCETH"],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: order.subscribe
- params: List of market name
Push on Changes of User's Order
Response:
{
"method": "order.update",
"params": [
1, # Event type regarding the change on order status,Integer value 1-new order, 2-update order, 3-settled completely
{
"id": 422458,
"market": "BTCBCC",
"source": "",
"type": 1, # 1-limit order 2 -market order
"side": 1, # 1-Ask 2-Bid
"user": 5,
"ctime": 1513819599.987308, # create_time
"mtime": 1513819599.987308, # update_time
"price": "8000",
"amount": "10",
"taker_fee": "0.002",
"maker_fee": "0.001",
"left": "10",
"deal_stock": "0",
"deal_money": "0",
"deal_fee": "0" }
],
"id": 102
}
- method: order.update
- params: []
Cancellation on The Subscription of Changes on Order Status
- method: order.unsubscribe
- params: []
WEBSOCKET
Request:
{ "method":"order.unsubscribe",
"params":[],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
Subscription on Information of User Asset
WEBSOCKET
Request:
{
"method":"asset.subscribe",
"params":["BTC","ETH","BCC"],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: asset.subscribe
- params: List of asset name
Push of Information on Change of User Asset
Response:
{
"method": "asset.update",
"params": {
"ETH": { "available": "0", "freeze": "0" },
"BTC": { "available": "0", "freeze": "0" }
},
"id": 100
}
- method: asset.update
- params: []
Unsubscription of Information on User Asset
WEBSOCKET
Request:
{
"method":"asset.unsubscribe",
"params":[],
"id":100
}
Response:
{
"error": null,
"result": { "status": "success" },
"id": 100
}
- method: asset.unsubscribe
- params: []
Errors
The Kittn API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The kitten requested is hidden for administrators only. |
404 | Not Found -- The specified kitten could not be found. |
405 | Method Not Allowed -- You tried to access a kitten with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The kitten requested has been removed from our servers. |
418 | I'm a teapot. |
429 | Too Many Requests -- You're requesting too many kittens! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |