Enable API Authority:
Users` API shall create on user center. API Key is an access key offered for API users, API Secret is applied to sign required parameter.
Attention: These two parameters are related to your account security, please do not disclose the parameters to anyone.
Parameters of the signature:
All the users` submitted parameters have to be signed except “sign”.
Rules: order the parameters to be signed (compare the first letters of all parameters and order them in a, b, c, d, if the first letter is encountered,
check the second letter, and so forth), add API Secret according to parameter and make ascending order to connect parameters.
For example: make signature for following parameters (take API Secret = “IPC2018195703”)
string[] parameters={"market=X/BTC","apiKey=195703","type=1","price=10000"};
After ordering parameters+apiSecre{"apiKey=195703",apiSecret="IPC2018195703","market=X/BTC","price=10000","type=1"}
The string to be generated for signature is:
195703hkd2018195703X/BTC100001
Then, apply MD5 algorithm to calculate the character string, and acquire signed character string (this string is assigned to parameter sign)
The signature and MD5 are as follows:
public static String md5(String string) {
byte[] hash;
try {
hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 is unsupported", e);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("MessageDigest not support MD5Util", e);
}
StringBuilder hex = new StringBuilder(hash.length * 2);
for (byte b : hash) {
if ((b & 0xFF) < 0x10) hex.append("0");
hex.append(Integer.toHexString(b & 0xFF));
}
return hex.toString();
}
/**
* <p>
* Join the parameter values in ascending order by parameter name
* @param appSecret
* @param params
* @return
*/
public static String sign(String appSecret, TreeMap<String, String> params) {
StringBuilder paramValues = new StringBuilder();
params.put("appSecret", appSecret);
for (Map.Entry<String, String> entry : params.entrySet()) {
paramValues.append(entry.getValue());
}
return md5(paramValues.toString());
}
1 Introduction:
- a summary on cryptoasset trading pairs available on the exchange
URL Request:
Request Methods:
- GET
Parameter:
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": [{
"ticker_id": "USDT_UCNY",
"base": "USDT",
"target": "UCNY"
}, {
"ticker_id": "BTC_USDT",
"base": "BTC",
"target": "USDT"
}]
}
Return parameter description
Name | Type | Description |
ticker_id | string | Identifier of a ticker with delimiter to separate base/target, eg. BTC_ETH |
base | string | Symbol/currency code of a the base cryptoasset, eg. BTC |
target | string | Symbol/currency code of the target cryptoasset, eg. ETH |
2 Introduction:
- Get all trading pair information
URL Request:
Request Methods:
- GET
Parameter:
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": [{
"ticker_id": "USDT_UCNY",
"base_currency": "USDT",
"target_currency": "UCNY",
"last_price": "6.2063",
"base_volume": "11320474.523",
"target_volume": "69938728.85344426",
"bid": "6.1189",
"ask": "6.3127",
"high": "6.5554",
"low": "6.0688"
}, {
"ticker_id": "BTC_USDT",
"base_currency": "BTC",
"target_currency": "USDT",
"last_price": "48527.91",
"base_volume": "229.852284",
"target_volume": "11212881.13491958",
"bid": "48735.03",
"ask": "45799.32",
"high": "49047.4",
"low": "48493.24"
}]
}
返回参数说明
Name | Type | Description |
ticker_id | string | Identifier of a ticker with delimiter to separate base/target, eg. BTC_ETH |
base_currency | string | Symbol/currency code of base pair, eg. BTC |
target_currency | string | Symbol/currency code of target pair, eg. ETH |
last_price | decimal | Last transacted price of base currency based on given target currency |
base_volume | decimal | 24 hour trading volume in base pair volume |
target_volume | decimal | 24 hour trading volume in target pair volume |
bid | decimal | Current highest bid price |
ask | decimal | Current lowest ask price |
high | decimal | Rolling 24-hours highest transaction price |
low | decimal | Rolling 24-hours lowest transaction price |
3 Introduction:
- Order book depth details
URL Request:
Request Methods:
- GET
Parameter:
Name | Required | Type | Description |
ticker_id | Y | String | A ticker such as "BTC_ETH", with delimiter between different cryptoassets |
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": {
"ticker_id": "BTC_USDT",
"timestamp": "1639473000000",
"bids": [
["48735.05", "0.200128"],
["48735.04", "0.1005"]
],
"asks": [
["48735.06", "0.203296"],
["48735.07", "0.108152"]
]
}
}
Return parameter description
Name | Type | Description |
ticker_id | string | A pair such as "BTC_ETH" |
timestamp | decimal | Unix timestamp in milliseconds for when the last updated time occurred. |
bids | decimal | An array containing 2 elements. The offer price and quantity for each bid order |
asks | decimal | An array containing 2 elements. The ask price and quantity for each ask order |
4 Introduction:
- Historical Data
URL Request:
Request Methods:
- GET
Parameter:
Name | Required | Type | Description |
ticker_id | Y | String | A pair such as "BTC_ETH", with delimiter between different cryptoassets |
type | N | String | To indicate nature of trade - buy/sell |
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": {
"buy": [{
"trade_id": 187317363,
"price": 293392.99,
"base_volume": 0.000146,
"target_volume": 42.83537654,
"trade_timestamp": 1639470864000,
"type": "buy"
}],
"sell": [{
"trade_id": 187314280,
"price": 297323.2,
"base_volume": 0.45152,
"target_volume": 134247.37126400,
"trade_timestamp": 1639470624000,
"type": "sell"
}]
}
}
Return parameter description
Name | Type | Description |
trade_id | integer | A unique ID associated with the trade for the currency pair transaction |
price | decimal | Transaction price in base pair volume. |
base_volume | decimal | Transaction amount in base pair volume. |
target_volume | decimal | Transaction amount in target pair volume. |
trade_timestamp | long | Unix timestamp in milliseconds for when the transaction occurred. |
type | string |
Buy – Identifies an ask that was removed from the order book. Sell – Identifies a bid that was removed from the order book. |
5 Introduction:
- Get all the market info
URL Request:
Request Methods:
- POST
Parameter:
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": {
"X/BTC": {
"id": 4,
"low": 1e-8,
"high": 0.00019921,
"last": 0.0000154,
"sell": 0.0000154,
"buy": 0.000015,
"volume": 3391.6974,
"turnover": 0.0180623959,
"changeRate": 76900
},
"ETH/BTC": {
"id": 1,
"low": 0.0587,
"high": 0.058713,
"last": 0.058713,
"sell": 0.058713,
"buy": 0.0587,
"volume": 3.0002,
"turnover": 0.17614254,
"changeRate": 0.0221465076660988074957
},
"X/ETH": {
"id": 2,
"low": 0.000188,
"high": 0.00023399,
"last": 0.00018915,
"sell": 0.00018915,
"buy": 0.000188,
"volume": 454,
"turnover": 0.09322828,
"changeRate": -5.0547133821905431181608
},
"UNC/BTC": {
"id": 5,
"low": 0,
"high": 0,
"last": 0,
"sell": 0,
"buy": 0,
"volume": 0,
"turnover": 0,
"changeRate": 0
}
}
}
Return parameter description
Name | Type | Description |
---|---|---|
id | int | Id of market |
low | decimal | Market floor |
high | decimal | Maximum market price |
last | decimal | Latest market price |
sell | decimal | Sell for first price |
buy | decimal | Buy for first price |
volume | decimal | Volume |
turnover | decimal | Turnover |
changeRate | decimal | price limit |
6 Introduction:
- Get individual market info
URL Request:
Request Methods:
- POST
Parameter:
Name | Required | Type | Description |
---|---|---|---|
market | Y | String | Market name Coin name with "/" and plate name (BTC /usd) |
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": {
"X/BTC": {
"id": 4,
"low": 1e-8,
"high": 0.00019921,
"last": 0.0000154,
"sell": 0.0000154,
"buy": 0.000015,
"volume": 3391.6974,
"turnover": 0.0180623959,
"changeRate": 76900
}
}
}
Return parameter description
name | type | description |
---|---|---|
id | int | id |
low | decimal | Market floor |
high | decimal | Maximum market price |
last | decimal | Latest market price |
sell | decimal | Sell for first price |
buy | decimal | Buy for first price |
volume | decimal | volume |
turnover | decimal | turnover |
changeRate | decimal | changeRate |
7 Introduction:
- Gets the user's individual market transaction records
URL Request:
Request Methods:
- POST
Parameter:
Name | Required | Type | Description |
---|---|---|---|
apiKey | Y | String | ApiKey |
market | Y | string | Coin name , Coin name shall be followed by "/" and plate name (BTC /usd) |
sign | Y | String | Parameters of the signature |
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": {
"id": 4,
"amount": 1e-8,
"qty": 0.00019921,
"price": 0.0000154,
"type": 1,
"createTime": 2018/07/24,
"createTimeMs": 1133916974,
}
}
Return parameter description
Name | Type | Description |
---|---|---|
id | int | Id |
amount | decimal | Amount |
qty | decimal | Qty |
price | decimal | Price |
type | String | Type 1buy 2sell |
createTime | String | CreateTime |
createTimeMs | long | Create the time milliseconds value |
8 Introduction:
- Obtain individual market transaction records
URL Request:
Request Methods:
- POST
Parameter:
Name | Required | Type | Description |
---|---|---|---|
market | Y | String | Coin name , Coin name shall be followed by "/" and plate name (BTC /usd) |
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": {
"id": 4,
"amount": 1e-8,
"qty": 0.00019921,
"price": 0.0000154,
"type": 1,
"createTime": 2018/07/24,
"createTimeMs": 1133916974,
}
}
Return parameter description
name | type | description |
---|---|---|
id | int | id |
amount | decimal | sales |
qty | decimal | The sales amount |
price | decimal | The market price |
type | String | type 1buy 2sell |
createTime | String | Creation time |
createTimeMs | long | Create the time milliseconds value |
9 Introduction:
- Acquire the depth of currency market
URL Request:
Request Methods:
- POST
Parameter:
Name | Required | Type | Description |
---|---|---|---|
market | Y | String | Coin name , Coin name shall be followed by "/" and plate name (BTC /usd) |
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": {
"buyList": [
{
"amount": 0.000015,
"price": 0.000015,
"qty": 1
},
{
"amount": 6.5824e-8,
"price": 0.00001496,
"qty": 0.0044
},
{
"amount": 0.0002986,
"price": 0.00001493,
"qty": 20
},
{
"amount": 0.012325414984,
"price": 0.00001492,
"qty": 826.1002
}
],
"sellList": [
{
"amount": 1.54e-9,
"price": 0.0000154,
"qty": 0.0001
}
]
}
}
Return parameter description
name | type | description |
---|---|---|
amount | decimal | amount |
price | decimal | The price |
qty | decimal | The sales amount |
10 Introduction:
- Gets all user balances
URL Request:
Request Methods:
- POST
Parameter:
Name | Required | Type | Description |
---|---|---|---|
apiKey | Y | String | The user applies for the key |
sign | Y | String | Parameters of the signature |
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": {
"exchangePrice": {
"usdtPrice": 180.710456121,
"cnyPrice": 1204.446278568,
"btcPrice": 0.0224152268028,
"ethPrice": 0.3817047
},
"banlance": [
{
"id": 3,
"userId": 195703,
"banlance": 2018,
"freezingBanlance": 0,
"totalBanlance": 2018,
"shortName": "X",
"fullName": "X",
"image": "http://uniex.oss-cn-hongkong.aliyuncs.com/test/coin/2018/07/18/b369665c07014c06a720d1f9ddf0cecd.png",
"btcPrice": null,
"cnyPrice": 1204.446278568,
"usdtPrice": 180.710456121,
"withdrawFee": 0.02,
"allowRecharge": 1,
"allowWithdraw": 1,
"type": 3,
"minOutQty": 2,
"maxOutQty": 100000,
"useredWithdrawal": null,
"withdrawalAmount": null,
"tradeList": null
},
{
"id": 1,
"userId": 195703,
"banlance": 0,
"freezingBanlance": 0,
"totalBanlance": 0,
"shortName": "ETH",
"fullName": "ethereum",
"image": "http://uniex.oss-cn-hongkong.aliyuncs.com/test/2018/07/12/9bdaa67c911d41a0b95155929ace74dc.png",
"btcPrice": null,
"cnyPrice": 0,
"usdtPrice": 0,
"withdrawFee": 0.01,
"allowRecharge": 1,
"allowWithdraw": 1,
"type": 1,
"minOutQty": 0.05,
"maxOutQty": 10,
"useredWithdrawal": null,
"withdrawalAmount": null,
"tradeList": null
},
{
"id": 4,
"userId": null,
"banlance": 0,
"freezingBanlance": 0,
"totalBanlance": 0,
"shortName": "UNC",
"fullName": "UNC",
"image": "http://uniex.oss-cn-hongkong.aliyuncs.com/test/coin/2018/07/18/c1cf7d57619b4660be35c98b9ddbb010.jpg",
"btcPrice": null,
"cnyPrice": 0,
"usdtPrice": 0,
"withdrawFee": 100,
"allowRecharge": 1,
"allowWithdraw": 1,
"type": 3,
"minOutQty": 120,
"maxOutQty": 10000,
"useredWithdrawal": null,
"withdrawalAmount": null,
"tradeList": null
},
{
"id": 2,
"userId": null,
"banlance": 0,
"freezingBanlance": 0,
"totalBanlance": 0,
"shortName": "BTC",
"fullName": "Bitcoin",
"image": "http://uniex.oss-cn-hongkong.aliyuncs.com/test/2018/07/12/f6aa453663b54e5a91697656e252765a.png",
"btcPrice": null,
"cnyPrice": 0,
"usdtPrice": 0,
"withdrawFee": 0.001,
"allowRecharge": 1,
"allowWithdraw": 1,
"type": 2,
"minOutQty": 0.005,
"maxOutQty": 10,
"useredWithdrawal": null,
"withdrawalAmount": null,
"tradeList": null
}
]
}
}
Return parameter description
name | type | description |
---|---|---|
banlance | decimal | The amount available |
freezingBanlance | decimal | Amount frozen |
totalBanlance | decimal | The total amount of |
11 Introduction:
- Getting user orders
URL Request:
Request Methods:
- POST
Parameter:
Name | Required | Type | Description |
---|---|---|---|
apiKey | Y | String | apiKey |
status | N | int | State -1 has withdrawn order 0 has placed order 1 to match 2 in the match 3 has finished matching |
market | Y | String | Coin name Coin name Coin name shall be followed by "/" and plate name (BTC /usd) |
sign | Y | String | The signature |
Return the sample
{
"code": "1",
"success": true,
"msg": null,
"data": [
{
"createTime": 1534301587000,
"price": 0.045682,
"qty": 0.9046,
"id": 1440590,
"type": 1,
"trade_qty": 0,
"status": 1
},
{
"createTime": 1534301586000,
"price": 0.045819,
"qty": 0.7907,
"id": 1440589,
"type": 2,
"trade_qty": 0,
"status": 1
}
]
}
Return parameter description
name | type | description |
---|---|---|
id | int | The order id |
type | int | Order type: 1buy 2sell |
price | decimal | The sales price |
qty | decimal | The number |
trade_qty | decimal | The trade number |
status | int | State -1 has withdrawn order 0 has placed order 1 to match 2 in the match 3 has finished matching |
12 Introduction:
- Add a Order
URL Request:
Request Methods:
- POST
Parameter:
Name | Required | Type | Description |
---|---|---|---|
apiKey | Y | String | ApiKey |
market | Y | string | Coin name Coin name Coin name shall be followed by "/" and plate name (BTC /usd) |
type | Y | int | Type 1 buy 2 sell |
price | Y | decimal | Price |
qty | Y | decimal | The number |
sign | Y | String | The signature |
Return the sample
{
"code": "1",
"success": true,
"msg": "order success!",
"data": null
}
13 Introduction:
- Cancel Order
URL Request:
Request Methods:
- POST
Parameter:
Name | Required | Type | Description |
---|---|---|---|
apiKey | Y | String | ApiKey |
userId | Y | String | UserId |
id | Y | String | OrderId |
sign | Y | String | The signature |
Return the sample
{
"code": "1",
"success": true,
"msg": "cancel order success!",
"data": null
}