1. Account management
1.1. Get account
Get account of specified user address and currency.
请求
GET /accounts/{address}/{currency}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
currency |
String |
currency name. |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"userId" : 0,
"currency" : "",
"hold" : 0,
"available" : 0,
"status" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
Account id. (auto-generated) |
|
userId |
long |
0 |
Referenced user id. |
|
currency |
String |
Size(min=1,max=32) |
Referenced currency name. |
|
hold |
BigDecimal |
0 |
Balance held by unfilled orders. |
|
available |
BigDecimal |
0 |
Balance available to place orders. |
|
status |
AccountStatus |
Account status: "Normal", "ForceWithdrawing". |
1.2. Get accounts
List accounts of specified user address that ordered by currency name.
请求
GET /accounts/{address}?offset=0&limit=10 HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
offset |
int |
0 |
offset to fetch accounts. |
|
limit |
int |
10 |
limit to fetch accounts ([1, 50]). |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"userId" : 0,
"currency" : "",
"hold" : 0,
"available" : 0,
"status" : ""
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of accounts. |
|
items |
List |
Fetched accounts. |
||
items.[].id |
long |
0 |
Account id. (auto-generated) |
|
items.[].userId |
long |
0 |
Referenced user id. |
|
items.[].currency |
String |
Size(min=1,max=32) |
Referenced currency name. |
|
items.[].hold |
BigDecimal |
0 |
Balance held by unfilled orders. |
|
items.[].available |
BigDecimal |
0 |
Balance available to place orders. |
|
items.[].status |
AccountStatus |
Account status: "Normal", "ForceWithdrawing". |
1.3. Get deposit records
Get user deposit records of specified currency.
请求
GET /accounts/deposit/{address}/{currency}?offset=0&limit=100&asc=false HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
currency |
String |
currency name. |
||
offset |
int |
0 |
offset to fetch records. |
|
limit |
int |
100 |
limit to fetch records. ([1, 500]) |
|
asc |
boolean |
false |
in time ascending order. |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"userAddress" : "",
"currency" : "",
"amount" : 0,
"txSender" : "",
"txHash" : ""
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of deposit records. |
|
items |
List |
Fetched deposit records. |
||
items.[].id |
long |
0 |
Deposit record id. (auto-generated) |
|
items.[].userAddress |
String |
User address that deposit to. |
||
items.[].currency |
String |
Deposit currency. |
||
items.[].amount |
BigDecimal |
0 |
Deposit amount of currency. |
|
items.[].txSender |
String |
Sender of the deposit transaction on blockchain. |
||
items.[].txHash |
String |
Deposit transaction hash on blockchain. |
||
items.[].createTime |
Timestamp |
Record creation timestamp. |
1.4. Get all deposit records
Get user deposit records of all currencies.
请求
GET /accounts/deposit/{address}?offset=0&limit=100&asc=false HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
offset |
int |
0 |
offset to fetch records. |
|
limit |
int |
100 |
limit to fetch records. ([1, 500]) |
|
asc |
boolean |
false |
in time ascending order. |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"userAddress" : "",
"currency" : "",
"amount" : 0,
"txSender" : "",
"txHash" : ""
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of deposit records. |
|
items |
List |
Fetched deposit records. |
||
items.[].id |
long |
0 |
Deposit record id. (auto-generated) |
|
items.[].userAddress |
String |
User address that deposit to. |
||
items.[].currency |
String |
Deposit currency. |
||
items.[].amount |
BigDecimal |
0 |
Deposit amount of currency. |
|
items.[].txSender |
String |
Sender of the deposit transaction on blockchain. |
||
items.[].txHash |
String |
Deposit transaction hash on blockchain. |
||
items.[].createTime |
Timestamp |
Record creation timestamp. |
1.5. Withdraw
请求
POST /accounts/withdraw HTTP/1.1
Content-Type: application/json
{
"userAddress" : "",
"currency" : "",
"amount" : 0,
"recipient" : "",
"burn" : 0,
"relayContract" : "",
"fee" : 0,
"timestamp" : 0,
"signature" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
userAddress |
String |
User address. |
||
currency |
String |
Currency to withdraw. |
||
amount |
BigDecimal |
0 |
The amount of currency to withdraw. |
|
recipient |
String |
The destination address to withdraw. |
||
burn |
boolean |
0 |
Whether to burn tokens after withdrawal to ERC777 contract. If false, withdraw tokens to ERC777 contract on Conflux. If true, different tokens have different behaviors as following: 1) For cross-chain tokens, e.g. cETH, cBTC, withdraw back to the original blockchain. 2) For CFX tokens, withdraw back to CFX account on Conflux. 3) Otherwise, burn should be false. |
|
relayContract |
String |
Optional relay contract address to withdraw. E.g. Withdraw ETH/USDT to any defi contract on Ethereum. For assets on Conflux chain, it could be null or empty. For cross chain assets, use zero address 0x0000...0000 (of length 42 with 0x prefix) if not required. |
||
fee |
BigDecimal |
0 |
Expected withdrawal fee. |
|
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
signature |
String |
Signature of the withdraw request. |
1.6. Get withdraw records
Get user withdraw records of specified currency.
请求
GET /accounts/withdraw/{address}/{currency}?offset=0&limit=100&asc=false HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
currency |
String |
currency name. |
||
offset |
int |
0 |
offset to fetch records. |
|
limit |
int |
100 |
limit to fetch records. ([1, 500]) |
|
asc |
boolean |
false |
in time ascending order. |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"type" : "",
"userAddress" : "",
"currency" : "",
"amount" : "BigDecimal.ZERO",
"destination" : "",
"burn" : 0,
"relayContract" : "",
"fee" : "BigDecimal.ZERO",
"timestamp" : 0,
"hash" : "",
"signature" : "",
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of withdraw records. |
|
items |
List |
Fetched withdraw records. |
||
items.[].id |
long |
0 |
Withdraw record id. (auto-generated) |
|
items.[].type |
WithdrawType |
Withdraw type: "OffChain", "OnChainRequest", "OnChainForce". |
||
items.[].userAddress |
String |
User address to withdraw. |
||
items.[].currency |
String |
Withdraw currency. |
||
items.[].amount |
BigDecimal |
BigDecimal.ZERO |
Amount of currency to withdraw. |
|
items.[].destination |
String |
Destination address to withdraw. |
||
items.[].burn |
boolean |
0 |
Whether to burn tokens after withdrawal to ERC777 contract. |
|
items.[].relayContract |
String |
Optional relay contract address to withdraw. E.g. Withdraw ETH/USDT to any defi contract on Ethereum. |
||
items.[].fee |
BigDecimal |
BigDecimal.ZERO |
Expected withdrawal fee. |
|
items.[].timestamp |
long |
0 |
Record timestamp (UNIX time in milliseconds). |
|
items.[].hash |
String |
Message hash in case of withdraw off chain. |
||
items.[].signature |
String |
Signature in case of withdraw off chain. |
||
items.[].status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
items.[].txHash |
String |
Transaction hash of settlement on blockchain. |
||
items.[].txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
items.[].createTime |
Timestamp |
Create timestamp. |
||
items.[].updateTime |
Timestamp |
Update timestamp. |
1.7. Get all withdraw records
Get user withdraw records of all currencies.
请求
GET /accounts/withdraw/{address}?offset=0&limit=100&asc=false HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
offset |
int |
0 |
offset to fetch records. |
|
limit |
int |
100 |
limit to fetch records. ([1, 500]) |
|
asc |
boolean |
false |
in time ascending order. |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"type" : "",
"userAddress" : "",
"currency" : "",
"amount" : "BigDecimal.ZERO",
"destination" : "",
"burn" : 0,
"relayContract" : "",
"fee" : "BigDecimal.ZERO",
"timestamp" : 0,
"hash" : "",
"signature" : "",
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of withdraw records. |
|
items |
List |
Fetched withdraw records. |
||
items.[].id |
long |
0 |
Withdraw record id. (auto-generated) |
|
items.[].type |
WithdrawType |
Withdraw type: "OffChain", "OnChainRequest", "OnChainForce". |
||
items.[].userAddress |
String |
User address to withdraw. |
||
items.[].currency |
String |
Withdraw currency. |
||
items.[].amount |
BigDecimal |
BigDecimal.ZERO |
Amount of currency to withdraw. |
|
items.[].destination |
String |
Destination address to withdraw. |
||
items.[].burn |
boolean |
0 |
Whether to burn tokens after withdrawal to ERC777 contract. |
|
items.[].relayContract |
String |
Optional relay contract address to withdraw. E.g. Withdraw ETH/USDT to any defi contract on Ethereum. |
||
items.[].fee |
BigDecimal |
BigDecimal.ZERO |
Expected withdrawal fee. |
|
items.[].timestamp |
long |
0 |
Record timestamp (UNIX time in milliseconds). |
|
items.[].hash |
String |
Message hash in case of withdraw off chain. |
||
items.[].signature |
String |
Signature in case of withdraw off chain. |
||
items.[].status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
items.[].txHash |
String |
Transaction hash of settlement on blockchain. |
||
items.[].txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
items.[].createTime |
Timestamp |
Create timestamp. |
||
items.[].updateTime |
Timestamp |
Update timestamp. |
1.8. Transfer
Transfer asset to one or multiple recipients.
请求
POST /accounts/transfer HTTP/1.1
Content-Type: application/json
{
"userAddress" : "",
"currency" : "",
"recipients" : {
"" : 0
},
"timestamp" : 0,
"signature" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
userAddress |
String |
User address to transfer. |
||
currency |
String |
Currency to transfer. |
||
recipients |
Map |
Recipients to receive the asset (at most 10). Key is recipient address, and value is transfer amount. |
||
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
signature |
String |
Request signature. |
1.9. Get transfer records
Get user transfer records of specified currency.
请求
GET /accounts/transfer/{address}/{currency}?offset=0&limit=100&asc=false HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
currency |
String |
currency name. |
||
offset |
int |
0 |
offset to fetch records. |
|
limit |
int |
100 |
limit to fetch records. ([1, 500]) |
|
asc |
boolean |
false |
in time ascending order. |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"userAddress" : "",
"currency" : "",
"recipients" : {
"" : 0
},
"timestamp" : 0,
"hash" : "",
"signature" : "",
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of transfer records. |
|
items |
List |
Fetched transfer records. |
||
items.[].id |
long |
0 |
Withdraw record id. (auto-generated) |
|
items.[].userAddress |
String |
User address to transfer. |
||
items.[].currency |
String |
Currency to transfer. |
||
items.[].recipients |
Map |
Recipients to receive the asset. Key is recipient address, and value is transfer amount. |
||
items.[].timestamp |
long |
0 |
UNIX time in milliseconds. |
|
items.[].hash |
String |
EIP712 message hash. |
||
items.[].signature |
String |
Request signature. |
||
items.[].status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
items.[].txHash |
String |
Transaction hash of settlement on blockchain. |
||
items.[].txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
items.[].createTime |
Timestamp |
Create timestamp. |
||
items.[].updateTime |
Timestamp |
Update timestamp. |
1.10. Get all transfer records
Get user transfer records of all currencies.
请求
GET /accounts/transfer/{address}?offset=0&limit=100&asc=false HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
offset |
int |
0 |
offset to fetch records. |
|
limit |
int |
100 |
limit to fetch records. ([1, 500]) |
|
asc |
boolean |
false |
in time ascending order. |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"userAddress" : "",
"currency" : "",
"recipients" : {
"" : 0
},
"timestamp" : 0,
"hash" : "",
"signature" : "",
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of transfer records. |
|
items |
List |
Fetched transfer records. |
||
items.[].id |
long |
0 |
Withdraw record id. (auto-generated) |
|
items.[].userAddress |
String |
User address to transfer. |
||
items.[].currency |
String |
Currency to transfer. |
||
items.[].recipients |
Map |
Recipients to receive the asset. Key is recipient address, and value is transfer amount. |
||
items.[].timestamp |
long |
0 |
UNIX time in milliseconds. |
|
items.[].hash |
String |
EIP712 message hash. |
||
items.[].signature |
String |
Request signature. |
||
items.[].status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
items.[].txHash |
String |
Transaction hash of settlement on blockchain. |
||
items.[].txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
items.[].createTime |
Timestamp |
Create timestamp. |
||
items.[].updateTime |
Timestamp |
Update timestamp. |
2. Common information
2.1. Get system timestamp
Get the current system timestamp in milliseconds.
请求
GET /common/timestamp HTTP/1.1
响应
HTTP/1.1 200 OK
2.2. Get system timezone ID
请求
GET /common/timezone HTTP/1.1
响应
HTTP/1.1 200 OK
2.3. Get Boomflow address
请求
GET /common/boomflow HTTP/1.1
响应
HTTP/1.1 200 OK
2.4. Get chain ID
Get the chain ID of Conflux network used by DEX.
请求
GET /common/chainid HTTP/1.1
响应
HTTP/1.1 200 OK
2.5. Get fee configuration
Get the fee configuration of DEX that used for trade settlement.
请求
GET /common/fee HTTP/1.1
响应
HTTP/1.1 200 OK
{
"takerFeeRate" : "BigDecimal.ZERO",
"makerFeeRate" : "BigDecimal.ZERO",
"strategy" : "FeeStrategy.ForFree",
"feeRecipient" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
takerFeeRate |
BigDecimal |
BigDecimal.ZERO |
Fee rate for taker order. |
|
makerFeeRate |
BigDecimal |
BigDecimal.ZERO |
Fee rate for maker order. |
|
strategy |
FeeStrategy |
FeeStrategy.ForFree |
Fee strategy: ForFree, FeeToDex or FeeToMaker. |
|
feeRecipient |
String |
Fee recipient for strategy FeeToDex. |
3. Currency management
3.1. Get currency
Get currency of specified currency name or id.
请求
GET /currencies/{nameOrId}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
nameOrId |
String |
currency name or id. |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"name" : "",
"contractAddress" : "",
"tokenAddress" : "",
"decimalDigits" : 0,
"crossChain" : 0,
"minimumWithdrawAmount" : 0
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
int |
0 |
Currency id. (auto-generated) |
|
name |
String |
Size(min=1,max=32) |
Currency name. |
|
contractAddress |
String |
Size(min=42,max=42) |
CRCL contract address. |
|
tokenAddress |
String |
Size(min=42,max=42) |
ERC777 contract address. |
|
decimalDigits |
int |
0 |
Currency decimal digits |
|
crossChain |
boolean |
0 |
True to indicate a cross chain currency, which is allowed to withdraw to the original chain. |
|
minimumWithdrawAmount |
BigDecimal |
0 |
Minimum withdraw amount. |
3.2. Get currencies
List currencies that ordered by name.
请求
GET /currencies?offset=0&limit=10 HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
offset |
int |
0 |
offset to fetch currencies. |
|
limit |
int |
10 |
limit to fetch currencies ([1, 50]). |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"name" : "",
"contractAddress" : "",
"tokenAddress" : "",
"decimalDigits" : 0,
"crossChain" : 0,
"minimumWithdrawAmount" : 0
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of currencies. |
|
items |
List |
Fetched currencies. |
||
items.[].id |
int |
0 |
Currency id. (auto-generated) |
|
items.[].name |
String |
Size(min=1,max=32) |
Currency name. |
|
items.[].contractAddress |
String |
Size(min=42,max=42) |
CRCL contract address. |
|
items.[].tokenAddress |
String |
Size(min=42,max=42) |
ERC777 contract address. |
|
items.[].decimalDigits |
int |
0 |
Currency decimal digits |
|
items.[].crossChain |
boolean |
0 |
True to indicate a cross chain currency, which is allowed to withdraw to the original chain. |
|
items.[].minimumWithdrawAmount |
BigDecimal |
0 |
Minimum withdraw amount. |
3.3. Get cross-chain tokens
请求
GET /currencies/crosschain/tokens HTTP/1.1
响应
HTTP/1.1 200 OK
[ {
"address" : "",
"name" : "",
"decimals" : 0,
"withdrawFee" : 0,
"minWithdrawAmount" : 0
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].address |
String |
Token (ERC777) address on Conflux. |
||
[].name |
String |
Token name, e.g. btc, eth or ERC20 token address. |
||
[].decimals |
int |
0 |
Token decimals in original chain, e.g. BTC(8), USDT(6). |
|
[].withdrawFee |
BigDecimal |
0 |
Withdraw fee to sponsor. |
|
[].minWithdrawAmount |
BigDecimal |
0 |
Minimum withdraw amount. |
4. Market data
4.1. Get last trade
Get the latest trade of specified product.
请求
GET /market/trades/latest?product= HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
product |
String |
product name. |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"productId" : 0,
"takerOrderId" : 0,
"makerOrderId" : 0,
"price" : 0,
"amount" : 0,
"side" : "",
"takerFee" : 0,
"makerFee" : 0,
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
Trade id. (auto-generated) |
|
productId |
int |
0 |
Referenced product id. |
|
takerOrderId |
long |
0 |
Referenced taker order id. |
|
makerOrderId |
long |
0 |
Referenced maker order id. |
|
price |
BigDecimal |
0 |
Trade price from maker order. |
|
amount |
BigDecimal |
0 |
Trade amount. |
|
side |
OrderSide |
Taker order side: "Buy", "Sell". |
||
takerFee |
BigDecimal |
0 |
Trade fee of taker side. For "Buy" order, it is base currency. For "Sell" order, it is quote currency. |
|
makerFee |
BigDecimal |
0 |
Trade fee of maker side. For "Buy" order, it is base currency. For "Sell" order, it is quote currency. |
|
status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
txHash |
String |
Transaction hash of settlement on blockchain. |
||
txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
createTime |
Timestamp |
Create timestamp. |
||
updateTime |
Timestamp |
Update timestamp. |
4.2. Get last closing price with time
Provide time to client with last closing price.
请求
GET /market/trades/last-closing-price?product= HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
product |
String |
4.3. Get last closing price
Get the latest closing price of specified product name.
Deprecated, use '/trades/last-closing-price' instead.
请求
GET /market/trades/latestclosingprice?product= HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
product |
String |
product name. |
响应
HTTP/1.1 200 OK
4.4. Get trades
List trades of specified product in time descending order.
请求
GET /market/trades?product=&limit=20 HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
product |
String |
product name. |
||
limit |
int |
20 |
limit to fetch trades ([1:200]). |
响应
HTTP/1.1 200 OK
[ {
"id" : 0,
"productId" : 0,
"takerOrderId" : 0,
"makerOrderId" : 0,
"price" : 0,
"amount" : 0,
"side" : "",
"takerFee" : 0,
"makerFee" : 0,
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].id |
long |
0 |
Trade id. (auto-generated) |
|
[].productId |
int |
0 |
Referenced product id. |
|
[].takerOrderId |
long |
0 |
Referenced taker order id. |
|
[].makerOrderId |
long |
0 |
Referenced maker order id. |
|
[].price |
BigDecimal |
0 |
Trade price from maker order. |
|
[].amount |
BigDecimal |
0 |
Trade amount. |
|
[].side |
OrderSide |
Taker order side: "Buy", "Sell". |
||
[].takerFee |
BigDecimal |
0 |
Trade fee of taker side. For "Buy" order, it is base currency. For "Sell" order, it is quote currency. |
|
[].makerFee |
BigDecimal |
0 |
Trade fee of maker side. For "Buy" order, it is base currency. For "Sell" order, it is quote currency. |
|
[].status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
[].txHash |
String |
Transaction hash of settlement on blockchain. |
||
[].txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
[].createTime |
Timestamp |
Create timestamp. |
||
[].updateTime |
Timestamp |
Update timestamp. |
4.5. Get ticks
List ticks of specified granularity.
请求
GET /market/tickers?product=&period=&endTimestamp=0&limit=150 HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
product |
String |
product name. |
||
period |
String |
interval of 2 ticks. Supported values are: 1min, 5min, 15min, 30min, 60min, 1day, 1week, 1month. |
||
endTimestamp |
long |
0 |
end timestamp to fetch ticks. Default value is current server timestamp. |
|
limit |
int |
150 |
limit to fetch ticks ([1, 2000]). |
响应
HTTP/1.1 200 OK
[ {
"id" : 0,
"productId" : 0,
"granularity" : 0,
"open" : 0,
"high" : 0,
"low" : 0,
"close" : 0,
"baseCurrencyVolume" : 0,
"quoteCurrencyVolume" : 0,
"count" : 0
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].id |
long |
0 |
Tick id. (auto-generated) |
|
[].productId |
int |
0 |
Referenced product id. |
|
[].granularity |
int |
0 |
Tick granularity in minutes. |
|
[].open |
BigDecimal |
0 |
Tick open value. |
|
[].high |
BigDecimal |
0 |
Tick high value. |
|
[].low |
BigDecimal |
0 |
Tick low value. |
|
[].close |
BigDecimal |
0 |
Tick close value. |
|
[].baseCurrencyVolume |
BigDecimal |
0 |
Total volume of base currency. |
|
[].quoteCurrencyVolume |
BigDecimal |
0 |
Total volume of quote currency. |
|
[].count |
int |
0 |
Total number of trades. |
|
[].createTime |
Timestamp |
Tick creation timestamp, truncated. |
||
[].updateTime |
Timestamp |
Last update timestamp. |
4.6. Get merged tick
Get the merged tick in the last 24 hours for specified product.
请求
GET /market/tickers/merged/{product}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
product |
String |
product name. |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"productId" : 0,
"granularity" : 0,
"open" : 0,
"high" : 0,
"low" : 0,
"close" : 0,
"baseCurrencyVolume" : 0,
"quoteCurrencyVolume" : 0,
"count" : 0
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
Tick id. (auto-generated) |
|
productId |
int |
0 |
Referenced product id. |
|
granularity |
int |
0 |
Tick granularity in minutes. |
|
open |
BigDecimal |
0 |
Tick open value. |
|
high |
BigDecimal |
0 |
Tick high value. |
|
low |
BigDecimal |
0 |
Tick low value. |
|
close |
BigDecimal |
0 |
Tick close value. |
|
baseCurrencyVolume |
BigDecimal |
0 |
Total volume of base currency. |
|
quoteCurrencyVolume |
BigDecimal |
0 |
Total volume of quote currency. |
|
count |
int |
0 |
Total number of trades. |
|
createTime |
Timestamp |
Tick creation timestamp, truncated. |
||
updateTime |
Timestamp |
Last update timestamp. |
4.7. Batch get merged ticks
Get the merged ticks in the last 24 hours for specified products in batch.
请求
GET /market/tickers/merged HTTP/1.1
响应
HTTP/1.1 200 OK
{
"" : {
"id" : 0,
"productId" : 0,
"granularity" : 0,
"open" : 0,
"high" : 0,
"low" : 0,
"close" : 0,
"baseCurrencyVolume" : 0,
"quoteCurrencyVolume" : 0,
"count" : 0
}
}
4.8. Get depth
Get the price aggregated depth for the specified product.
请求
GET /market/depth?product=&depth=5&step=0 HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
product |
String |
product name. |
||
depth |
int |
5 |
depth to fetch. ([1, 20]) |
|
step |
int |
0 |
aggregate precision. ([0, 5]) |
5. Order API
5.1. Place order
Place a new order and send to the exchange to be matched.
请求
POST /orders/place HTTP/1.1
Content-Type: application/json
{
"clientOrderId" : "",
"address" : "",
"product" : "",
"type" : "",
"side" : "",
"price" : 0,
"amount" : 0,
"feeAddress" : "",
"feeRateTaker" : 0,
"feeRateMaker" : 0,
"timestamp" : 0,
"signature" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
clientOrderId |
String |
Max(64) |
Optional client defined order identity, which is unique for a user. |
|
address |
String |
User address. |
||
product |
String |
Product name. |
||
type |
OrderType |
Order type: "Limit", "Market". |
||
side |
OrderSide |
Order side: "Buy", "Sell". |
||
price |
BigDecimal |
0 |
Order price for "Limit" order type only. |
|
amount |
BigDecimal |
0 |
Order amount for "Limit" order type or "Market-Sell" order. For "Market-Buy" order, it is the total order value. |
|
feeAddress |
String |
Address to earn the trade fee. |
||
feeRateTaker |
double |
0 |
Trade fee rate for trade as taker (e.g. 0.01 means 1%), precision is 6. |
|
feeRateMaker |
double |
0 |
Trade fee rate for trade as maker (e.g. 0.01 means 1%), precision is 6. |
|
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
signature |
String |
Order signature. |
响应
HTTP/1.1 200 OK
5.2. Place order test
Test the EIP712 message of place order request.
请求
POST /orders/place/test HTTP/1.1
Content-Type: application/json
{
"clientOrderId" : "",
"address" : "",
"product" : "",
"type" : "",
"side" : "",
"price" : 0,
"amount" : 0,
"feeAddress" : "",
"feeRateTaker" : 0,
"feeRateMaker" : 0,
"timestamp" : 0,
"signature" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
clientOrderId |
String |
Max(64) |
Optional client defined order identity, which is unique for a user. |
|
address |
String |
User address. |
||
product |
String |
Product name. |
||
type |
OrderType |
Order type: "Limit", "Market". |
||
side |
OrderSide |
Order side: "Buy", "Sell". |
||
price |
BigDecimal |
0 |
Order price for "Limit" order type only. |
|
amount |
BigDecimal |
0 |
Order amount for "Limit" order type or "Market-Sell" order. For "Market-Buy" order, it is the total order value. |
|
feeAddress |
String |
Address to earn the trade fee. |
||
feeRateTaker |
double |
0 |
Trade fee rate for trade as taker (e.g. 0.01 means 1%), precision is 6. |
|
feeRateMaker |
double |
0 |
Trade fee rate for trade as maker (e.g. 0.01 means 1%), precision is 6. |
|
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
signature |
String |
Order signature. |
响应
HTTP/1.1 200 OK
{
"hash" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
message |
Object |
EIP712 message. |
||
hash |
String |
EIP712 message hash. |
5.3. Cancel order
Submit a request to cancel an order.
请求
POST /orders/{id}/cancel HTTP/1.1
Content-Type: application/json
{
"timestamp" : 0,
"signature" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
order id. |
|
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
signature |
String |
Signature of the order cancellation request |
5.4. Cancel order by client order ID
Submit a request to cancel an order by client order ID.
请求
POST /orders/{address}/{clientOrderId}/cancel HTTP/1.1
Content-Type: application/json
{
"timestamp" : 0,
"signature" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
clientOrderId |
String |
client order ID. |
||
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
signature |
String |
Signature of the order cancellation request |
5.5. Get order
请求
GET /orders/{id}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
order id. |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"clientOrderId" : "",
"productId" : 0,
"userId" : 0,
"type" : "",
"side" : "",
"status" : "",
"price" : 0,
"amount" : 0,
"feeAddress" : "",
"feeRateTaker" : 0,
"feeRateMaker" : 0,
"filledAmount" : 0,
"filledFunds" : 0,
"timestamp" : 0,
"hash" : "",
"signature" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
Order id. (auto-generated) |
|
clientOrderId |
String |
Optional client defined order identity, which is unique for a user. |
||
productId |
int |
0 |
Referenced product id. |
|
userId |
long |
0 |
Referenced user id. |
|
createTime |
Timestamp |
Order creation timestamp. |
||
updateTime |
Timestamp |
Last update timestamp. |
||
type |
OrderType |
Order type: "Limit", "Market". |
||
side |
OrderSide |
Order side: "Buy", "Sell". |
||
status |
OrderStatus |
Order status: "New", "Open", "Cancelling", "Cancelled", "Filled". |
||
price |
BigDecimal |
0 |
Order price for "Limit" order type only. |
|
amount |
BigDecimal |
0 |
Order amount for "Limit" order type or "Market-Sell" order. For "Market-Buy" order, it is the total order value. |
|
feeAddress |
String |
Address to earn the trade fee. |
||
feeRateTaker |
double |
0 |
Trade fee rate for trade as taker (e.g. 0.01 means 1%), precision is 6. |
|
feeRateMaker |
double |
0 |
Trade fee rate for trade as maker (e.g. 0.01 means 1%), precision is 6. |
|
filledAmount |
BigDecimal |
0 |
Filled amount of base currency. |
|
filledFunds |
BigDecimal |
0 |
Filled funds of quote currency. |
|
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
hash |
String |
Order hash. |
||
signature |
String |
Order signature. |
5.6. Get order by client order ID
请求
GET /orders/{address}/{clientOrderId}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
clientOrderId |
String |
client order ID. |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"clientOrderId" : "",
"productId" : 0,
"userId" : 0,
"type" : "",
"side" : "",
"status" : "",
"price" : 0,
"amount" : 0,
"feeAddress" : "",
"feeRateTaker" : 0,
"feeRateMaker" : 0,
"filledAmount" : 0,
"filledFunds" : 0,
"timestamp" : 0,
"hash" : "",
"signature" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
Order id. (auto-generated) |
|
clientOrderId |
String |
Optional client defined order identity, which is unique for a user. |
||
productId |
int |
0 |
Referenced product id. |
|
userId |
long |
0 |
Referenced user id. |
|
createTime |
Timestamp |
Order creation timestamp. |
||
updateTime |
Timestamp |
Last update timestamp. |
||
type |
OrderType |
Order type: "Limit", "Market". |
||
side |
OrderSide |
Order side: "Buy", "Sell". |
||
status |
OrderStatus |
Order status: "New", "Open", "Cancelling", "Cancelled", "Filled". |
||
price |
BigDecimal |
0 |
Order price for "Limit" order type only. |
|
amount |
BigDecimal |
0 |
Order amount for "Limit" order type or "Market-Sell" order. For "Market-Buy" order, it is the total order value. |
|
feeAddress |
String |
Address to earn the trade fee. |
||
feeRateTaker |
double |
0 |
Trade fee rate for trade as taker (e.g. 0.01 means 1%), precision is 6. |
|
feeRateMaker |
double |
0 |
Trade fee rate for trade as maker (e.g. 0.01 means 1%), precision is 6. |
|
filledAmount |
BigDecimal |
0 |
Filled amount of base currency. |
|
filledFunds |
BigDecimal |
0 |
Filled funds of quote currency. |
|
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
hash |
String |
Order hash. |
||
signature |
String |
Order signature. |
5.7. Get order cancellation details
请求
GET /orders/{id}/cancel/detail? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
cancelled order id. |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"orderId" : 0,
"reason" : "",
"timestamp" : 0,
"signature" : "",
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
Order cancellation id. (auto-generated) |
|
orderId |
long |
0 |
Order id. |
|
reason |
CancelOrderReason |
Cancellation reason: "CustomerRequested", "MarketOrderPartialFilled", "OnChainForceWithdrawRequested", "AdminRequested". |
||
timestamp |
long |
0 |
UNIX time in milliseconds. |
|
signature |
String |
Order cancellation signature. |
||
status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
txHash |
String |
Transaction hash of settlement on blockchain. |
||
txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
createTime |
Timestamp |
Create timestamp. |
||
updateTime |
Timestamp |
Update timestamp. |
5.8. Get opened orders
Get user opened orders of specified product or all products.
请求
GET /orders/open?address=&product=&offset=0&limit=100&asc=true HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
product |
String |
product name, empty for all products. |
||
offset |
int |
0 |
offset to fetch orders. |
|
limit |
int |
100 |
limit to fetch orders. ([1, 500]) |
|
asc |
boolean |
true |
in time ascending order. |
响应
HTTP/1.1 200 OK
[ {
"id" : 0,
"clientOrderId" : "",
"productId" : 0,
"userId" : 0,
"type" : "",
"side" : "",
"status" : "",
"price" : 0,
"amount" : 0,
"feeAddress" : "",
"feeRateTaker" : 0,
"feeRateMaker" : 0,
"filledAmount" : 0,
"filledFunds" : 0,
"timestamp" : 0,
"hash" : "",
"signature" : ""
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].id |
long |
0 |
Order id. (auto-generated) |
|
[].clientOrderId |
String |
Optional client defined order identity, which is unique for a user. |
||
[].productId |
int |
0 |
Referenced product id. |
|
[].userId |
long |
0 |
Referenced user id. |
|
[].createTime |
Timestamp |
Order creation timestamp. |
||
[].updateTime |
Timestamp |
Last update timestamp. |
||
[].type |
OrderType |
Order type: "Limit", "Market". |
||
[].side |
OrderSide |
Order side: "Buy", "Sell". |
||
[].status |
OrderStatus |
Order status: "New", "Open", "Cancelling", "Cancelled", "Filled". |
||
[].price |
BigDecimal |
0 |
Order price for "Limit" order type only. |
|
[].amount |
BigDecimal |
0 |
Order amount for "Limit" order type or "Market-Sell" order. For "Market-Buy" order, it is the total order value. |
|
[].feeAddress |
String |
Address to earn the trade fee. |
||
[].feeRateTaker |
double |
0 |
Trade fee rate for trade as taker (e.g. 0.01 means 1%), precision is 6. |
|
[].feeRateMaker |
double |
0 |
Trade fee rate for trade as maker (e.g. 0.01 means 1%), precision is 6. |
|
[].filledAmount |
BigDecimal |
0 |
Filled amount of base currency. |
|
[].filledFunds |
BigDecimal |
0 |
Filled funds of quote currency. |
|
[].timestamp |
long |
0 |
UNIX time in milliseconds. |
|
[].hash |
String |
Order hash. |
||
[].signature |
String |
Order signature. |
5.9. Get incompleted orders
Get user incompleted orders of specified product or all products, including new submitted,
opened, pending and canceling orders.
请求
GET /orders/incompleted?address=&product=&status=&offset=0&limit=100&asc=true HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
product |
String |
product name, empty for all products. |
||
status |
OrderStatus |
order status, null for all incompleted status. Possible values: New, Open, Cancelling, Pending. |
||
offset |
int |
0 |
offset to fetch orders. |
|
limit |
int |
100 |
limit to fetch orders. ([1, 500]) |
|
asc |
boolean |
true |
in time ascending order. |
响应
HTTP/1.1 200 OK
[ {
"id" : 0,
"clientOrderId" : "",
"productId" : 0,
"userId" : 0,
"type" : "",
"side" : "",
"status" : "",
"price" : 0,
"amount" : 0,
"feeAddress" : "",
"feeRateTaker" : 0,
"feeRateMaker" : 0,
"filledAmount" : 0,
"filledFunds" : 0,
"timestamp" : 0,
"hash" : "",
"signature" : ""
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].id |
long |
0 |
Order id. (auto-generated) |
|
[].clientOrderId |
String |
Optional client defined order identity, which is unique for a user. |
||
[].productId |
int |
0 |
Referenced product id. |
|
[].userId |
long |
0 |
Referenced user id. |
|
[].createTime |
Timestamp |
Order creation timestamp. |
||
[].updateTime |
Timestamp |
Last update timestamp. |
||
[].type |
OrderType |
Order type: "Limit", "Market". |
||
[].side |
OrderSide |
Order side: "Buy", "Sell". |
||
[].status |
OrderStatus |
Order status: "New", "Open", "Cancelling", "Cancelled", "Filled". |
||
[].price |
BigDecimal |
0 |
Order price for "Limit" order type only. |
|
[].amount |
BigDecimal |
0 |
Order amount for "Limit" order type or "Market-Sell" order. For "Market-Buy" order, it is the total order value. |
|
[].feeAddress |
String |
Address to earn the trade fee. |
||
[].feeRateTaker |
double |
0 |
Trade fee rate for trade as taker (e.g. 0.01 means 1%), precision is 6. |
|
[].feeRateMaker |
double |
0 |
Trade fee rate for trade as maker (e.g. 0.01 means 1%), precision is 6. |
|
[].filledAmount |
BigDecimal |
0 |
Filled amount of base currency. |
|
[].filledFunds |
BigDecimal |
0 |
Filled funds of quote currency. |
|
[].timestamp |
long |
0 |
UNIX time in milliseconds. |
|
[].hash |
String |
Order hash. |
||
[].signature |
String |
Order signature. |
5.10. Get completed orders
Get user completed (filled or cancelled) orders of specified product or all products.
请求
GET /orders/completed?address=&product=&side=&startTimestamp=0&endTimestamp=0&offset=0&limit=100&asc=true HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
product |
String |
product name, empty for all products. |
||
side |
OrderSide |
order side: "Buy", "Sell" or empty for both sides. |
||
startTimestamp |
long |
0 |
start timestamp to fetch orders. Note, only support to query in recent 180 days. |
|
endTimestamp |
long |
0 |
end timestamp to fetch orders. Note, only support to query orders of 2 days at most. |
|
offset |
int |
0 |
offset to fetch orders. |
|
limit |
int |
100 |
limit to fetch orders. ([1, 100]) |
|
asc |
boolean |
true |
in time ascending order. |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"clientOrderId" : "",
"productId" : 0,
"userId" : 0,
"type" : "",
"side" : "",
"status" : "",
"price" : 0,
"amount" : 0,
"feeAddress" : "",
"feeRateTaker" : 0,
"feeRateMaker" : 0,
"filledAmount" : 0,
"filledFunds" : 0,
"timestamp" : 0,
"hash" : "",
"signature" : ""
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of orders. |
|
items |
List |
Fetched orders. |
||
items.[].id |
long |
0 |
Order id. (auto-generated) |
|
items.[].clientOrderId |
String |
Optional client defined order identity, which is unique for a user. |
||
items.[].productId |
int |
0 |
Referenced product id. |
|
items.[].userId |
long |
0 |
Referenced user id. |
|
items.[].createTime |
Timestamp |
Order creation timestamp. |
||
items.[].updateTime |
Timestamp |
Last update timestamp. |
||
items.[].type |
OrderType |
Order type: "Limit", "Market". |
||
items.[].side |
OrderSide |
Order side: "Buy", "Sell". |
||
items.[].status |
OrderStatus |
Order status: "New", "Open", "Cancelling", "Cancelled", "Filled". |
||
items.[].price |
BigDecimal |
0 |
Order price for "Limit" order type only. |
|
items.[].amount |
BigDecimal |
0 |
Order amount for "Limit" order type or "Market-Sell" order. For "Market-Buy" order, it is the total order value. |
|
items.[].feeAddress |
String |
Address to earn the trade fee. |
||
items.[].feeRateTaker |
double |
0 |
Trade fee rate for trade as taker (e.g. 0.01 means 1%), precision is 6. |
|
items.[].feeRateMaker |
double |
0 |
Trade fee rate for trade as maker (e.g. 0.01 means 1%), precision is 6. |
|
items.[].filledAmount |
BigDecimal |
0 |
Filled amount of base currency. |
|
items.[].filledFunds |
BigDecimal |
0 |
Filled funds of quote currency. |
|
items.[].timestamp |
long |
0 |
UNIX time in milliseconds. |
|
items.[].hash |
String |
Order hash. |
||
items.[].signature |
String |
Order signature. |
5.11. Get orders
Get user orders of specified product or all products.
请求
GET /orders?address=&product=&startTimestamp=0&endTimestamp=0&offset=0&limit=100&asc=true HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
product |
String |
product name, empty for all products. |
||
startTimestamp |
long |
0 |
start timestamp to fetch orders. Note, only support to query in recent 180 days. |
|
endTimestamp |
long |
0 |
end timestamp to fetch orders. Note, only support to query orders of 2 days at most. |
|
offset |
int |
0 |
offset to fetch orders. |
|
limit |
int |
100 |
limit to fetch orders. ([1, 100]) |
|
asc |
boolean |
true |
in time ascending order. |
响应
HTTP/1.1 200 OK
[ {
"id" : 0,
"clientOrderId" : "",
"productId" : 0,
"userId" : 0,
"type" : "",
"side" : "",
"status" : "",
"price" : 0,
"amount" : 0,
"feeAddress" : "",
"feeRateTaker" : 0,
"feeRateMaker" : 0,
"filledAmount" : 0,
"filledFunds" : 0,
"timestamp" : 0,
"hash" : "",
"signature" : ""
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].id |
long |
0 |
Order id. (auto-generated) |
|
[].clientOrderId |
String |
Optional client defined order identity, which is unique for a user. |
||
[].productId |
int |
0 |
Referenced product id. |
|
[].userId |
long |
0 |
Referenced user id. |
|
[].createTime |
Timestamp |
Order creation timestamp. |
||
[].updateTime |
Timestamp |
Last update timestamp. |
||
[].type |
OrderType |
Order type: "Limit", "Market". |
||
[].side |
OrderSide |
Order side: "Buy", "Sell". |
||
[].status |
OrderStatus |
Order status: "New", "Open", "Cancelling", "Cancelled", "Filled". |
||
[].price |
BigDecimal |
0 |
Order price for "Limit" order type only. |
|
[].amount |
BigDecimal |
0 |
Order amount for "Limit" order type or "Market-Sell" order. For "Market-Buy" order, it is the total order value. |
|
[].feeAddress |
String |
Address to earn the trade fee. |
||
[].feeRateTaker |
double |
0 |
Trade fee rate for trade as taker (e.g. 0.01 means 1%), precision is 6. |
|
[].feeRateMaker |
double |
0 |
Trade fee rate for trade as maker (e.g. 0.01 means 1%), precision is 6. |
|
[].filledAmount |
BigDecimal |
0 |
Filled amount of base currency. |
|
[].filledFunds |
BigDecimal |
0 |
Filled funds of quote currency. |
|
[].timestamp |
long |
0 |
UNIX time in milliseconds. |
|
[].hash |
String |
Order hash. |
||
[].signature |
String |
Order signature. |
5.12. Get order trades
请求
GET /orders/{id}/matches?offset=0&limit=10 HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
order id. |
|
offset |
int |
0 |
offset to fetch trades. |
|
limit |
int |
10 |
limit to fetch trades. ([1, 100]) |
响应
HTTP/1.1 200 OK
[ {
"id" : 0,
"productId" : 0,
"takerOrderId" : 0,
"makerOrderId" : 0,
"price" : 0,
"amount" : 0,
"side" : "",
"takerFee" : 0,
"makerFee" : 0,
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].id |
long |
0 |
Trade id. (auto-generated) |
|
[].productId |
int |
0 |
Referenced product id. |
|
[].takerOrderId |
long |
0 |
Referenced taker order id. |
|
[].makerOrderId |
long |
0 |
Referenced maker order id. |
|
[].price |
BigDecimal |
0 |
Trade price from maker order. |
|
[].amount |
BigDecimal |
0 |
Trade amount. |
|
[].side |
OrderSide |
Taker order side: "Buy", "Sell". |
||
[].takerFee |
BigDecimal |
0 |
Trade fee of taker side. For "Buy" order, it is base currency. For "Sell" order, it is quote currency. |
|
[].makerFee |
BigDecimal |
0 |
Trade fee of maker side. For "Buy" order, it is base currency. For "Sell" order, it is quote currency. |
|
[].status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
[].txHash |
String |
Transaction hash of settlement on blockchain. |
||
[].txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
[].createTime |
Timestamp |
Create timestamp. |
||
[].updateTime |
Timestamp |
Update timestamp. |
5.13. Get trades
请求
GET /orders/matches?address=&product=&startTimestamp=0&endTimestamp=0&offset=0&limit=100&asc=true HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address. |
||
product |
String |
product name. |
||
startTimestamp |
long |
0 |
start timestamp to fetch orders. Note, only support to query in recent 61 days. |
|
endTimestamp |
long |
0 |
end timestamp to fetch orders. Note, only support to query orders of 2 days at most. |
|
offset |
int |
0 |
offset to fetch trades. |
|
limit |
int |
100 |
limit to fetch trades. ([1, 100]) |
|
asc |
boolean |
true |
in time ascending order. |
响应
HTTP/1.1 200 OK
[ {
"id" : 0,
"productId" : 0,
"takerOrderId" : 0,
"makerOrderId" : 0,
"price" : 0,
"amount" : 0,
"side" : "",
"takerFee" : 0,
"makerFee" : 0,
"status" : "SettlementStatus.OffChainSettled",
"txHash" : "",
"txNonce" : 0,
"createTime" : "Timestamp.from(Instant.now())",
"updateTime" : "this.createTime"
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].id |
long |
0 |
Trade id. (auto-generated) |
|
[].productId |
int |
0 |
Referenced product id. |
|
[].takerOrderId |
long |
0 |
Referenced taker order id. |
|
[].makerOrderId |
long |
0 |
Referenced maker order id. |
|
[].price |
BigDecimal |
0 |
Trade price from maker order. |
|
[].amount |
BigDecimal |
0 |
Trade amount. |
|
[].side |
OrderSide |
Taker order side: "Buy", "Sell". |
||
[].takerFee |
BigDecimal |
0 |
Trade fee of taker side. For "Buy" order, it is base currency. For "Sell" order, it is quote currency. |
|
[].makerFee |
BigDecimal |
0 |
Trade fee of maker side. For "Buy" order, it is base currency. For "Sell" order, it is quote currency. |
|
[].status |
SettlementStatus |
SettlementStatus.OffChainSettled |
Settlement status: "OffChainSettled", "OnChainSettled", "OnChainConfirmed". |
|
[].txHash |
String |
Transaction hash of settlement on blockchain. |
||
[].txNonce |
long |
0 |
Transaction nonce of settlement on blockchain. |
|
[].createTime |
Timestamp |
Create timestamp. |
||
[].updateTime |
Timestamp |
Update timestamp. |
6. Product management
6.1. Get product
Get product of specified product name or id.
请求
GET /products/{nameOrId}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
nameOrId |
String |
product name or id. |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"name" : "",
"baseCurrencyId" : 0,
"quoteCurrencyId" : 0,
"pricePrecision" : 0,
"amountPrecision" : 0,
"fundsPrecision" : 0,
"minOrderAmount" : 0,
"maxOrderAmount" : 0,
"minOrderFunds" : 0
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
int |
0 |
Product id. (auto-generated) |
|
name |
String |
Size(min=1,max=32) |
Product name. (e.g. BTC-USDT) |
|
baseCurrencyId |
int |
0 |
Referenced base currency id. |
|
quoteCurrencyId |
int |
0 |
Referenced quote currency id. |
|
pricePrecision |
int |
0 |
Quote currency precision when quote price (decimal places). |
|
amountPrecision |
int |
0 |
Base currency precision when quote amount (decimal places). |
|
fundsPrecision |
int |
0 |
Quote currency precision when quote funds for market-buy orders (funds = price * amount). |
|
minOrderAmount |
BigDecimal |
0 |
Minimum order amount for limit orders or market-sell orders. |
|
maxOrderAmount |
BigDecimal |
0 |
Maximum order amount for limit orders or market-sell orders. |
|
minOrderFunds |
BigDecimal |
0 |
Minimum order funds. (For limit orders, funds = order.price * order.amount; for market-buy orders, funds = order.amount) |
6.2. Get products
List products that ordered by name.
请求
GET /products?offset=0&limit=10 HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
offset |
int |
0 |
offset to fetch products. |
|
limit |
int |
10 |
limit to fetch products. ([1, 20]) |
响应
HTTP/1.1 200 OK
{
"total" : 0,
"items" : [ {
"id" : 0,
"name" : "",
"baseCurrencyId" : 0,
"quoteCurrencyId" : 0,
"pricePrecision" : 0,
"amountPrecision" : 0,
"fundsPrecision" : 0,
"minOrderAmount" : 0,
"maxOrderAmount" : 0,
"minOrderFunds" : 0
} ]
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
total |
int |
0 |
Total number of products. |
|
items |
List |
Fetched products. |
||
items.[].id |
int |
0 |
Product id. (auto-generated) |
|
items.[].name |
String |
Size(min=1,max=32) |
Product name. (e.g. BTC-USDT) |
|
items.[].baseCurrencyId |
int |
0 |
Referenced base currency id. |
|
items.[].quoteCurrencyId |
int |
0 |
Referenced quote currency id. |
|
items.[].pricePrecision |
int |
0 |
Quote currency precision when quote price (decimal places). |
|
items.[].amountPrecision |
int |
0 |
Base currency precision when quote amount (decimal places). |
|
items.[].fundsPrecision |
int |
0 |
Quote currency precision when quote funds for market-buy orders (funds = price * amount). |
|
items.[].minOrderAmount |
BigDecimal |
0 |
Minimum order amount for limit orders or market-sell orders. |
|
items.[].maxOrderAmount |
BigDecimal |
0 |
Maximum order amount for limit orders or market-sell orders. |
|
items.[].minOrderFunds |
BigDecimal |
0 |
Minimum order funds. (For limit orders, funds = order.price * order.amount; for market-buy orders, funds = order.amount) |
6.3. Get daily limit
List daily limit of specified product name.
请求
GET /products/dailylimits/{name}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
name |
String |
product name. |
响应
HTTP/1.1 200 OK
[ {
"id" : 0,
"productId" : 0
} ]
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
[].id |
int |
0 |
Daily limit id. (auto-generated) |
|
[].productId |
int |
0 |
product id. |
|
[].startTime |
Time |
start time (open trading). |
||
[].endTime |
Time |
end time (close trading). |
6.4. Get daily limit rate
Get daily limit rate of specified product name.
请求
GET /products/dailylimitrate/{name}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
name |
String |
product name. |
响应
HTTP/1.1 200 OK
{
"productId" : 0,
"upperLimitRate" : 0,
"lowerLimitRate" : 0,
"initialPrice" : 0
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
productId |
int |
0 |
product id. |
|
upperLimitRate |
double |
0 |
limit up rate (in percent). |
|
lowerLimitRate |
double |
0 |
limit down rate (in percent). |
|
initialPrice |
BigDecimal |
0 |
initial closing price of product (only used in the first day of product). |
7. System management
System maintenance APIs for administrator only.
7.1. Check system suspended
请求
GET /system/suspend HTTP/1.1
响应
HTTP/1.1 200 OK
7.2. Get recent errors
请求
GET /system/get-recent-errors HTTP/1.1
响应
HTTP/1.1 200 OK
[ "" ]
8. User management
8.1. Get user
请求
GET /users/{address}? HTTP/1.1
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
address |
String |
user address |
响应
HTTP/1.1 200 OK
{
"id" : 0,
"name" : ""
}
名称 | 类型 | 校验 | 默认 | 描述 |
---|---|---|---|---|
id |
long |
0 |
User id. (auto-generated) |
|
name |
String |
Size(min=1,max=64) |
User name. |