Welcome
Welcome to CoinCatch ApiDoc! Click here for quick start
Update log
Dec 28, 2023
- New interface Get merged depth data
- Get Single Account added new field on response: 'crossedUnrealizedPL' and 'isolatedUnrealizedPL'
- Get Symbol Position added new field on response: 'autoMargin'
- Get All Position added new field on response: 'autoMargin'
- Get Account Bill added new field on request: 'business'
- Get Business Account Bill added new field on request: 'business'
- Get All Open Order added new fields on response: 'presetTakeProfitPrice','presetStopLossPrice','filledAmount','leverage','marginMode','reduceOnly','enterPointSource','tradeSide','holdMode','orderSource','uTime'
- Get History Plan Orders added new field on request: 'productType'
May 26, 2023
- API DOC released.
Introduction
API Introduction
Welcome to CoinCatch Developer document!
This document is the only official document of CoinCatch API. We will constantly update the functionalities of CoinCatch API here. Please pay attention to it regularly.
On the right side of the document usually displays example of request parameters and response results.
Update
Regarding API additions, updates, and offline information, CoinCatch will issue announcements in advance to notify you. It is recommended that you follow and subscribe to our announcements to obtain relevant information in time.
Contact Us
If you have any questions or suggestions, you can contact us by:
- Send an email to API@coincatch.com.
FAQ
Q1: Is the parameter
symbol
case sensitive?A : Yes
Q2: Order parameter
Symbol
What should I pass? For example, BTCUSDT_UMCBL or BTCUSDT ?A : BTCUSDT_UMCBL
Q3 : What does the WebSocket parameter
instId
pass? For example, BTCUSDT_UMCBL or BTCUSDT ?A : BTCUSDT
Quick Start
Access Preparation
If you need to use the API, please log in to the web page, then apply the API key application and complete the permission configuration, and then develop and trade according to the details of this document.
You can click here to create an API Key after login.
Each user can create 10 sets of Api Keys, and each Api Key can set permissions for reading and trading.
The permissions are described as follows:
- Read-Only permission: Read permission authorized to query data, such as market data. This is the mandatory permission for every apiKey.
- Trade permission: Transaction permission authorized to call the interface of placing and cancelling orders.
- Transfer permission: With this permission it authorized to transfer coins between accounts inside CoinCatch.
- Withdraw permission: Authorized to withdraw assets from CoinCatch account,
noted that you can only withdraw coins through an whitelisted IP address.
After successfully created the API key, please remember the following information:
APIKey
The identity of API transactions, generated by a random algorithm.SecretKey
The private key is randomly generated by the system and used for Signature generation.Passphrase
The password is set by the user. It should be noted that if you forgot the Passphrase, it cannot be retrieved back, and the APIKey needs to be recreated.
Interface Type
Interfaces are mainly divided into two types:
- Public Interface
- Private Interface
Public Interface
The public interface can be used to obtain configuration information and market data. Public requests can be used without authentication.
Private Interface
The private interface can be used for order management and account management. Every private request must be Signed.
The private interface will be verified from server side with given APIKey info.
Access Restriction
This chapter mainly focuses on access restrictions:
- Rest API will return 429 status when the access exceeds the frequency limit: the request is too frequent.
Rest API
If the API is private, we will use the APIKey to limit the frequency; if not, the public IP will be used to limit the frequency.
Frequency limit rules: There are separate instructions on each interface. If the limitation is not specified , the default frequency limit is 10 times per second.
Special note: When place orders in batch, 10 orders per currency pair will be counted as one request.
API Domain Name
You can use different domain as below Rest API.
Domain Name | REST API | Recommended To Use |
---|---|---|
main domain | https://api.coincatch.com | Main Domain |
API Verification
Initiate a request
The header of all REST requests must contain the following http headers:
- ACCESS-KEY:API KEY as a string
- ACCESS-SIGN:Sign with base64 encoding (see Signature).
- ACCESS-TIMESTAMP:Timestamp of your request. Value equals to milliseconds since Epoch.
- ACCESS-PASSPHRASE:The passphrase you set when created the API KEY.
- Content-Type:Please set to 'application/json' for all POST request.
- locale: Support languages: Chinese (zh-CN), English (en-US), the response error message will display in requested language.
//Java
Long timestamp = System.currentTimeMillis();
//python
import time
time.time_ns() / 1000000
//Golang
import (
"time"
)
int64(time.Now().UnixNano()/1000000)
//Javascript
Math.round(new Date())
//PHP
microtime(true) * 1000;
Signature
The request header of ACCESS-SIGN is to encrypt timestamp + method.toUpperCase() + requestPath + "?" + queryString + body string (+ means string concat) by HMAC SHA256 algorithm with secretKey. and encode the encrypted result through BASE64.
Description of each parameter in the signature
- timestamp:Same as ACCESS-TIMESTAMP request header. Value equals to milliseconds since Epoch.
- method:Request method (POST/GET), all uppercase.
- requestPath:Request interface path.
- queryString:The query string in the request URL (the request parameter after the ?).
- body:The request body in string format. If the request body is empty (usually a GET request), the body can be omitted.
If the queryString is empty, signature content
timestamp + method.toUpperCase() + requestPath + body
If the parameter (include queryString and body) not empty, signature content
timestamp + method.toUpperCase() + requestPath + "?" + queryString + body
For example
Get contract depth information of BTCUSDT_UMCBL as an example:
- timestamp = 16273667805456
- method = "GET"
- requestPath = "/api/mix/V1/market/depth"
- queryString= "symbol=BTCUSDT_UMCBL&limit=20"
Generate the content to be signed:
16273667805456GET/api/mix/v1/market/depth?symbol=BTCUSDT_UMCBL&limit=20
Contract order, take BTCUSDT_UMCBL as an example:
- timestamp = 16273667805456
- method = "POST"
- requestPath = "/api/mix/v1/order/placeOrder"
- body = {"symbol":"BTCUSDT_UMCBL","size":"8","side":"open_long","orderType":"limit","client_oid":"CoinCatch#123456"}
Generate the content to be signed:
16273667805456POST/api/mix/v1/order/placeOrder{"symbol":"BTCUSDT_UMCBL","size":"8","side":"open_long","order_type":"limit","client_oid":"CoinCatch#123456"}
Steps to generate the final signature
Step 1. Use the private key secretkey to encrypt the content with hmac sha256
String payload = hmac_sha256(secretkey, content);
The second step is to base64 encode the payload
String signature = base64.encode(payload);
Signature Code Demo
Java
public static String generate(String timestamp, String method, String requestPath,
String queryString, String body, String secretKey)
throws CloneNotSupportedException, InvalidKeyException, UnsupportedEncodingException {
method = method.toUpperCase();
body = StringUtils.defaultIfBlank(body, StringUtils.EMPTY);
queryString = StringUtils.isBlank(queryString) ? StringUtils.EMPTY : "?" + queryString;
String preHash = timestamp + method + requestPath + queryString + body;
System.out.println(preHash);
byte[] secretKeyBytes = secretKey.getBytes(SignatureUtils.CHARSET);
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKeyBytes, SignatureUtils.HMAC_SHA256);
Mac mac = (Mac) SignatureUtils.MAC.clone();
mac.init(secretKeySpec);
return Base64.getEncoder().encodeToString(mac.doFinal(preHash.getBytes(SignatureUtils.CHARSET)));
}
public static void main(String[] args) throws Exception {
String msg=generate("1659927638003","POST","/api/mix/v1/order/placeOrder" ,null,"{"symbol":"TRXUSDT_UMCBL","side":"open_long","orderType":"limit","force":"normal","price":"0.046317","quantity":"1212"}","");
System.out.println(msg);
}
Python
def sign(message, secret_key):
mac = hmac.new(bytes(secret_key, encoding='utf8'), bytes(message, encoding='utf-8'), digestmod='sha256')
d = mac.digest()
return base64.b64encode(d)
def pre_hash(timestamp, method, request_path, body):
return str(timestamp) + str.upper(method) + request_path + body
if __name__ == '__main__':
signStr = sign(pre_hash('1659927638003', 'POST', '/api/mix/v1/order/placeOrder', str('{"symbol":"TRXUSDT_SPBL","side":"open_long","orderType":"limit","force":"normal","price":"0.046317","quantity":"1212"}')), '')
print(signStr)
Request Interaction
All requests are based on the Https protocol, and the Content-Type in the POST request header should set to:'application/json'.
Request Interaction Description
- Request parameters: Encapsulate parameters according to the interface request parameters.
- Submit request parameters: Submit the encapsulated request parameters to the server through GET/POST.
- Server Response:The server first performs parameter security verification on the user request data, and returns the response data to the user in JSON format according to the business logic after passing the verification.
- Data processing:Process the server response data.
Success
HTTP status code 200 indicates a successful response and may contain content. If the response contains content, it will be displayed in the corresponding return content.
Common Error Codes
- 400 Bad Request – Invalid request format
- 401 Unauthorized – Invalid API Key
- 403 Forbidden – You do not have access to the requested resource
- 404 Not Found – No request found
- 429 Too Many Requests – Requests are too frequent and are limited by the system
- 500 Internal Server Error – We had a problem with our server
- If it fails, the return body usually indicates the error message
Standard Specification
Timestamp
The unit of ACCESS-TIMESTAMP in the HTTP request signature is milliseconds. The timestamp of the request must be within 30 seconds of the API server time, otherwise the request will be considered expired and rejected. If there is a large deviation between the local server time and the API server time, we recommend that you compare the timestamp by querying the API server time.
Frequency Limiting Rules
If the request is too frequent, the system will automatically limit the request and return the '429 too many requests' status code.
- Public interface:For the market information interfaces, the unified rate limit is a maximum of 20 requests per second.
- Authorization interface:apikey is used to restrict the calling of authorization interfaces, refer to the frequency restriction rules of each interface for frequency restriction.
Request Format
There are currently only two supported request methods: GET and POST
- GET: The parameters are transmitted to the server in the path through queryString.
- POST: The parameters are sending to the server in json format.
API Common parameters
productType
- umcbl
USDT perpetual contract
- dmcbl
Universal margin perpetual contract
candlestick interval
- 1m(1minute)
- 3m(3minute)
- 5m(5minute)
- 15m(15minute)
- 30m(30minute)
- 1H(1hour)
- 2H (2hour)
- 4H (4hour)
- 6H (6hour)
- 12H (12hour)
- 1D (1day)
- 3D (3day)
- 1W(1week)
- 1M (1month)
- 6Hutc (UTC0 6hour)
- 12Hutc (UTC0 12hour)
- 1Dutc (UTC0 1day)
- 3Dutc (UTC0 3day)
- 1Wutc (UTC0 1 week)
- 1Mutc (UTC0 1 month)
marginMode
Margin Mode
Words | Description |
---|---|
fixed | Isolated margin |
crossed | Cross margin |
holdMode
Position Mode
Words | Description |
---|---|
single_hold | One-way position |
double_hold | Two-way position |
holdSide
Position Direction
Words | Description |
---|---|
long | Long position |
short | Short position |
business
- open_long
- open_short
- close_long
- close_short
- trans_from_exchange Transfer in from spot account
- trans_to_exchange Transfer out to spot account
- contract_settle_fee Funding fee
- contract_main_settle_fee Funding fee for 'crossed'. deprecated, please don't use in query
- contract_margin_settle_fee Funding fee for 'isolated'. deprecated, please don't use in query
- burst_long_loss_query Liquidated close long
- burst_short_loss_query Liquidated close short
side
- open_long
- open_short
- close_long
- close_short
- buy_single buy under single_hold mode
- sell_single sell under single_hold mode
tradeSide
Values for double_hold
Words | Description |
---|---|
open_long | open long |
open_short | open short |
close_long | close long |
close_short | close short |
reduce_close_long | Force reduce long position |
reduce_close_short | Force reduce short position |
offset_close_long | Force netting: close long position |
offset_close_short | Force netting: close short position |
burst_close_long | Force liquidation: close long position |
burst_close_short | Force liquidation: close short position |
delivery_close_long | Future delivery close long |
delivery_close_short | Future delivery close short |
Values for single_hold
Words | Description |
---|---|
buy_single | Buy in single_hold mode |
sell_single | Sell in single_hold mode |
reduce_buy_single | Force reduce buy in single_hold mode |
reduce_sell_single | Force reduce sell in single_hold mode |
burst_buy_single | Force liquidation: buy in single_hold mode |
burst_sell_single | Force liquidation: sell in single_hold mode |
delivery_buy_single | Future delivery buy in single_hold mode |
delivery_sell_single | Future delivery sell in single_hold mode |
timeInForceValue
Words | Description |
---|---|
normal | good till cancel, default value |
post_only | maker only |
fok | fill or kill |
ioc | immediately or cancel |
orderType
- limit
- market
state
order status
Words | Description |
---|---|
init | initial order, inserted into DB |
new | new order, pending match in orderbook |
partially_filled | Partially Filled |
filled | Filled |
canceled | Canceled |
triggerType
Words | Description |
---|---|
fill_price | fill price |
market_price | mark price |
planType
Words | Description |
---|---|
profit_plan | profit order |
loss_plan | loss order |
normal_plan | plan order |
pos_profit | position profit |
pos_loss | position loss |
moving_plan | Trailing TP/SL |
track_plan | Trailing Stop |
isPlan
Words | Description |
---|---|
plan | plan order, Trailing Stop |
profit_loss | profit order, loss order, position profit, position loss, Trailing TP/SL |
planStatus
Words | Description |
---|---|
not_trigger | order not yet trigger |
triggered | order triggered |
fail_trigger | order trigger failed |
cancel | order cancel |
enterPointSource
Words | Description |
---|---|
WEB | Created from Web |
API | Created from API |
SYS | Created from System, usually force liquidation order |
ANDROID | Created from Android system |
IOS | Created from IOS system |
stopType
- profit
- loss
Websocket planType
- pl: default, push data whenever a plan order is created/cancelled/modified/triggered
- tp: take profit event, push data when a take profit order(partial position) is created/cancelled/modified/triggered
- sl: stop loss event, push data when a stop loss order(partial position) is created/cancelled/modified/triggered
- ptp: position take profit event, push data when a position take profit order(whole position) is created/cancelled/modified/triggered
- psl: position stop loss event, push data when a position stop loss order(whole position) is created/cancelled/modified/triggered
symbolStatus
- normal normal
- maintain symbol is under maintenance
- off offline
orderSource
Words | Description |
---|---|
normal | normal order |
market | market order |
profit_market | market profit order |
loss_market | market loss order |
Trader_delegate | trader copy trader |
trader_profit | trader profit |
trader_loss | trader loss |
reverse | reverse order |
trader_reverse | trader reverse order |
profit_limit | limit profit order |
loss_limit | limit loss order |
liquidation | liquidation order |
delivery_close_long | delivery close long order |
delivery_close_short | delivery close short order |
pos_profit_limit | position limit profit order |
pos_profit_market | position market profit order |
pos_loss_limit | position limit loss order |
pos_loss_market | position market loss order |
RestAPI
Market
Get All Symbols
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/contracts
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | product type |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/contracts?productType=umcbl"
Response
{
"code": "00000",
"data": [
{
"baseCoin": "BTC",
"buyLimitPriceRatio": "0.01",
"feeRateUpRatio": "0.005",
"makerFeeRate": "0.0002",
"minTradeNum": "0.001",
"openCostUpRatio": "0.01",
"priceEndStep": "5",
"pricePlace": "1",
"quoteCoin": "USDT",
"sellLimitPriceRatio": "0.01",
"sizeMultiplier": "0.001",
"supportMarginCoins": [
"USDT"
],
"symbol": "BTCUSDT_UMCBL",
"takerFeeRate": "0.0006",
"volumePlace": "3",
"symbolType":"delivery",
"symbolStatus": "normal",
"offTime": "-1",
"limitOpenTime": "-1"
}
],
"msg": "success",
"requestTime": 1627114525850
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id, BTCUSDT_UMCBL |
symbolName | Symbol name, BTCUSDT, might be empty |
baseCoin | Base currency, BTC |
quoteCoin | Quote currency, USDT |
buyLimitPriceRatio | Buy price limit ratio, 0.02 means 2% |
sellLimitPriceRatio | Sell price limit ratio, 0.01 means 1% |
feeRateUpRatio | Rate of increase in handling fee, 0.005 means 0.5% |
makerFeeRate | Maker fee rate, 0.0002 means 0.02% |
takerFeeRate | Taker fee rate, 0.0006 means 0.06% |
openCostUpRatio | Percentage of increase in opening cost, 0.01 means 1% |
supportMarginCoins | Support margin currency array |
minTradeNum | Minimum number of openings(Base Currency) |
priceEndStep | Price step, i.e. when pricePlace=1, priceEndStep=5 means the price would only accept numbers like 10.0, 10.5, and reject numbers like 10.2(10.2 divided by 0.5 not equals to 0) |
volumePlace | Number of decimal places |
pricePlace | Price scale precision, i.e. 1 means 0.1; 2 means 0.01 |
sizeMultiplier | Quantity Multiplier The order size must be greater than minTradeNum and satisfy the multiple of sizeMultiplier |
symbolType | future type perpetual perpetual contract delivery delivery contract |
symbolStatus | Symbol Status |
offTime | delist time, '-1' means online symbol |
limitOpenTime | prohibit create order time, '-1' means normal; other value means symbol is under maintenance, and is not allow to create order afterwards |
Get merged depth data
Speed limit rule: 20 times/1s
HTTP Request
- GET /api/mix/v1/market/merge-depth
request example
curl "https://api.coincatch.com/api/mix/v1/market/merge-depth?symbol=ETHUSDT_UMCBL&precision=scale0&limit=5"
request parameters
parameter name | Parameter Type | Required | describe |
---|---|---|---|
symbol | String | Yes | Trading pair name, for example: BTCUSDT_UMCBL |
precision | String | No | Price accuracy, according to the selected accuracy as the step size to return the cumulative depth, enumeration value: scale0/scale1/scale2/scale3, scale0 is not merged, the default value, in general, scale1 is the merged depth of the transaction pair’s quotation accuracy*10, generally In this case, scale2 is the quotation precision *100, scale3 is the quotation precision *1000, and the precision corresponding to 0/1/2/3 is subject to the actual return parameter "scale". The quotation precision of each trading pair is different, and some currencies The pair does not have scale2, and the request for a scale that does not exist for the currency pair will be processed according to the maximum scale. Example: A certain trading pair only has scale 0/1, and when scale2 is requested, it will be automatically reduced to scale1. |
limit | String | No | Fixed gear enumeration value: 1/5/15/50/max, the default gear is 100. When the actual depth does not meet the limit, it will be returned according to the actual gear. Passing in max will return the maximum gear of the trading pair. |
return data
{
"code": "00000",
"msg": "success",
"requestTime": 1692761045039,
"data": {
"asks": [
[
1842.2,
0.100
],
[
1842.3,
3.176
],
[
1842.8,
7.428
],
[
1843.3,
6.128
],
[
1843.8,
2.747
]
],
"bids": [
[
1841.8,
0.519
],
[
1841.3,
2.931
],
[
1840.8,
8.622
],
[
1840.3,
1.018
],
[
1839.8,
4.112
]
],
"ts": "1692761045063",
"scale": "0.1",
"precision": "scale0",
"isMaxPrecision": "NO"
}
}
Return value description
parameter name | Parameter Type | field description |
---|---|---|
asks | Array | All buy orders at the current price, such as ["38084.5","0.5"], "38084.5" represents the depth price, and "0.5" represents the amount of base currency |
bids | Array | All sell orders at the current price |
precision | String | Current gear, for example: scale 1 |
scale | String | The actual precision value, for example: 0.1 |
isMaxPrecision | String | YES means it is already the maximum precision, NO is not the maximum precision |
ts | String | The time corresponding to the current depth |
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
&npsp;
Get Depth
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/depth
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
limit | String | No | Order book level: 5,15,50,100 default 100 |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/depth?symbol=BTCUSDT_UMCBL&limit=100"
Response
{
"code":"00000",
"data":{
"asks":[
[
"30002",
"0.2300000000000000"
],
[
"30002.5",
"0.91"
],
[
"30003",
"0.18"
]
],
"bids":[
[
"29987",
"0.28"
],
[
"300",
"0.3333000000000000"
]
],
"timestamp":"1627115809358"
},
"msg":"success",
"requestTime":1627115809358
}
The price & volume pair would return values in scientific notation expression
["1.937E+4","156.814"]
["0.000010934","1.2224E+8"]
Please do adjust your code for the scientific notation expression
Get Single Symbol Ticker
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/ticker
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/ticker?symbol=BTCUSDT_UMCBL"
Response
{
"code": "00000",
"msg": "success",
"data": {
"symbol": "BTCUSDT_UMCBL",
"last": "23990.5",
"bestAsk": "23991",
"bestBid": "23989.5",
"bidSz": "2.154",
"askSz": "176.623",
"high24h": "24131.5",
"low24h": "23660.5",
"timestamp": "1660705778888",
"priceChangePercent": "0.00442",
"baseVolume": "156243.358",
"quoteVolume": "3735854069.908",
"usdtVolume": "3735854069.908",
"openUtc": "23841.5",
"chgUtc": "0.00625",
"indexPrice": "22381.253737",
"fundingRate": "0.000072",
"holdingAmount": "85862.241"
}
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
last | Latest price |
bestAsk | Ask1 price |
bestBid | Bid1 price |
bidSz | Ask1 size |
askSz | Bid1 size |
high24h | Highest price in 24 hours |
low24h | Lowest price in 24 hours |
timestamp | Timestamp (milliseconds) |
priceChangePercent | Price change (24 hours) |
baseVolume | Base currency trading volume |
quoteVolume | Quote currency trading volume |
usdtVolume | USDT transaction volume |
openUtc | UTC0 open price |
chgUtc | UTC0 price change(24 hour) |
indexPrice | Index price |
fundingRate | Funding rate |
holdingAmount | Holding amount, unit in base coin |
Get All Symbol Ticker
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/tickers
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | product type |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/tickers?productType=umcbl"
Response
{
"code": "00000",
"msg": "success",
"requestTime": 0,
"data": [{
"symbol": "BTCUSDT_UMCBL",
"last": "23990.5",
"bestAsk": "23991",
"bestBid": "23989.5",
"bidSz": "2.154",
"askSz": "176.623",
"high24h": "24131.5",
"low24h": "23660.5",
"timestamp": "1660705778888",
"priceChangePercent": "0.00442",
"baseVolume": "156243.358",
"quoteVolume": "3735854069.908",
"usdtVolume": "3735854069.908",
"openUtc": "23841.5",
"chgUtc": "0.00625",
"indexPrice": "22381.253737",
"fundingRate": "0.000072",
"holdingAmount": "85862.241"
}]
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
last | Latest price |
bestAsk | Ask price |
bestBid | Bid price |
bidSz | Ask1 size |
askSz | Bid1 size |
high24h | Highest price in 24 hours |
low24h | Lowest price in 24 hours |
timestamp | Timestamp (milliseconds) |
priceChangePercent | Price change (24 hours) |
baseVolume | Base currency trading volume |
quoteVolume | Quote currency trading volume |
usdtVolume | USDT transaction volume |
openUtc | UTC0 open price |
chgUtc | UTC0 price change (24hour) |
indexPrice | Index price |
fundingRate | Funding rate |
holdingAmount | Holding amount, unit in base coin |
Get Recent Fills
Get recent 100 trades.
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/fills
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
limit | String | No | Default limit is 100, max 100 |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/fills?symbol=BTCUSDT_UMCBL&limit=100"
Response Data
{
"code":"00000",
"data":[
{
"tradeId":"802751431994691585",
"price":"29990.5",
"size":"0.0166",
"side":"sell",
"timestamp":"1627116776464",
"symbol":"BTCUSDT_UMCBL"
},
{
"tradeId":"802750695521046529",
"price":"30007.0",
"size":"0.0166",
"side":"buy",
"timestamp":"1627116600875",
"symbol":"BTCUSDT_UMCBL"
}
],
"msg":"success",
"requestTime":1627116936176
}
Response Description
Parameter | Description |
---|---|
tradeId | tradeId |
price | price |
size | size |
side | side |
timestamp | timestamp, ms |
symbol | symbol |
Get Fills
Fetch trade history within 30 days, response will be cached with same param for 10 minutes, please revise 'endTime' to get the latest records
Limit rule: 10 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/fills-history
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
limit | String | No | Default is 500, Max is 1000 |
tradeId | String | No | tradeId, return records with 'tradeId' less than the provided value |
startTime | String | No | startTime, ms |
endTime | String | No | endTime, ms |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/fills-history?symbol=BTCUSDT_UMCBL&limit=12&tradeId=1020224189048217601&startTime&endTime"
Response Data
{
"code": "00000",
"msg": "success",
"requestTime": 0,
"data": [
{
"tradeId": "1020224187601182723",
"price": "21120",
"size": "23.296",
"side": "Buy",
"timestamp": "1678966321000",
"symbol": "BTCUSDT_UMCBL"
},
{
"tradeId": "1020224187055923213",
"price": "21120",
"size": "0.804",
"side": "Sell",
"timestamp": "1678966321000",
"symbol": "BTCUSDT_UMCBL"
}
]
}
Response Description
Parameter | Description |
---|---|
tradeId | tradeId, desc |
price | price |
size | size, base coin |
side | side, Buy/Sell |
timestamp | timestamp, ms |
symbol | symbol |
Get Candle Data
Limit rule: 20 times/1s (IP)
Could only get data within 30 days for '1m' data, default return 100 rows
HTTP Request
- GET /api/mix/v1/market/candles
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
granularity | String | Yes | Types of candlestick interval |
startTime | String | Yes | Start time (Timestamp ms, bigger or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672410780000 (2022-12-30 22:33:00) if granularity=1m |
endTime | String | Yes | End time (Timestamp ms, less or equals), will round-down as per granularity, which is: 1672410799436(2022-12-30 22:33:19) will rounded down to 1672408800000 (2022-12-30 22:00:00) if granularity=1H |
kLineType | String | No | k-line type: 'market mark index'; Default 'market' |
limit | String | No | Default 100, max 1000 |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/candles?symbol=BTCUSDT_UMCBL&granularity=300&startTime=1659406928000&endTime=1659410528000"
Response
[
[
"1627008780000",
"24016.0000000000000000",
"24016.0000000000000000",
"24016.0000000000000000",
"24016.0000000000000000",
"0.000000000000",
"0.000000000000"
],
[
"1627008840000",
"24016.0000000000000000",
"24016.0000000000000000",
"24016.0000000000000000",
"24016.0000000000000000",
"0.000000000000",
"0.000000000000"
]
]
Response Description
Parameter | Index |
---|---|
Timestamp in milliseconds | 0 |
Opening price | 1 |
Highest price | 2 |
Lowest price | 3 |
Closing price, value of the latest candle stick might change, please try subscribe the websocket candlestick channel for the updates | 4 |
Base currency trading volume | 5 |
Quote currency trading volume | 6 |
Get Symbol Index Price
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/index
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/index?symbol=BTCUSDT_UMCBL"
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"index":"35000",
"timestamp":"1627291836179"
},
"msg":"success",
"requestTime":1627291836179
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
index | Index price |
timestamp | Timestamp, milliseconds |
Get Symbol Next Funding Time
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/funding-time
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/funding-time?symbol=BTCUSDT_UMCBL"
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"fundingTime":"1627311600000"
},
"msg":"success",
"requestTime":1627291915767
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol ID |
fundingTime | Next settlement time, milliseconds |
Get History Funding Rate
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/history-fundRate
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
pageSize | int | No | Page size default 20 |
pageNo | int | No | Page No. |
nextPage | Boolean | No | Whether to query the next page default false |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/history-fundRate?symbol=BTCUSDT_UMCBL"
Response
{
"code":"00000",
"data":[
{
"symbol":"BTCUSDT",
"fundingRate":"0",
"settleTime":"1627369200000"
}
],
"msg":"success",
"requestTime":1627389063463
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol name |
fundingRate | Current funding rate |
settleTime | Settlement time |
Get Current Funding Rate
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/current-fundRate
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/current-fundRate?symbol=BTCUSDT_UMCBL"
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"fundingRate":"0.0002"
},
"msg":"success",
"requestTime":1627291969594
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
fundingRate | Current funding rate |
Get Open Interest
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/open-interest
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/open-interest?symbol=BTCUSDT_UMCBL"
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"amount":"757.8338",
"timestamp":"1627292005913"
},
"msg":"success",
"requestTime":1627292005913
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol ID |
amount | Total platform open interest |
timestamp | Timestamp (milliseconds) |
Get Symbol Mark Price
Limit rule: 20 times/1s (IP)
HTTP Request
- GET /api/mix/v1/market/mark-price
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/mark-price?symbol=BTCUSDT_UMCBL"
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"markPrice":"35000",
"timestamp":"1627292076687"
},
"msg":"success",
"requestTime":1627292076687
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
markPrice | Mark price |
timestamp | Timestamp (milliseconds) |
Get Symbol Leverage
Limit rule: 20/sec (IP)
HTTP Request
- GET /api/mix/v1/market/symbol-leverage
Request Parameter
Parameter | type | required | description |
---|---|---|---|
symbol | String | Yes | symbol Id (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/symbol-leverage?symbol=BTCUSDT_UMCBL"
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"minLeverage":"1",
"maxLeverage":"125"
},
"msg":"success",
"requestTime":1627292076687
}
Response Description
Parameter | Description |
---|---|
symbol | symbol id |
minLeverage | min leverage |
maxLeverage | max leverage |
Get Position Tier
Limit rule: 20/sec (IP)
HTTP Request
- GET /api/mix/v1/market/queryPositionLever
Request Parameter
Parameter | type | required | description |
---|---|---|---|
symbol | String | Yes | symbol Id (Must be capitalized) |
productType | String | Yes | product type |
Request Example
curl "https://api.coincatch.com/api/mix/v1/market/queryPositionLever?symbol=BTCUSDT_UMCBL&productType=UMCBL"
Response
{
"code":"00000",
"data":[
{
"level": 1,
"startUnit": 0,
"endUnit": 150000,
"leverage": 125,
"keepMarginRate": "0.004"
}
],
"msg":"success",
"requestTime":1627292076687
}
Response Description
Parameter | Description |
---|---|
level | Tier |
startUnit | Start value |
endUnit | End value |
leverage | Leverage multiple |
keepMarginRate | Margin Rate, The value corresponding to the position, when the margin rate of the position is less than the maintenance margin rate, forced decreased or liquidation will be triggered |
Account
Get Single Account
Limit rule: 10 times/1s (uid)
HTTP Request
- GET /api/mix/v1/account/account
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin coin |
Request Example
curl "https://api.coincatch.com/api/mix/v1/account/account?symbol=BTCUSDT_UMCBL&marginCoin=USDT" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code":"00000",
"data":{
"marginCoin":"USDT",
"locked":0,
"available":13168.86110692,
"crossMaxAvailable":13168.86110692,
"fixedMaxAvailable":13168.86110692,
"maxTransferOut":13168.86110692,
"equity":13178.86110692,
"usdtEquity":13178.861106922,
"btcEquity":0.344746495477,
"crossRiskRate":0,
"crossMarginLeverage":20,
"fixedLongLeverage":20,
"fixedShortLeverage":20,
"marginMode":"crossed",
"holdMode":"double_hold",
"unrealizedPL": null,
"crossedUnrealizedPL": null,
"isolatedUnrealizedPL": null,
"bonus": "0"
},
"msg":"success",
"requestTime":1627292199523
}
Response Description
Parameter | Description |
---|---|
marginCoin | Margin currency |
locked | Locked amount (margin currency), system will lock when close position |
available | Available balance(margin currency) |
crossMaxAvailable | The maximum available balance for crossed margin mode(margin currency) |
fixedMaxAvailable | The maximum available balance for fixed margin mode(margin currency) |
maxTransferOut | Maximum transferable |
equity | Account equity (margin currency) , includes uPnL (calculated by mark price) |
usdtEquity | Account equity convert to USDT, |
btcEquity | Account equity convert to BTC |
crossRiskRate | Risk ratio at crossed margin mode |
crossMarginLeverage | Leverage level for crossed margin mode |
fixedLongLeverage | Long leverage with isolated(fixed) margin mode |
fixedShortLeverage | Short leverage with isolated(fixed) margin mode |
marginMode | Margin mode |
holdMode | Hold mode |
unrealizedPL | unrealized profit and loss at crossed margin mode, unit in USDT |
crossedUnrealizedPL | current symbol unrealized profit and loss at crossed margin mode, unit in USDT |
isolatedUnrealizedPL | current symbol unrealized profit and loss at isolated margin mode, unit in USDT |
bonus | coupon |
Get Account List
Limit rule: 10 times/1s (uid)
HTTP Request
- GET /api/mix/v1/account/accounts
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | product type |
Request Example
curl "https://api.coincatch.com/api/mix/v1/account/accounts?productType=umcbl" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code":"00000",
"data":[
{
"marginCoin":"USDT",
"locked":"0.31876482",
"available":"10575.26735771",
"crossMaxAvailable":"10580.56434289",
"fixedMaxAvailable":"10580.56434289",
"maxTransferOut":"10572.92904289",
"equity":"10582.90265771",
"usdtEquity":"10582.902657719473",
"btcEquity":"0.204885807029",
"crossRiskRate": "0",
"unrealizedPL": null,
"bonus": "0"
}
],
"msg":"success",
"requestTime":1630901215622
}
Response Description
Parameter | Description |
---|---|
marginCoin | Margin currency |
locked | Locked amount (margin currency) |
available | Available balance(margin currency) |
crossMaxAvailable | The maximum available balance for crossed margin mode(margin currency) |
fixedMaxAvailable | The maximum available balance for isolated(fixed) margin mode(margin currency) |
maxTransferOut | Maximum transferable |
equity | Account equity (margin currency), includes uPnL (calculated by mark price) |
usdtEquity | Account equity convert to USDT |
btcEquity | Account equity convert to BTC |
crossRiskRate | Risk ratio at crossed margin mode |
unrealizedPL | unrealized profit and loss |
bonus | coupon |
Get Open Count
Limit rule: 20 times/1s (IP)
This interface is only used to calculate the maximum number of positions that can be opened when the user does not hold a position by the specified leverage. The result does not represent the actual number of positions opened.
HTTP Request
- POST /api/mix/v1/account/open-count
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
openPrice | BigDecimal in String format | Yes | Opening price |
leverage | Int value in String format | No | Default leverage is 20 |
openAmount | BigDecimal in String format | Yes | Opening amount in margin coin |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/account/open-count" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","openPrice": "23189.5","leverage": "20","openAmount":"5000"}'
Response
{
"code":"00000",
"data":{
"openCount":"2000"
},
"msg":"success",
"requestTime":1627293049406
}
Change Leverage
Limit rule: 5 times/1s (uid)
HTTP Request
- POST /api/mix/v1/account/setLeverage
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
leverage | String | Yes | Leverage |
holdSide | String | No | Position direction (ignore this field if marginMode is crossed) |
The leverage could set to different number in fixed margin mode(holdSide is required)
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/account/setLeverage" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","leverage": "20"}'
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"marginCoin":"USDT",
"longLeverage":25,
"shortLeverage":20,
"crossMarginLeverage": 50,
"marginMode":"crossed"
},
"msg":"success",
"requestTime":1627293049406
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
marginCoin | Margin currency |
longLeverage | Long leverage |
shortLeverage | Short leverage |
crossMarginLeverage | Cross margin leverage |
marginMode | Margin Mode |
Change Margin
Limit rule: 5 times/1s (uid)
HTTP Request
- POST /api/mix/v1/account/setMargin
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
amount | String | Yes | Margin amount, positive: add margin, negative: reduce margin |
holdSide | String | No | Position direction (ignore this field if marginMode is crossed) |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/account/setMargin" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","amount": "-10"}'
Response
{
"code":"00000",
"data":{
"result":true
},
"msg":"success",
"requestTime":1627293357336
}
Change Margin Mode
Limit rule: 5 times/1s (uid)
HTTP Request
- POST /api/mix/v1/account/setMarginMode
Request Parameter(Request Body)
Server will return error if you call this interface with any exists position/order
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
marginMode | String | Yes | Margin mode |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/account/setMarginMode" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","marginMode": "crossed"}'
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"marginCoin":"USDT",
"longLeverage":25,
"shortLeverage":20,
"marginMode":"crossed"
},
"msg":"success",
"requestTime":1627293445916
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
marginCoin | Margin currency |
longLeverage | Long leverage |
shortLeverage | Short leverage |
marginMode | Margin mode |
Change Hold Mode
Please DO NOT change the hold mode with existing position/order under any symbols within the 'productType'
Limit rule: 5 times/1s (uid)
HTTP Request
- POST /api/mix/v1/account/setPositionMode
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | product type |
holdMode | String | Yes | Hold mode |
Might fail if intended to change hold mode when the "symbol" has positions/orders on any side
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/account/setPositionMode" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"productType": "umcbl","holdMode": "double_hold"}'
Response
{
"code":"00000",
"msg":"success",
"data":{
"symbol":"BTCUSDT_UMCBL",
"marginCoin":"USDT",
"dualSidePosition":true
},
"requestTime":1627293445916
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
marginCoin | Margin currency |
dualSidePosition | boolean, true: "double_hold"; false: "single_hold" |
Get Symbol Position
Limit rule: 10 times/1s (uid)
HTTP Request
- GET /api/mix/v1/position/singlePosition-v2
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/position/singlePosition-v2?symbol=BTCUSDT_UMCBL&marginCoin=USDT" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code": "00000",
"msg": "success",
"requestTime": 0,
"data": [
{
"marginCoin": "USDT",
"symbol": "BTCUSDT_UMCBL",
"holdSide": "long",
"openDelegateCount": "0",
"margin": "0",
"autoMargin":"off",
"available": "0",
"locked": "0",
"total": "0",
"leverage": 10,
"achievedProfits": null,
"averageOpenPrice": null,
"marginMode": "crossed",
"holdMode": "double_hold",
"unrealizedPL": null,
"liquidationPrice": null,
"keepMarginRate": null,
"marketPrice": null,
"cTime": null
},
{
"marginCoin": "USDT",
"symbol": "BTCUSDT_UMCBL",
"holdSide": "short",
"openDelegateCount": "0",
"margin": "0",
"autoMargin":"off",
"available": "0",
"locked": "0",
"total": "0",
"leverage": 10,
"achievedProfits": null,
"averageOpenPrice": null,
"marginMode": "crossed",
"holdMode": "double_hold",
"unrealizedPL": null,
"liquidationPrice": null,
"keepMarginRate": null,
"marketPrice": null,
"cTime": null
}
]
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
marginCoin | Margin currency |
holdSide | Position direction |
openDelegateCount | Open amount pending to fill (base currency) |
margin | Margin quantity (margin currency) |
autoMargin | Auto suppliment margin: off on |
available | Position available (Quote currency) |
locked | Position locked (Quote currency) |
total | Total position (available + locked) |
leverage | Leverage |
achievedProfits | Realized profit and loss |
averageOpenPrice | Average opening price |
marginMode | Margin mode |
holdMode | Position mode |
unrealizedPL | Unrealized profit or loss |
liquidationPrice | estimated liquidation price |
keepMarginRate | keep margin rate |
marketPrice | mark (typo) price |
cTime | Last update time Timestamp milliseconds |
Get All Position
Limit rule: 5 times/1s (uid)
HTTP Request
- GET /api/mix/v1/position/allPosition-v2
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | Product type |
marginCoin | String | No | Margin currency (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/position/allPosition-v2?productType=umcbl&marginCoin=USDT" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code":"00000",
"data":[
{
"marginCoin": "USDT",
"symbol": "BTCUSDT_UMCBL",
"holdSide": "long",
"openDelegateCount": "0",
"margin": "0",
"autoMargin":"off",
"available": "0",
"locked": "0",
"total": "0",
"leverage": 10,
"achievedProfits": "0",
"averageOpenPrice": "0",
"marginMode": "crossed",
"holdMode": "double_hold",
"unrealizedPL": "0",
"liquidationPrice": "0",
"keepMarginRate": "0.004",
"marketPrice": "28038.69",
"cTime": "1669362331867",
"uTime": "1626232130664"
},
{
"marginCoin": "USDT",
"symbol": "BTCUSDT_UMCBL",
"holdSide": "short",
"openDelegateCount": "0",
"margin": "0",
"autoMargin":"off",
"available": "0",
"locked": "0",
"total": "0",
"leverage": 10,
"achievedProfits": "0",
"averageOpenPrice": "0",
"marginMode": "crossed",
"holdMode": "double_hold",
"unrealizedPL": "0",
"liquidationPrice": "0",
"keepMarginRate": "0.004",
"marketPrice": "28038.69",
"cTime": "1669362331868",
"uTime": "1626232130664"
}
],
"msg":"success",
"requestTime":1627293612502
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
marginCoin | Margin currency |
holdSide | Position direction |
openDelegateCount | Opened amount pending to fill (trading currency) |
margin | Margin quantity (margin currency) |
autoMargin | Auto suppliment margin: off on |
available | Position available (Quote currency) |
locked | Position locked (Quote currency) |
total | Total position (available + locked) |
leverage | Leverage |
achievedProfits | Realized profit and loss |
averageOpenPrice | Average opening price |
marginMode | Margin mode |
holdMode | Position mode |
unrealizedPL | Unrealized profit and loss |
liquidationPrice | estimate liquidation price |
keepMarginRate | keep margin rate |
marketPrice | market price |
cTime | Last position create time Timestamp milliseconds |
uTime | Last update time Timestamp milliseconds |
Get Account Bill
Limit rule: 10/sec (uid)
HTTP Request
- GET /api/mix/v1/account/accountBill
Request (Request Param)
Parameter | type | required | description |
---|---|---|---|
productType | String | No | Product Type, choose one in: 'symbol' and 'productType' |
symbol | String | No | Symbol Id (Deprecated) |
business | String | No | business |
marginCoin | String | Yes | margin coin |
startTime | String | Yes | Start Time, milliseconds |
endTime | String | Yes | end time, milliseconds |
pageSize | int | No | page size, default 20, max is 100 |
lastEndId | String | No | last end Id of last query |
Request Example
curl "https://api.coincatch.com/api/mix/v1/account/accountBill?productType=UMCBL&marginCoin=USDT&startTime=1659403328000&endTime=1659406928000&pageSize=20" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code": "00000",
"msg": "success",
"data": {
"result": [
{
"id": "892962903462432768",
"symbol": "BTCUSDT_UMCBL",
"marginCoin": "USDT",
"amount": "0",
"fee": "-0.1765104",
"feeByCoupon": "",
"feeCoin": "USDT",
"business": "open_long",
"ctime": "1648624867354"
}
],
"endId": "885353495773458432",
"nextFlag": false
}
}
Response params
Parameter | Description |
---|---|
id | record ID |
symbol | Symbol Id, might be null |
marginCoin | margin Coin |
amount | charge amount |
fee | fee |
feeByCoupon | fee deduction coupon |
feeCoin | fee coin |
business | business |
cTime | create time |
lastEndId | last end Id, will return when next set to true |
Get Business Account Bill
Records within 90 days
Limit rule: 5/sec (uid)
HTTP Request
- GET /api/mix/v1/account/accountBusinessBill
Request (Request Param)
Parameter | type | required | description |
---|---|---|---|
productType | String | Yes | Product Type |
business | String | No | business |
startTime | String | Yes | Start Time, millisecond |
endTime | String | Yes | end time, millisecond |
pageSize | int | No | page size, default 20, max is 100 |
lastEndId | String | No | last end Id of last query |
next | boolean | No | Whether query return lastEndId? default false |
Request Example
curl "https://api.coincatch.com/api/mix/v1/account/accountBusinessBill?productType=umcbl&startTime=1659403328000&endTime=1659406928000&pageSize=20" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code": "00000",
"msg": "success",
"data": {
"result": [
{
"id": "892962903462432768",
"symbol": "ETHUSDT_UMCBL",
"marginCoin": "USDT",
"amount": "0",
"fee": "-0.1765104",
"feeByCoupon": "",
"feeCoin": "USDT",
"business": "open_long",
"ctime": "1648624867354"
}
],
"endId": "885353495773458432",
"nextFlag": false,
"preFlag": false
}
}
Response params
Parameter | Description |
---|---|
id | record no |
symbol | Symbol Id |
marginCoin | margin Coin |
amount | charge amount |
fee | fee |
feeByCoupon | fee deduction coupon |
feeCoin | fee coin |
business | business type |
cTime | create time |
lastEndId | last end Id, will return when next set to true |
Trade
Place Order
Limit rule: 10 times/1s (uid)
The price and quantity of the order need to meet pricePlace
and priceEndStep
volumePlace
, those fields could be found from the response of Market
-> Get All Symbols
for example:
pricePlace
of BTCUSDT_UMCBL
is 1 and priceEndStep
is 5, then the order price needs to satisfy a multiple of 0.5, for example, the price should be 23455.0, 23455.5, 23446.0
pricePlace
of ETHUSDT_UMCBL
is 2 and priceEndStep
is 1, then the order price needs to satisfy a multiple of 0.01, for example, the price should be 1325.00, 1325.01, 1325.02
There are two scenarios where this error would return
- Insufficient account balance
- The current maximum openable leverage tier of the current trading pair is full, please refer to the specific tier position here
High frequency error when close position:
There are two scenarios where this error would happen
- 0 position
- Position exists,but specify a wrong
side
param when closing. For example: you have along
position, and try to close it withside=close_short
Hold mode = double_hold : if specify a size greater than the position size when closing position, the order will success with actual position size, that is, reduceOnly.
Hold mode = single_hold + reduceOnly=false : - you are holding 1.0 long BTCUSDT - try to close the long BTCUSDT with size: 3.0 in market price - place order interface return success, 1.0 long position will be closed, and 2.0 short position will be opened
Hold mode = single_hold + reduceOnly=true : - you are holding 1.0 long BTCUSDT - try to close the long BTCUSDT with size: 2.0 in market price - place order interface return failure - try to close the long BTCUSDT with size: 0.5 in market price - place order interface return success, position changes to 0.5 long BTCUSDT - try to close the long BTCUSDT with size: 0.5 in market price - place order interface return success, position changes to 0
Unknown error
HTTP Request
- POST /api/mix/v1/order/placeOrder
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id |
marginCoin | String | Yes | Margin currency |
size | String | Yes | Order quantity, base coin |
price | String | No | Order price (not required at market price) |
side | String | Yes | Order direction |
orderType | String | Yes | Order type |
timeInForceValue | String | No | Time in force |
clientOid | String | No | Unique client order ID, The idempotent is promised but only within 30 days |
reduceOnly | Boolean | No | Default false; set to true when try to reduce position in 'single_hold' mode and when close position with value less than 5USDT, DOES NOT WORK under 'double_hold' mode |
presetTakeProfitPrice | String | No | Preset take profit price |
presetStopLossPrice | String | No | Preset stop loss price |
Response Data
{
"code":"00000",
"data":{
"orderId":"1627293504612",
"clientOid":"CoinCatch#1627293504612"
},
"msg":"success",
"requestTime":1627293504612
}
Response Description
Parameter | Description |
---|---|
orderId | Order Id |
clientOid | Client custom Id |
If client does not specify clientOid
, the user should be awared that the order might be duplicated, as this is the only idempotent promise field between client and server
Duplicate clientOid
{
"code":"40786",
"msg":"Duplicate clientOid",
"requestTime":1627293504612
}
Reversal
Limit rule: 10 times/1s (uid), counted together with placeOrder
Reversal share the same interface with Place order.
Reversal logic is different under "double_hold"/"single_hold" hold mode:
double_hold: 1) You could usually specify a size(size > 0 and size <= position size), which the size will be closed from your current position and a same size will be opened on the opposite side 2) "side" value: close_short or close_long
single_hold: 1) The size parameter is omitted, that means you could only close the whole position, then try to open on the opposite side with market price, the open position might fail due to margin condition 2) "side" value: sell_single when position side is buy_single, buy_single when position side is sell_single
Note: Your position will be closed at market price and open in reverse side for the specific amount.
If the close position settled amount + available balance are insufficient to open the specific size of positions, or the reverse order value is less than 5 USDT, the specified size position will be closed and the position open will fail.
Your operation may not be 100% successful due to margin, market conditions and other factors.
You must have an exists position to trigger a reversal operation, or server will return error "Not enough position is available."
Not enough position
{
"code": "40757",
"msg": "Not enough position is available.",
"requestTime": 1665454799692,
"data": null
}
The reverse order size usually should be same as the original size. For example: original position size 100, in reversal request you should set the size to 100, Server will then close your original position 100, and open extra 100 in reversal side in market price with the best efforts.
- Reversal - 1 times size
- [reverse size] = [close size] = [open reverse size]
- original position size: 1 long BTCUSDT
- reverse order size: 1 close_long BTCUSDT
- ideally the 1 long BTCUSDT will be closed, and 1 short BTCUSDT will be opened
The reverse order size could also be set to 1.5 or 3 times of the original size(or even more), in reversal it will first close all of your position in market price, then try to open reverse position with the original size (that is: if reversal size is bigger than the original position size, the reversal size will be treated as the original position size)
- Reversal - 1.5 times size
- original position size: 1 long BTCUSDT
- reverse order size: 1.50 close_long BTCUSDT
- ideally the 1 long BTCUSDT will be closed, and 1 short BTCUSDT will be opened
The reverse order size could also be set to a number between 0 to 1 times of the original position size, in reversal it will first close your position with specific reversal size in market price, then try to open reverse position with the specific size
- Reversal - 0.5 times size
- original position size: 1 long BTCUSDT
- reverse order size: 0.5 close_long BTCUSDT
- ideally the 0.5 long BTCUSDT will be closed, and 0.5 short BTCUSDT will be opened; So at the end you should be holding 0.5 long BTCUSDT, and 0.5 short BTCUSDT
orderType
must be market price, a limit price order will be treated as market price order in reversal
Reversal Sample: original order
{
"size": "100",
"side": "open_long",
"orderType": "market",
"timeInForceValue": "normal",
"symbol": "TRXUSDT_UMCBL",
"marginCoin": "USDT"
}
Reversal Sample: reverse order
{
"size": "100",
"side": "close_long",
"orderType": "market",
"timeInForceValue": "normal",
"symbol": "TRXUSDT_UMCBL",
"marginCoin": "USDT",
"reverse":true
}
If originally side
is open_long, then in reversal you should set the side
to close_long;
If originally side
is open_short, then in reversal you should set the side
to close_short;
Use sell_single
when original position side
is buy_single
,
Use buy_single
when original position side
is sell_single
;
Samples on the right side demonstrate a reversal operation. Ideally at the end you should be holding 100 TRXUSDT short
position
HTTP Request
- POST /api/mix/v1/order/placeOrder
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id |
marginCoin | String | Yes | Margin currency |
size | String | No | Order quantity size = close_size = open_reverse_size; this param will be omitted in single_hold mode |
side | String | Yes | Order direction, set to close_long or close_short in double_hold mode; set to buy_single or sell_single in single_hold mode |
orderType | String | Yes | Order type: market |
clientOid | String | No | Unique Client ID |
timeInForceValue | String | No | set to 'normal' |
reverse | Boolean | No | Default false : place order; true : reversal order |
Reversal Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/order/placeOrder" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","size": "0.01","side":"open_long","orderType":"market","timeInForceValue":"normal","clientOid":"reverse@483939290002","reverse":true}'
Reversal Response Data
{
"code":"00000",
"data":{
"orderId":"1627293504612",
"clientOid":"CoinCatch#1627293504612"
},
"msg":"success",
"requestTime":1627293504612
}
Response Description
Parameter | Description |
---|---|
orderId | Order Id |
clientOid | Client custom Id |
Batch Order
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/order/batch-orders
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
orderDataList | List | Yes | Order data list, maximum size: 50 |
orderDataList
Maximum 50 orders
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
size | String | Yes | Order quantity |
price | String | No | Order price, quote coin |
side | String | Yes | Order direction |
orderType | String | Yes | Order type |
timeInForceValue | String | No | Time In Force |
clientOid | String | No | Unique Client ID, the idempotent is promised but only within 24 hours |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/order/batch-orders" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT", "orderDataList":[{"size": "0.01","price": "23145.5","side":"open_long","orderType":"limit","timeInForceValue":"normal","clientOid":"test@483939290000"}] }'
Response
{
"code": "00000",
"data": {
"orderInfo": [
{
"orderId": "1627293504612",
"clientOid": "CoinCatch#1627293504612"
}
],
"failure":[
{
"orderId": "1627293504611",
"clientOid": "CoinCatch#1627293504611",
"errorMsg":"Duplicate clientOid"
}
]
},
"msg": "success",
"requestTime": 1627293504612
}
Response Description
Parameter | Description |
---|---|
orderInfo | Successful order array |
> orderId | Order Id |
> clientOid | Client custom Id |
failure | Failure order array |
> orderId | Order Id, might be empty |
> clientOid | Client custom Id |
> errorMsg | Fail reason |
Cancel Order
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/order/cancel-order
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
orderId | String | No | Order Id, int64 in string format, 'orderId' or 'clientOid' must have one |
clientOid | String | No | Client Order Id, 'orderId' or 'clientOid' must have one |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/order/cancel-order" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","orderId":"1627293504612"}'
Response
{
"code":"00000",
"data":{
"orderId":"1627293504612",
"clientOid":"CoinCatch#1627293504612"
},
"msg":"success",
"requestTime":1627293504612
}
Response Description
Parameter | Description |
---|---|
orderId | Order Id |
clientOid | Client custom Id |
Batch Cancel Order
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/order/cancel-batch-orders
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
orderIds | String array | No | Order Id list, int64 in string format, 'orderIds' or 'clientOids' must have one |
clientOids | String array | No | Client Order Id list, 'orderIds' or 'clientOids' must have one |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/order/cancel-batch-orders" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","orderIds":["1627293504612"]}'
Response
{
"code": "00000",
"data": {
"symbol": "BTCUSDT_UMCBL",
"order_ids": [
"1627293504612"
],
"client_order_ids":[
"xxx001"
],
"fail_infos": [
{
"order_id": "",
"err_code": "",
"err_msg": ""
}
]
},
"msg": "success",
"requestTime": 1627293504612
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
order_ids | Order Id array |
client_order_ids | Client Order Id array |
fail_infos | Failed information array |
> order_id | Failed order id |
> err_code | Error code |
> err_msg | error msg |
Cancel Order By Symbol
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/order/cancel-symbol-orders
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/order/cancel-symbol-orders" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT"}'
Response
{
"code": "00000",
"data": {
"symbol": "BTCUSDT_UMCBL",
"order_ids": [
"1627293504612"
],
"client_order_ids":[
"xxx001"
],
"fail_infos": [
{
"order_id": "",
"err_code": "",
"err_msg": ""
}
]
},
"msg": "success",
"requestTime": 1627293504612
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
order_ids | Order Id array |
client_order_ids | Client Order Id array |
fail_infos | Failed information array |
> order_id | Failed order id |
> err_code | Error code |
> err_msg | error msg |
Cancel All Order
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/order/cancel-all-orders
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | Product type |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/order/cancel-all-orders" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"productType": "umcbl","marginCoin": "USDT"}'
Response
{
"code": "00000",
"data": {
"symbol": "BTCUSDT_UMCBL",
"order_ids": [
"1627293504612"
],
"fail_infos": [
{
"order_id": "",
"err_code": "",
"err_msg": ""
}
]
},
"msg": "success",
"requestTime": 1627293504612
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
order_ids | Cancel success order Id list |
fail_infos | cancel failed information |
> order_id | Failed order id |
> err_code | Error code |
> err_msg | Error message |
Get Open Order
Limit rule: 20 times/1s (uid)
HTTP Request
- GET /api/mix/v1/order/current
Get pending order list on one symbol;
Note that for the history order please refer to Get History Orders
For the TPSL order please refer to Get Plan Order (TPSL) List
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | symbol Id (Must be capitalized) |
Request Example
curl "https://api.coincatch.com/api/mix/v1/order/current?symbol=BTCUSDT_UMCBL" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code":"00000",
"data":{
"nextFlag":false,
"endId":"802355881591844864",
"orderList": [
{
"symbol":"BTCUSDT_UMCBL",
"size":1,
"orderId":"802382049422487552",
"clientOid":"RFIut#1627028708738",
"filledQty":0,
"fee":0,
"price":23999.3,
"priceAvg": 23999.00,
"state":"filled",
"side":"open_long",
"timeInForce":"normal",
"totalProfits":0,
"posSide":"long",
"marginCoin":"USDT",
"filledAmount": 48.4520,
"leverage": "6",
"marginMode": "fixed",
"reduceOnly": false,
"enterPointSource": "WEB",
"tradeSide": "buy_single",
"holdMode": "single_hold",
"orderType":"limit",
"orderSource": "normal",
"cTime": "1678779464831",
"uTime": "1678779464891"
}
]
},
"msg":"success"
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol id |
size | Order size |
orderId | Order Id |
clientOid | Client custom id |
filledQty | Transaction volume, base coin |
fee | Transaction fee |
price | Order price |
priceAvg | Average price |
state | Order state |
side | Order direction |
timeInForce | Time In Force |
totalProfits | Total profit and loss |
posSide | Position direction |
marginCoin | Margin currency |
filledAmount | Filled Amount, quote coin |
leverage | leverage |
marginMode | Margin mode |
reduceOnly | Is reduce only |
enterPointSource | enterPointSource |
tradeSide | Trade Side |
holdMode | Hold mode |
orderType | Order type |
orderSource | orderSource |
cTime | Created update time |
uTime | Last update time |
Get All Open Order
Limit rule: 20 times/1s (uid)
HTTP Request
- GET /api/mix/v1/order/marginCoinCurrent
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | productType |
marginCoin | String | No | margin coin |
Request Example
curl "https://api.coincatch.com/api/mix/v1/order/marginCoinCurrent?productType=umcbl&marginCoin=USDT" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code": "00000",
"msg": "success",
"requestTime": 1684852347068,
"data": [
{
"symbol": "BTCUSDT_UMCBL",
"size": 0.050,
"orderId": "1044911928892862465",
"clientOid": "xx005",
"filledQty": 0.000,
"fee": 0E-8,
"price": 25500.00,
"state": "new",
"side": "open_long",
"timeInForce": "normal",
"totalProfits": 0E-8,
"posSide": "long",
"marginCoin": "USDT",
"presetTakeProfitPrice": 33800.00,
"presetStopLossPrice": 11300.00,
"filledAmount": 0.0000,
"orderType": "limit",
"leverage": "4",
"marginMode": "crossed",
"reduceOnly": false,
"enterPointSource": "API",
"tradeSide": "open_long",
"holdMode": "double_hold",
"orderSource": "normal",
"cTime": "1684852338057",
"uTime": "1684852338057"
}
]
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
size | Order size |
orderId | Order Id |
clientOid | Client custom id |
filledQty | Transaction volume |
fee | Transaction fee |
price | Order price |
state | Order state |
side | Order direction |
timeInForce | Time In Force |
totalProfits | Total profit and loss |
posSide | Position direction |
marginCoin | Margin currency |
orderType | Order type |
presetTakeProfitPrice | Take profit price |
presetStopLossPrice | Stop Loss Price |
filledAmount | filledAmount |
leverage | leverage |
marginMode | marginMode |
reduceOnly | reduceOnly |
enterPointSource | enterPointSource |
tradeSide | tradeSide |
holdMode | holdMode |
orderSource | orderSource |
cTime | Created time |
uTime | Last update time |
Get History Orders
Limit rule: 10 times/1s (uid)
HTTP Request
- GET /api/mix/v1/order/history
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
startTime | String | Yes | Start time, milliseconds |
endTime | String | Yes | End time, milliseconds |
pageSize | String | Yes | Page size |
lastEndId | String | No | last end Id of last query |
clientOid | String | No | match exactly with the given 'clientOid' |
isPre | Boolean | No | true: order by order Id asc; default false |
Request Example
curl "https://api.coincatch.com/api/mix/v1/order/history?symbol=BTCUSDT_UMCBL&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code": "00000",
"msg": "success",
"requestTime": 1665715936583,
"data": {
"nextFlag": true,
"endId": "963544804144852112",
"orderList": [
{
"symbol": "SOLUSDT_UMCBL",
"size": 1,
"orderId": "963544804144852112",
"clientOid": "963544804144852113",
"filledQty": 1,
"fee": -0.00629204,
"price": 31.4602,
"priceAvg": 31.4602,
"state": "filled",
"side": "close_short",
"timeInForce": "normal",
"totalProfits": 0.00760000,
"posSide": "short",
"marginCoin": "USDT",
"filledAmount": 31.4602,
"orderType": "limit",
"leverage": "5",
"marginMode": "crossed",
"reduceOnly": false,
"enterPointSource": "WEB",
"tradeSide": "open_long",
"holdMode": "double_hold",
"cTime": "1665452903781",
"uTime": "1665452917467"
}
]
}
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
size | Order size |
orderId | Order Id |
clientOid | Client order id |
filledQty | Transaction volume |
fee | Transaction fee |
price | Order price |
priceAvg | Order fill avg price |
state | Order state |
side | Order direction |
timeInForce | Time In Force |
totalProfits | Total profit and loss |
posSide | Position direction |
marginCoin | Margin currency |
leverage | order leverage |
marginMode | Margin mode |
orderType | Order type |
reduceOnly | is reduce only |
enterPointSource | enterPointSource |
tradeSide | Trade Side |
holdMode | Hold mode |
cTime | create time |
uTime | last update time |
Get ProductType History Orders
Limit rule: 5/1s (uid)
HTTP Request
- GET /api/mix/v1/order/historyProductType
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | Product type |
startTime | String | Yes | Start time, milliseconds |
endTime | String | Yes | End time, milliseconds |
pageSize | String | Yes | page size, max 100 |
lastEndId | String | No | Last query endId |
clientOid | String | No | match exactly with the given 'clientOid' |
isPre | Boolean | No | true: order by order Id asc; default false |
Request Example
curl "https://api.coincatch.com/api/mix/v1/order/historyProductType?productType=umcbl&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code":"00000",
"data":{
"nextFlag": true,
"endId": "963544804144852112",
"orderList": [
{
"symbol":"BTCUSDT_UMCBL",
"size":1,
"orderId":"802382049422487552",
"clientOid":"RFIut#1627028708738",
"filledQty":0,
"fee":0,
"price":23999.3,
"state":"canceled",
"side":"open_long",
"timeInForce":"normal",
"totalProfits":0,
"posSide":"long",
"marginCoin":"USDT",
"leverage":"20",
"marginMode":"crossed",
"orderType":"limit",
"reduceOnly": false,
"enterPointSource": "WEB",
"tradeSide": "open_long",
"holdMode": "double_hold",
"ctime":1627028708807
}
]
},
"msg":"success"
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
size | Order size |
orderId | Order Id |
clientOid | Client custom id |
filledQty | Transaction volume |
fee | Transaction fee |
price | Order price |
priceAvg | Order fill avg price |
state | Order state |
side | Order direction |
timeInForce | Time In Force |
totalProfits | Total profit and loss |
posSide | Position direction |
marginCoin | Margin currency |
leverage | order leverage |
marginMode | account Margin mode |
orderType | Order type |
reduceOnly | is reduce only |
enterPointSource | enterPointSource |
tradeSide | Trade Side |
holdMode | Hold mode |
cTime | create time |
uTime | last update time |
Get Order Details
Limit rule: 10 times/1s (uid)
HTTP Request
- GET /api/mix/v1/order/detail
Request Parameter (Request Param)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
orderId | String | No | Order Id, int64 in string format, 'orderId' or 'clientOid' must have one |
clientOid | String | No | Customized Client Order Id, 'orderId' or 'clientOid' must have one |
Request Example
curl "https://api.coincatch.com/api/mix/v1/order/detail?symbol=BTCUSDT_UMCBL&orderId=802382049422487552" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code":"00000",
"data":{
"symbol":"BTCUSDT_UMCBL",
"size":1,
"orderId":"802382049422487552",
"clientOid":"RFIut#1627028708738",
"filledQty":0,
"priceAvg":0,
"fee":0,
"price":23999.3,
"state":"canceled",
"side":"open_long",
"timeInForce":"normal",
"totalProfits":0,
"posSide":"long",
"marginCoin":"USDT",
"presetTakeProfitPrice":69582.5,
"presetStopLossPrice":21432.5,
"filledAmount":45838,
"orderType":"limit",
"leverage": "6",
"marginMode": "fixed",
"reduceOnly": false,
"enterPointSource": "WEB",
"tradeSide": "buy_single",
"holdMode": "single_hold",
"cTime":1627028708807,
"uTime":1627028717807
},
"msg":"success",
"requestTime":1627300098776
}
Response Description
Parameter | Description |
---|---|
symbol | Symbol Id |
size | Order size |
orderId | Order Id |
clientOid | Client custom id |
filledQty | Transaction volume |
priceAvg | Transaction price |
fee | Transaction fee |
price | Order price |
state | Order state |
side | Order direction |
timeInForce | Time In Force |
totalProfits | Total profit and loss |
posSide | Position direction |
marginCoin | Margin currency |
cTime | create time |
uTime | update time |
presetTakeProfitPrice | Preset take profit price |
presetStopLossPrice | Preset stop loss price |
filledAmount | filled amount, limit/market |
orderType | order type |
leverage | leverage |
marginMode | Margin Mode |
reduceOnly | Is reduce only |
enterPointSource | enterPointSource |
tradeSide | Trade Side |
holdMode | Hold mode |
cTime | Created time, ms |
uTime | Updated time, ms |
Get Order fill detail
Limit rule: 10 times/1s (uid)
HTTP Request
- GET /api/mix/v1/order/fills
Request Parameter (Request Param)
Parameter | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
orderId | String | No | Order Id |
startTime | String | No | Start time (timestamp in milliseconds) This field is required if orderId is empty |
endTime | String | No | End time (timestamp in milliseconds) This field is required if orderId is empty |
lastEndId | String | No | Pagination parameter; Query the data after this tradeId; works when orderId is null |
Request Example
curl "https://api.coincatch.com/api/mix/v1/order/fills?symbol=BTCUSDT_UMCBL&orderId=802382049422487552" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response Data
{
"code":"00000",
"data":[
{
"tradeId":"802377534023585793",
"symbol":"BTCUSDT_UMCBL",
"orderId":"802377533381816325",
"price":"0",
"sizeQty":"0.3247",
"fee":"0E-8",
"side":"burst_close_long",
"fillAmount":"0.3247",
"profit":"0E-8",
"enterPointSource": "WEB",
"tradeSide": "buy_single",
"holdMode": "single_hold",
"takerMakerFlag": "taker",
"ctime":"1627027632241"
}
],
"msg":"success",
"requestTime":1627386245672
}
Response Description
Parameter | Description |
---|---|
tradeId | Trade Id |
symbol | Symbol Id |
orderId | Order Id |
price | Transaction price |
sizeQty | Transaction volume |
fee | Transaction fee |
side | Trade side |
fillAmount | fill Amount |
profit | profit |
enterPointSource | enterPointSource |
tradeSide | Trade Side |
holdMode | Hold mode |
takerMakerFlag | taker, maker |
cTime | Trade time |
Get ProductType Order fill detail
Limit rule: 10 times/1s (uid)
HTTP Request
- GET /api/mix/v1/order/allFills
Request Parameter (Request Param)
Parameter | Type | Required | Description |
---|---|---|---|
productType | String | Yes | Product type |
startTime | String | No | Start time (timestamp in milliseconds) This field is required if querying all details |
endTime | String | No | End time (timestamp in milliseconds) This field is required if querying all details |
lastEndId | String | No | Query the data after this tradeId |
Default pageSize: 100
Request Example
curl "https://api.coincatch.com/api/mix/v1/order/allFills?productType=umcbl&startTime=1659406928000&endTime=1659410528000" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response Data
{
"code":"00000",
"data":[
{
"tradeId":"802377534023585793",
"symbol":"BTCUSDT_UMCBL",
"orderId":"802377533381816325",
"price":"0",
"sizeQty":"0.3247",
"fee":"0E-8",
"side":"burst_close_long",
"fillAmount":"0.3247",
"profit":"0E-8",
"enterPointSource": "WEB",
"tradeSide": "buy_single",
"holdMode": "single_hold",
"takerMakerFlag": "taker",
"ctime":"1627027632241"
}
],
"msg":"success",
"requestTime":1627386245672
}
Response Description
Parameter | Description |
---|---|
tradeId | Trade Id |
symbol | Symbol Id |
orderId | Order Id |
price | Transaction price |
sizeQty | Transaction volume |
fee | Transaction fee |
side | Trade side |
fillAmount | fill Amount |
profit | profit |
enterPointSource | enterPointSource |
tradeSide | Trade Side |
holdMode | Hold mode |
takerMakerFlag | taker, maker |
cTime | Trade time |
Place Plan order
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/plan/placePlan
Request Parameter (Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
size | String | Yes | Order quantity |
executePrice | String | No | Execute price, could not be null when orderType=limit |
triggerPrice | String | Yes | Trigger price |
side | String | Yes | Order side |
orderType | String | Yes | Order type |
triggerType | String | Yes | Trigger type |
clientOid | String | No | Unique Client ID, idempotent is only promised within 24 hours |
presetTakeProfitPrice | String | No | Preset take profit price |
presetStopLossPrice | String | No | Preset stop loss price |
reduceOnly | String | No | Default false; set to true when try to reduce position in 'single_hold' mode and when close position with value less than 5USDT, DOES NOT WORK under 'double_hold' mode |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/placePlan" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","size": "0.01","executePrice": "23145.5","triggerPrice":"23555.5","side":"open_long","orderType":"limit","triggerType":"market_price","clientOid":"test@483939290000"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Modify Plan Order
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/plan/modifyPlan
Request Parameter (Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
orderId | String | No | Plan order Id, 'orderId' or 'clientOid' must have one |
clientOid | String | No | Client order Id, 'orderId' or 'clientOid' must have one |
marginCoin | String | Yes | Margin currency |
symbol | String | Yes | Symbol Id |
executePrice | String | No | Strike price, could not be null when orderType=limit |
triggerPrice | String | Yes | Trigger price |
triggerType | String | Yes | Trigger type |
orderType | String | Yes | Order type |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/modifyPlan" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"orderId":"803521986049314816","symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","executePrice": "23145.5","triggerPrice":"23555.5","orderType":"limit","triggerType":"market_price"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Modify Plan Order TPSL
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/plan/modifyPlanPreset
Request Parameter (Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
orderId | String | No | Plan order Id, 'orderId' or 'clientOid' must have one |
clientOid | String | No | Client order Id, 'orderId' or 'clientOid' must have one |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
symbol | String | Yes | Symbol Id (Must be capitalized) |
presetTakeProfitPrice | String | No | Take profit price If it is empty, cancel and take profit |
presetStopLossPrice | String | No | Stop loss price If it is empty, cancel the stop loss |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/modifyPlanPreset" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"orderId":"803521986049314816","symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","presetTakeProfitPrice": "23145.5","presetStopLossPrice":"23555.5"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Place Stop Order
Limit rule: 10 times/1s (uid)
At present, take-profit and stop-loss orders are only supported at market price, and the trigger type is transaction trigger price
HTTP Request
- POST /api/mix/v1/plan/placeTPSL
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
marginCoin | String | Yes | Margin currency (Must be capitalized) |
symbol | String | Yes | Symbol Id (Must be capitalized) |
planType | String | Yes | plan type, please use "profit_plan", "loss_plan" and "moving_plan" |
triggerPrice | String | Yes | Trigger price |
triggerType | String | No | Trigger Type default 'fill_price' |
holdSide | String | Yes | Hold Side, Whether this position is long or short |
size | String | No | Order Quantity Default Position Quantity |
rangeRate | String | No | Only works when planType is "moving_plan", "1" means 1.0% price correction, two decimal places |
clientOid | String | No | Customized client order ID |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/placeTPSL" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","size": "0.01","planType": "profit_plan","triggerPrice":"23555.5","holdSide":"long"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Place Trailing Stop Order
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/plan/placeTrailStop
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
marginCoin | String | Yes | Margin currency (Must be capitalized) |
symbol | String | Yes | Symbol Id (Must be capitalized) |
triggerPrice | String | Yes | Trigger price |
triggerType | String | No | Trigger Type |
size | String | Yes | Order Quantity, please provide value less than 'available position size' |
side | String | Yes | Order side |
rangeRate | String | Yes | "1" means 1.0% price correction, max "10" |
clientOid | String | No | Customized client order ID |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/placeTrailStop" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","size": "0.01","triggerPrice":"23555.5","side":"open_long","rangeRate":"10"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Place Position TPSL
Limit rule: 10 times/1s (uid)
When the position take profit and stop loss are triggered, the full amount of the position will be entrusted at the market price by default
HTTP Request
- POST /api/mix/v1/plan/placePositionsTPSL
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
marginCoin | String | Yes | Margin currency (Must be capitalized) |
symbol | String | Yes | Symbol Id (Must be capitalized) |
planType | String | Yes | plan type, please use "pos_profit", "pos_loss" |
triggerPrice | String | Yes | Trigger price |
triggerType | String | Yes | Trigger type |
holdSide | String | Yes | Whether this position is long or short |
clientOid | String | No | Customized client order ID |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/placePositionsTPSL" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","planType": "pos_profit","triggerPrice":"23555.5","holdSide":"long"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Modify Stop Order
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/plan/modifyTPSLPlan
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
orderId | String | No | TPSL Order Id, int64 in string format, 'orderId' or 'clientOid' must have one |
clientOid | String | No | Customized Client Order Id, 'orderId' or 'clientOid' must have one |
marginCoin | String | Yes | Margin currency (Must be capitalized) |
symbol | String | Yes | Symbol Id (Must be capitalized) |
triggerPrice | String | Yes | Trigger price |
planType | String | Yes | Refer to plan type: "pos_profit" or "profit_plan"; "pos_loss" or "loss_plan" |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/modifyTPSLPlan" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"orderId":"803521986049314816","symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","triggerPrice":"23555.5","planType":"pos_profit"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Cancel Plan Order (TPSL)
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/plan/cancelPlan
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
orderId | String | No | Order ID, 'orderId' or 'clientOid' must have one |
clientOid | String | No | Client Order ID, 'orderId' or 'clientOid' must have one |
symbol | String | Yes | Symbol Id (Must be capitalized) |
marginCoin | String | Yes | Margin Coin |
planType | String | Yes | plan type |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/cancelPlan" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"orderId":"803521986049314816","symbol": "BTCUSDT_UMCBL","marginCoin": "USDT","planType":"loss_plan"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Cancel Plan Order (TPSL) By Symbol
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/plan/cancelSymbolPlan
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
planType | String | Yes | plan type |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/cancelSymbolPlan" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"symbol": "BTCUSDT_UMCBL","planType":"loss_plan"}'
Response
{
"code":"00000",
"data":true,
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
data | Whether 'cancel' is received |
Final cancel result should be confirmed via websocket or /api/mix/v1/plan/currentPlan
Cancel All trigger Order (TPSL)
Limit rule: 10 times/1s (uid)
HTTP Request
- POST /api/mix/v1/plan/cancelAllPlan
Request Parameter(Request Body)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | Yes | product type |
planType | String | Yes | plan type, default 'plan' |
Request Example
curl -X POST "https://api.coincatch.com/api/mix/v1/plan/cancelPlan" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json" \
-d \'{"productType":"umcbl","planType":"loss_plan"}'
Response
{
"code":"00000",
"data":{
"clientOid":"RFIut#1627300490884",
"orderId":"803521986049314816"
},
"msg":"success",
"requestTime":1627300490899
}
Response Description
Parameter | Description |
---|---|
clientOid | Client custom Id |
orderId | Order Id |
Get Plan Order (TPSL) List
Limit rule: 20 times/1s (uid)
HTTP Request
- GET /api/mix/v1/plan/currentPlan
Request Parameter
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol Id (Must be capitalized) |
isPlan | String | No | Is plan |
productType | String | No | product type |
Request Example
curl "https://api.coincatch.com/api/mix/v1/plan/currentPlan?symbol=BTCUSDT_UMCBL&isPlan=plan" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code":"00000",
"data":[
{
"orderId":"803521986049314816",
"clientOid":"xxx001",
"symbol":"BTCUSDT_UMCBL",
"marginCoin":"USDT",
"size":"1",
"executePrice":"38923.1",
"triggerPrice":"45000.3",
"status":"not_trigger",
"orderType":"limit",
"planType":"normal_plan",
"side":"open_long",
"triggerType":"fill_price",
"presetTakeProfitPrice":"0",
"presetTakeLossPrice":"0",
"rangeRate": "",
"enterPointSource": "WEB",
"tradeSide": "buy_single",
"holdMode": "single_hold",
"ctime":"1627300490867"
}
],
"msg":"success",
"requestTime":1627354109502
}
Response Description
Parameter | Description |
---|---|
orderId | Order Id |
clientOid | Client Order Id |
symbol | Symbol Id |
marginCoin | Margin currency |
size | Order size |
executePrice | Order price |
triggerPrice | Trigger price |
status | Plan order status |
orderType | Order type |
planType | plan type |
side | Trade side |
triggerType | Trigger type |
presetTakeProfitPrice | Preset take profit price |
presetTakeLossPrice | Preset stop loss price |
rangeRate | planType is "moving_plan", "1" means 1.0% price correction, two decimal places |
enterPointSource | enterPointSource |
tradeSide | Trade Side |
holdMode | Hold Mode |
ctime | Order creation time |
Get History Plan Orders (TPSL)
Limit rule: 10 times/1s (uid)
HTTP Request
- GET /api/mix/v1/plan/historyPlan
Request Parameter (Request Param)
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
productType | String | No | productType |
symbol | String | No | Symbol Id (Must be capitalized) |
startTime | String | Yes | Start time, milliseconds (For Managed Sub-Account, the StartTime cannot be earlier than the binding time) |
endTime | String | Yes | End time, milliseconds |
pageSize | Integer | No | Page size, default 100 |
isPre | boolean | No | true: order by order Id asc; default false |
isPlan | String | No | Is plan |
Request Example
curl "https://api.coincatch.com/api/mix/v1/plan/historyPlan?symbol=BTCUSDT_UMCBL&startTime=1659406928000&endTime=1659414128000&pageSize=20" \
-H "ACCESS-KEY:you apiKey" \
-H "ACCESS-SIGN:*******" \
-H "ACCESS-PASSPHRASE:*****" \
-H "ACCESS-TIMESTAMP:1659076670000" \
-H "locale:en-US" \
-H "Content-Type: application/json"
Response
{
"code": "00000",
"msg": "success",
"requestTime": 1693968259096,
"data": [
{
"orderId": "1048210602999750657",
"clientOid": "1048210602999750656",
"executeOrderId": "1048508364888899593",
"symbol": "SBTCSUSDT_SUMCBL",
"marginCoin": "SUSDT",
"size": "0.001",
"executePrice": "27500",
"triggerPrice": "27200",
"status": "triggered",
"orderType": "limit",
"planType": "normal_plan",
"side": "sell_single",
"triggerType": "market_price",
"presetTakeProfitPrice": "0",
"presetTakeLossPrice": "0",
"rangeRate": null,
"enterPointSource": "API",
"tradeSide": "sell_single",
"holdMode": "single_hold",
"reduceOnly": false,
"executeTime": "1685709795259",
"executeSize": "0.001",
"cTime": "1685638803243",
"uTime": "1685709795259"
}
]
}
Response Description
Parameter | Description |
---|---|
orderId | Plan Order Id |
clientOid | Client Order Id |
executeOrderId | Execute success Order Id |
symbol | Symbol Id |
marginCoin | Margin currency |
size | Order size |
executePrice | Order price |
triggerPrice | Trigger price |
status | Plan order status |
orderType | Order type |
planType | Plan type |
side | Side |
triggerType | Trigger type |
presetTakeProfitPrice | Preset take profit price |
presetTakeLossPrice | Preset stop loss price |
rangeRate | planType is "moving_plan", "1" means 1.0% price correction, two decimal places |
enterPointSource | enterPointSource |
tradeSide | Trade Side |
holdMode | Hold Mode |
reduceOnly | Is reduce only |
executeTime | Execute Time |
executeSize | Execute Size |
ctime | Order creation time |
utime | Order Update time |
WebSocketAPI
Overview
WebSocket is a new HTML5 protocol that achieves full-duplex data transmission between the client and server, allowing data to be transferred effectively in both directions. A connection between the client and server can be established with just one handshake. The server will then be able to push data to the client according to preset rules. Its advantages include:
- The WebSocket request header size for data transmission between client and server is only 2 bytes.
- Either the client or server can initiate data transmission.
- There's no need to repeatedly create and delete TCP connections, saving resources on bandwidth and server.
It is strongly recommended that developers use WebSocket API to obtain market information and transaction depth.
domain | WebSocket API | Recommended to use |
---|---|---|
public domain | wss://ws.coincatch.com/public/v1/stream | public |
private domain | wss://ws.coincatch.com/private/v1/stream | private |
Connect
Connection instructions:
Connection limit: 100 connections per IP
Subscription limit: 240 times per hour
If there’s a network problem, the system will automatically disconnect the connection.
The connection will break automatically if the subscription is not established or data has not been pushed for more than 30 seconds.
To keep the connection stable:
- Set a timer of 30 seconds.
- If the timer is triggered, send the String 'ping'.
- Expect a 'pong' as a response. If the response message is not received within 30 seconds, please raise an error and/or reconnect.
- The Websocket server accepts up to 10 messages per second. The message includes:
- 'ping' frame
- Messages in JSON format, such as subscribe, unsubscribe.
- If the user sends more messages than the limit, the connection will be disconnected. IPs that are repeatedly disconnected may be blocked by the server;
- A single connection can subscribe up to 1000 Streams;
- A single IP can create up to 100 connections.
Login
apiKey: Unique identification for invoking API. Requires user to apply one manually.
passphrase: APIKey password
timestamp: the Unix Epoch time, the unit is seconds(--different from the signature timestamp of restAPI--)
secretKey: The security key generated when the user applies for APIKey, e.g. : 22582BD0CFF14C41EDBF1AB98506286D
Example of timestamp
const timestamp ='' + Date.now() / 1000
Sign example
sign=CryptoJS.enc.Base64.Stringify(CryptoJS.HmacSHA256(timestamp +'GET'+'/user/verify', secretKey))
method: always 'GET'.
requestPath : always '/user/verify'
sign: signature string, the signature algorithm is as follows:
First concatenate timestamp
, method
, requestPath
, then use HMAC SHA256 method to encrypt the concatenated string with SecretKey, and then perform Base64 encoding.
The request will expire 30 seconds after the timestamp. If your server time differs from the API server time, we recommended using the REST API to query the API server time and then compare the timestamp.
Steps to generate the final signature:
Step 1. concat the content
Long timestamp = System.currentTimeMillis() / 1000;
String content = timestamp +"GET"+"/user/verify";
Step 1. Use the private key secretkey to encrypt the string to be signed with hmac sha256
String hash = hmac_sha256(content, secretkey)
The final step is to base64 encode the hash
String sign = base64.encode(hash)
If login fails, it will automatically disconnect
Request format description
{
"op":"login",
"args":[
{
"apiKey":"<api_key>",
"passphrase":"<passphrase>",
"timestamp":"<timestamp>",
"sign":"<sign>"
}
]
}
Request Example
{
"op":"login",
"args":[
{
"apiKey":"cc_573af5eca856acd91c230da294ce2105",
"passphrase":"123456",
"timestamp":"1538054050",
"sign":"8RCOqCJAhhEh4PWcZB/96QojLDqMAg4qNynIixFzS3E="
}
]
}
Successful Response Example
{
"event":"login",
"code":"0",
"msg":""
}
Failure Response Example
{
"event":"error",
"code":"30005",
"msg":"error"
}
Subscribe
Subscription Instructions
Request format description
{
"op": "subscribe",
"args": ["<SubscriptionTopic>"]
}
WebSocket channels : public and private
.
Public channels
-- include
etc -- do not require log in.
Private channels
-- include
instId
from Get All SymbolsbaseCoin + quoteCoin
Users can choose to subscribe to one or more channels, and the total length of multiple channels cannot exceed 4096 bytes.
Request Example
{
"op":"subscribe",
"args":[
{
"instType":"mc",
"channel":"ticker",
"instId":"BTCUSDT"
},
{
"instType":"mc",
"channel":"candle5m",
"instId":"BTCUSDT"
}
]
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, subscribe |
args | Array | Yes | List of subscribe channels |
> instType | String | No | Instrument Type MC:Perpetual contract public channel |
> channel | String | Yes | Channel name |
> instId | String | No | Instrument ID |
Example response
{ "event": "subscribe", "arg": { "instType":"MC","channel":"ticker", "instId":"BTCUSDT" }}
Return parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event, subscribe error |
arg | Object | No | Subscribed channel |
> instType | String | No | Instrument Type MC:Perpetual contract public channel |
> channel | String | Yes | Channel name |
> instId | String | No | Instrument ID |
code | String | No | Error code |
msg | String | No | Error message |
Unsubscribe
Unsubscribe from one or more channels.
Request format description
{
"op": "unsubscribe",
"args": ["< SubscriptionTopic> "]
}
Request Example
{
"op":"unsubscribe",
"args":[
{
"instType":"mc",
"channel":"ticker",
"instId":"BTCUSDT"
},
{
"instType":"mc",
"channel":"candle1m",
"instId":"BTCUSDT"
}
]
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, unsubscribe |
args | Array | Yes | List of channels to unsubscribe from |
> instType | String | Yes | Instrument Type MC:Perpetual contract public channel |
> channel | String | Yes | Channel name |
> instId | String | Yes | Instrument ID |
Example response
{
"op":"unsubscribe",
"args":[
{
"instType":"mc",
"channel":"ticker",
"instId":"BTCUSDT"
},
{
"instType":"mc",
"channel":"candle1m",
"instId":"BTCUSDT"
}
]
}
Return parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event, unsubscribe error |
arg | Object | Yes | Unsubscribed channel |
> instType | String | Yes | Instrument Type |
> channel | String | Yes | Channel name |
> instId | String | Yes | Instrument ID |
code | String | No | Error Code |
msg | String | No | Error Message |
Checksum
This mechanism can assist users in checking the accuracy of depth(order book) data.
Merging update data into snapshot
After subscribe to the channel (such as books
200 levels) of Order book , user first receive the initial snapshot of market depth. Afterwards the incremental update is subsequently received, user are responsible to update the snapshot from client side.
If there are any levels with same price from the updates, compare the amount with the snapshot order book:
If the amount is 0, delete this depth data.
If the amount changes, replace the depth data.
If there is no level in the snapshot with same price from the update, insert the update depth information into the snapshot sort by price (bid in descending order, ask in ascending order).
Calculate Checksum
Use the first 25 bids and asks in the local snapshot to build a string (where a colon connects the price and amount in an 'ask' or a 'bid'), and then calculate the CRC32 value (32-bit signed integer).
Calculate Checksum
1. More than 25 levels of bid and ask
A local snapshot of market depth (only 2 levels of the orderbook are shown here, while 25 levels of orderbook should actually be intercepted):
"bids": [
[ 43231.1, 4 ], //bid1
[ 43231, 6 ] //bid2
]
"asks": [
[ 43232.8, 9 ], //ask1
[ 43232.9, 8 ] //ask2
]
Build the string to check CRC32:
"43231.1:4:43232.8:9:43231:6:43232.9:8"
The sequence:
"bid1[price:amount]:ask1[price:amount]:bid2[price:amount]:ask2[price:amount]"
2. Less than 25 levels of bid or ask
A local snapshot of market depth:
"bids": [
[ 3366.1, 7 ] //bid1
]
"asks": [
[ 3366.8, 9 ], //ask1
[ 3368 , 8 ], //ask2
[ 3372 , 8 ] //ask3
]
Build the string to check CRC32:
"3366.1:7:3366.8:9:3368:8:3372:8"
The sequence:
"bid1[price:amount]:ask1[price:amount]:ask2[price:amount]:ask3[price:amount]"
- When the bid and ask depth data exceeds 25 levels, each of them will intercept 25 levels of data, and the string to be checked is queued in a way that the bid and ask depth data are alternately arranged.
Such as:
bid1[price:amount]
:ask1[price:amount]
:bid2[price:amount]
:ask2[price:amount]
... - When the bid or ask depth data is less than 25 levels, the missing depth data will be ignored.
Such as:
bid1[price:amount]
:ask1[price:amount]
:ask2[price:amount]
:ask3[price:amount]
... - If price is '0.5000', DO NOT calculate the checksum by '0.5', please DO use the original value
Public Channels
Tickers Channel
Retrieve the latest traded price, bid price, ask price and 24-hour trading volume of the instruments. Data will be pushed every 150 ms.
Request Example
{
"op":"subscribe",
"args":[
{
"instType":"mc",
"channel":"ticker",
"instId":"BTCUSDT"
}
]
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, subscribe unsubscribe |
args | Array | Yes | List of subscribed channels |
> instType | String | Yes | Instrument Type MC : Perpetual contract public channel |
> channel | String | Yes | Channel name, tickers |
> instId | String | Yes | Instrument ID |
Successful Response Example
{ "event": "subscribe", "arg": { "instType":"mc","channel": "ticker", "instId": "BTCUSDT"} }
Failure Response Example
{
"event": "error",
"code": 30001,
"msg": "instType:MC,channel:ticker,instId:BTC-USDT doesn't exist"
}
Response parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event, subscribe unsubscribe error |
arg | Object | No | Subscribed channel |
> instType | String | Yes | Instrument type |
> channel | String | Yes | Channel name |
> instId | String | Yes | Instrument ID |
code | String | No | Error Code |
msg | String | No | Error Message |
Push data Example
{
"action":"snapshot",
"arg":{
"instType":"mc",
"channel":"ticker",
"instId":"BTCUSDT"
},
"data":[
{
"instId":"BTCUSDT",
"last":"44962.00",
"bestAsk":"44962",
"bestBid":"44961",
"high24h":"45136.50",
"low24h":"43620.00",
"priceChangePercent":"0.02",
"capitalRate":"-0.00010",
"nextSettleTime":1632495600000,
"systemTime":1632470889087,
"markPrice":"44936.21",
"indexPrice":"44959.23",
"holding":"1825.822",
"baseVolume":"39746.470",
"quoteVolume":"1760329683.834",
"openUtc": "17088.5000000000000000",
"chgUTC": "-0.00778",
"symbolType": 1,
"symbolId": "BTCUSDT_UMCBL",
"deliveryPrice": "0",
"bidSz": "10.344",
"askSz": "3.024"
}
]
}
Push data parameters
Parameter | Type | Description |
---|---|---|
arg | Object | Successfully subscribed channel |
> instType | String | Instrument Type |
> channel | String | Channel name |
> instId | String | Instrument Name |
action | String | Push data action, incremental push data or full push data snapshot : full update : incremental |
data | Array | Subscribed data |
> instId | String | Instrument Name |
> last | String | Last traded price |
>bestAsk | String | Best ask price |
>bestBid | String | Best bid price |
>high24h | String | Highest price in the past 24 hours |
>low24h | String | Lowest price in the past 24 hours |
>priceChangePercent | String | Price change int the past 24 hours |
>capitalRate | String | Funding rate |
>nextSettleTime | String | The next fund rate settlement time timestamp milliseconds |
>systemTime | String | system time |
>marketPrice | String | Market price |
>indexPrice | String | Index price |
>holding | String | Open interest |
>baseVolume | String | 24h trading volume, with a unit of base . |
>quoteVolume | String | 24h trading volume, with a unit of quote |
>openUtc | String | Open price at UTC 00:00 |
>chgUTC | String | Price change since UTC 00:00 |
>symbolType | String | SymbolType: delivery: Settled Futures; perpetual: Perpetual Futures |
>symbolId | String | Symbol Id |
>deliveryPrice | String | Delivery price - 0 when SymbolType=perpetual |
>bidSz | String | Best bid size |
>askSz | String | Best ask size |
Candlesticks Channel
Retrieve the candlesticks data of an instrument. Data will be pushed every 500 ms.
The channel will push a snapshot after successful subscribed, later on the updates will be pushed
If intended to query history data in a customized time range, please refer to Get Candle Data
Request Example
{
"op":"subscribe",
"args":[
{
"instType":"mc",
"channel":"candle1m",
"instId":"BTCUSDT"
}
]
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, subscribe unsubscribe |
args | Array | Yes | List of subscribed channels |
> instType | String | Yes | Instrument Type MC : Perpetual contract public channel |
> channel | String | Yes | Channel Name,candle1W candle1D candle12H candle4H candle1H candle30m candle15m candle5m candle1m |
> instId | String | Yes | Instrument ID |
Successful Response Example
{
"event":"subscribe",
"arg":{
"instType":"mc",
"channel":"candle1D",
"instId":"BTCUSDT"
}
}
Failure Response Example
{
"event":"error",
"code":30003,
"instType":"mc",
"channel":"candle1D",
"instId":"BTC-USDT Symbol not exists"
}
Response parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event, subscribe unsubscribe error |
arg | Object | No | Subscribed channel |
> instType | String | Yes | Instrument Type |
> channel | String | Yes | channel name |
> instId | String | Yes | Instrument ID |
code | String | No | Error Code |
msg | String | No | Error Message |
Push Data Example - snapshot
{
"action": "snapshot",
"arg":{
"instType":"mc",
"channel":"candle1D",
"instId":"BTCUSDT"
},
"data":[
[
"1639584000000",
"8533.02",
"8553.74",
"8527.17",
"8548.26",
"45247"
]
]
}
Push Data Example - update
{ "action": "update", "arg": { "instType": "mc", "channel": "candle1D", "instId": "BTCUSDT" }, "data": [ [ "1665590400000", "19129", "19223.5", "19007.5", "19078.5", "67440.713" ] ] }
Push data parameters**
Parameter | Type | Description |
---|---|---|
action | String | snapshot or update |
arg | Object | Successfully subscribed channel |
> instType | String | Instrument Type |
> channel | String | Channel name |
> instId | String | Instrument ID |
data | Array | Subscribed data |
> ts | String | Data generation time, Unix timestamp format in milliseconds |
> o | String | Open price |
> h | String | highest price |
> l | String | Lowest price |
> c | String | Close price |
> baseVol | String | Trading volume, with a unit of base coin. |
Order Book Channel
Subscribe order book data.
Use books
for snapshot data, book5
for 5 depth levels, book15
for 15 depth levels
books
: Push the fullsnapshot
data for the first time, pushupdate
afterwards, that is, if there is a change in depth, the depth data that has changed will be pushed.books1
: 1 depth levels will be pushed every time(all snapshot, no update).books5
: 5 depth levels will be pushed every time(all snapshot, no update).books15
: 15 depth levels will be pushed every time(all snapshot, no update). Data will be pushed every 100 ~ 200 ms when there is change in order book.
Channel | Length of bids | Length of asks | Remark |
---|---|---|---|
books | maximum 200 | maximum 200 | Snapshot and update might return less than 200 bids/asks as per symbol's orderbook various from each other; The number of bids/asks is not a fixed value and may vary in the future |
books1 | 1 | 1 | Top 1 order book of "books" that begins from bid1/ask1 |
books5 | 5 | 5 | Top 5 order book of "books" that begins from bid1/ask1 |
books15 | 15 | 15 | Top 15 order book of "books" that begins from bid1/ask1 |
For example, if the whole order book consist of 20 bids and 12 asks
channel books return 20 bids and 12 asks
channel books1 return 1 bids and 1 asks, bids return index 19(index 19 is bid1), asks return index 0
channel books5 return 5 bids and 5 asks, bids return from index 15 to 19(index 19 is bid1), asks return from index 0 to index 4
channel books15 return 15 bids index from 5 to 19(index 19 is bid1), and return 12 asks index from 0 to 11
Noted that bids are in descending order, while asks are in ascending order
Request Example
{
"op":"subscribe",
"args":[
{
"instType":"mc",
"channel":"books5",
"instId":"BTCUSDT"
}
]
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, subscribe unsubscribe |
args | Array | Yes | List of subscribed channels |
> instType | String | Yes | Instrument type MC : Perpetual contract public channel |
> channel | String | Yes | Channel name, books , books1 , books5 , books15 |
> instId | String | Yes | Instrument ID, BTCUSDT |
Example Response
{
"event":"subscribe",
"arg":{
"instType":"mc",
"channel":"books5",
"instId":"BTCUSDT"
}
}
Failure example
{
"event":"error",
"code":30003,
"msg":"",
"instType":"mc",
"channel":"books5",
"instId":"BTC-USDT Symbol not exists"
}
Response parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event,subscribe unsubscribe error |
arg | Object | No | Subscribed channel |
> instType | String | Yes | Instrument Type |
> channel | String | Yes | Channel name |
> instId | String | Yes | Instrument ID |
msg | String | No | Error Message |
code | String | No | Error Code |
Push data parameters
Parameter | Type | Description |
---|---|---|
arg | Object | Successfully subscribed channel |
> instType | String | Instrument Type |
> channel | String | Channel name |
> instId | String | Instrument ID |
action | String | Push data action, incremental push data or full push data. snapshot : full; update : incremental |
data | Array | Subscribed data array |
> asks | Array | Order book on sell side |
> bids | Array | Order book on buy side |
> ts | String | Order book generation time, Unix timestamp format in milliseconds |
> checksum | Integer | Checksum |
An example of the array of asks and bids values: ["411.8", "10"] where "411.8" is the depth price, "10" is the size
Trades Channel
Retrieve the recent trades data. Data will be pushed whenever there is a trade.
Request Example
{
"op":"subscribe",
"args":[
{
"instType":"mc",
"channel":"trade",
"instId":"BTCUSDT"
}
]
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, subscribe unsubscribe |
args | Array | Yes | List of subscribed channels |
> instType | String | Yes | Instrument type MC : Perpetual contract public channel |
> channel | String | Yes | Channel Name,trade |
> instId | String | Yes | Instrument ID, BTCUSDT |
Successful Response Example
{
"event":"subscribe",
"arg":[
{
"instType":"mc",
"channel":"trade",
"instId":"BTCUSDT"
}
]
}
Failure Response Example
{
"event":"error",
"code":30003,
"msg":"",
"instType":"mc",
"channel":"trade",
"instId":"BTC-USDT Symbol not exists"
}
Response parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event,subscribe unsubscribe error |
arg | Object | No | Subscribed channel |
> instType | String | Yes | InstrumentType |
> channel | String | Yes | Channel Name |
> instId | String | Yes | Instrument ID |
code | String | No | Error Code |
msg | String | No | Error Message |
Push data example
{
"action": "snapshot",
"arg": {
"instType": "mc",
"channel": "trade",
"instId": "BTCUSDT"
},
"data": [
[
"1665645128291",
"18991",
"0.016",
"buy"
],
[
"1665645128256",
"18990.5",
"0.241",
"sell"
]
]
}
Push data parameters
Parameter | Type | Description |
---|---|---|
action | String | snapshot for the first push, afterwards push data will be update |
arg | Object | Successfully subscribed channel |
> instType | String | Instrument Type |
> channel | String | Channel Name |
> instId | String | Instrument ID |
data | Array | Subscribed data String array |
> ts | String | Filled time, Unix timestamp format in milliseconds |
> px | String | Trade price |
> sz | String | Trade size |
> side | String | Trade direction, buy , sell |
New Trades Channel
Retrieve the recent trades data. The first snapshot will push 50 trade records. Data will be pushed whenever there is a trade.
Request Example
{
"op":"subscribe",
"args":[
{
"instType":"mc",
"channel":"tradeNew",
"instId":"BTCUSDT"
}
]
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, subscribe unsubscribe |
args | Array | Yes | List of subscribed channels |
> instType | String | Yes | Instrument type MC : Perpetual contract public channel |
> channel | String | Yes | Channel Name,tradeNew |
> instId | String | Yes | Instrument ID, BTCUSDT |
Successful Response Example
{
"event":"subscribe",
"arg":[
{
"instType":"mc",
"channel":"tradeNew",
"instId":"BTCUSDT"
}
]
}
Failure Response Example
{
"event":"error",
"code":30003,
"msg":"",
"instType":"mc",
"channel":"tradeNew",
"instId":"BTC-USDT Symbol not exists"
}
Response parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event,subscribe unsubscribe error |
arg | Object | No | Subscribed channel |
> instType | String | Yes | InstrumentType |
> channel | String | Yes | Channel Name |
> instId | String | Yes | Instrument ID |
code | String | No | Error Code |
msg | String | No | Error Message |
Push data example - snaphsot
{
"data": [
{
"p": "20221.5",
"c": "0.009",
"ti": "969054894406951028",
"ty": "sell",
"ts": 1666766611672
},
{
"p": "20221.5",
"c": "1.100",
"ti": "969054894406951026",
"ty": "sell",
"ts": 1666766611672
}
],
"arg": {
"instType": "mc",
"instId": "BTCUSDT",
"channel": "tradeNew"
},
"action": "snapshot"
}
Push data example - update
{
"data": [
{
"p": "20221.0",
"c": "0.249",
"ti": "969054896504102913",
"ty": "buy",
"ts": 1666766612172
}
],
"arg": {
"instType": "mc",
"instId": "BTCUSDT",
"channel": "tradeNew"
},
"action": "update"
}
Push data parameters
Parameter | Type | Description |
---|---|---|
action | String | snapshot for the first push, afterwards push data will be update |
arg | Object | Successfully subscribed channel |
> instType | String | Instrument Type |
> channel | String | Channel Name |
> instId | String | Instrument ID |
data | Array | Subscribed data String array |
> ts | String | Filled time, Unix timestamp format in milliseconds |
> p | String | Trade price |
> c | String | Trade size |
> ty | String | Trade direction, buy , sell |
> ti | String | Trade ID |
Private Channels
Account Channel
Retrieve account information. Data will be pushed when triggered by events such as placing/canceling order, and will also be pushed in regular interval according to subscription granularity.
Request Example
{
"op": "subscribe",
"args": [{
"instType": "UMCBL",
"channel": "account",
"instId": "default"
}]
}
Request Parameter
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation,subscribe unsubscribe |
args | Array | Yes | Subscribed channel |
> instType | String | Yes | Instrument Type UMCBL :USDT Perpetual Contract; DMCBL :Coin Margin Perpetual Contract |
> channel | String | Yes | Channel name account |
> instId | String | Yes | Coin, please set to default |
Successful Response Example
{
"event":"subscribe",
"arg":{
"instType":"UMCBL",
"channel":"account",
"instId":"default"
}
}
Failure Response Example
{
"event": "error",
"code": 30003,
"msg": "instType:UMCBL,account:ticker,instId:BTC-USDT Symbol not exists"
}
Response parameters
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Operation,subscribe unsubscribe error |
arg | Object | No | Subscribed channel |
> instType | String | Yes | Instrument Type |
> channel | String | Yes | Channel Name |
> instId | String | No | Symbol Name |
code | String | No | Error code |
msg | String | No | Error message |
Push Data Parameter
Parameter | Type | Description |
---|---|---|
arg | Object | Subscribed channel |
> instType | String | Instrument Type |
> channel | String | Channel Name |
> instId | String | Coin |
data | Array | Subscribed Data |
marginCoin | String | Margin Coin |
locked | String | Lock balance |
available | String | Available balance |
maxOpenPosAvailable | String | Max available to open position |
maxTransferOut | String | Max transfer out |
equity | String | Equity of the currency |
usdtEquity | String | Equity of the currency USD |
First push: full push.
Incremental push: push transaction changes
Positions Channel
Retrieve position information. Initial snapshot will be pushed once subscribed. Data will be pushed when triggered by events such as placing/canceling order.
Request Example
{
"op": "subscribe",
"args": [{
"instType": "UMCBL",
"channel": "positions",
"instId": "default"
}]
}
Request Parameter
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation ,subscribe unsubscribe |
args | Array | Yes | Subscribed channel List |
> channel | String | Yes | Channel Name,positions |
> instType | String | Yes | Instrument Type UMCBL :USDT Perpetual Contract; DMCBL :Coin Margin Perpetual Contract |
> instId | String | No | Symbol Name |
Response Parameter
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event ,subscribe unsubscribe errror |
arg | Object | No | Subscribed channel |
> channel | String | Yes | Channel Name |
> instType | String | Yes | Instrument Type |
> instId | String | No | Symbol Name |
code | String | No | Error Code |
msg | String | No | Error Message |
Push Data Parameter
Parameter | Type | Description |
---|---|---|
arg | Object | Subscribed channel |
> channel | String | Channel Name |
> instType | String | Instrument Type |
> instId | String | Instrument ID |
data | Array | Subscribed Data |
> posId | String | Position Id |
> instId | String | Symbol Name |
> instName | String | Symbol Name |
> marginCoin | String | Margin Coin |
> margin | String | Margin, can be added or reduced |
>marginMode | String | Margin mode, cross fixed |
> holdSide | String | Position sidelong short |
> holdMode | String | hold Mode single_hold , double_hold |
> total | String | Quantity of positions |
> available | String | Position that can be closed |
> locked | String | Frozen quantity |
>averageOpenPrice | String | Average open price |
> leverage | String | Leverage |
> achievedProfits | String | Realized profit and loss |
> upl | String | Unrealized profit and loss |
> uplRate | String | Unrealized profit and loss ratio |
> liqPx | String | Estimated liquidation price |
> keepMarginRate | String | Maintenance margin requirement Ratio |
> fixedMarginRate | String | Margin requirement Ratio fixed |
> marginRate | String | Risk rate. |
> cTime | String | Creation time, Unix timestamp format in milliseconds |
> uTime | String | Latest time position was adjusted, Unix timestamp format in milliseconds |
When multiple orders are being executed at the same time, the changes of position data will be aggregated into one as much as possible.
Order Channel
Retrieve order information. Data will not be pushed when first subscribed. Data will only be pushed when triggered by events such as placing/canceling/force liquidate order.
Request Example
{
"op": "subscribe",
"args": [{
"channel": "orders",
"instType": "UMCBL",
"instId": "default"
}]
}
Request Parameter
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation ,subscribe unsubscribe |
args | Array | Yes | Request Subscribed channel List |
> channel | String | Yes | Channel Name, orders |
> instType | String | Yes | Instrument Type UMCBL :USDT Perpetual Contract; DMCBL :Coin Margin Perpetual Contract |
> instId | String | No | Currently only supports default all trading pair orders |
Success Response Example
{
"event": "subscribe",
"arg": {
"channel": "orders",
"instType": "UMCBL",
"instId": "default"
}
}
Failure Response Example
{
"event": "error",
"code": 30003,
"msg": "instType:UMCBL,channel:orders,instId:BTC-USDT Symbol not exists"
}
Response Parameter
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event ,subscribe unsubscribe errror |
arg | Object | No | Subscribed channel |
> channel | String | Yes | Channel Name |
> instType | String | Yes | Instrument Type |
> instId | String | No | Instrument Id |
code | String | No | Error Code |
msg | String | No | Error Message |
Push Data Parameter
Parameter | Type | Description |
---|---|---|
action | String | Snapshot. |
arg | Object | Subscribed channel |
> channel | String | Channel Name |
> instType | String | Instrument Type |
> instId | String | Instrument Id |
data | Array | Subscribed Data |
> instId | String | Instrument Id |
> ordId | String | Order Id |
> clOrdId | String | Client-supplied order ID |
> px | String | Order price |
> sz | String | The original order quantity, in the unit of currency |
> hM | String | Hold Mode |
> eps | String | enterPointSource |
> tS | String | Trade Side |
> notionalUsd | String | Estimated national value in USD of order |
> ordType | String | Order Type market limit |
> force | String | Order Force normal : normal order post_only : Post-only orderfok : Fill-or-kill orderioc : Immediate-or-cancel order |
> side | String | Order side, buy sell |
> posSide | String | Position side long or short |
> tdMode | String | Trade mode, cross : cross fixed : fixed |
> tgtCcy | String | Margin Coin |
> fillPx | String | Last filled price |
> tradeId | String | Last trade ID |
> fillSz | String | Last filled quantity |
> fillTime | String | Last filled time |
> fillFee | String | last filled fee, negative |
> fillFeeCcy | String | last filled fee currency |
> execType | String | Order flow type, T: taker M: maker |
> accFillSz | String | Accumulated fill quantity |
> fillNotionalUsd | String | Filled notional value in USD of order |
> avgPx | String | Average filled price. If none is filled, it will return 0 |
> status | String | Order Status init new partial-fill full-fill cancelled |
> lever | String | Leverage |
> orderFee | Array | |
>> feeCcy | String | Fee currency |
>> fee | String | FeeNegative number represents the user transaction fee charged by the platform.Positive number represents rebate. |
> pnl | String | Profit and loss |
> uTime | String | Update time, Unix timestamp format in milliseconds |
> cTime | String | Creation time, Unix timestamp format in milliseconds |
> low | Boolean | Is reduce only |
Plan Order Channel
Retrieve order information. Data will not be pushed when first subscribed. Data will only be pushed when triggered by events such as created/cancelled/modified/triggered.
Request Example
{
"op": "subscribe",
"args": [{
"channel": "ordersAlgo",
"instType": "UMCBL",
"instId": "default"
}]
}
Request Parameter
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation ,subscribe unsubscribe |
args | Array | Yes | Subscribed channel List |
> channel | String | Yes | Channel Name,ordersAlgo |
> instType | String | Yes | Instrument Type UMCBL :USDT Perpetual Contract Private Channel; DMCBL :Coin Margin Perpetual Contract Private Channel |
> instId | String | No | Symbol Name |
Success
{
"event": "subscribe",
"arg": {
"channel": "ordersAlgo",
"instType": "UMCBL",
"instId": "default"
}
}
Fail
{
"event": "error",
"code": 30003,
"msg": "instType:UMCBL,channel:orders,instId:BTC-USDT Symbol not exists"
}
Response Parameter
Parameter | Type | Required | Description |
---|---|---|---|
event | String | Yes | Event,subscribe unsubscribe errror |
arg | Object | No | Subscribed channel |
> channel | String | Yes | Channel Name |
> instType | String | Yes | Instrument Type |
> instId | String | No | Instrument Id |
code | String | No | Error Code |
msg | String | No | Error Message |
Push Data
Parameter | Type | Description |
---|---|---|
action | String | 'snapshot' |
arg | Object | Subscribed channel |
> channel | String | Channel Name |
> instType | String | Instrument Type |
> instId | String | Instrument ID |
data | Array | Subscribed data |
> instId | String | instrument ID |
> id | String | order ID |
> cOid | String | Client-supplied order ID |
> triggerPx | String | trigger price |
> planType | String | Websocket planType, null means 'pl' |
> ordPx | String | actual price |
> sz | String | trigger size |
> actualSz | String | actual size |
> actualPx | String | Actual price |
> ordType | String | Order Type market limit |
> side | String | Order Side, buy sell |
> posSide | String | Position side; 'double_hold':long or short ; 'single_hold': net |
> tgtCcy | String | Margin Coin |
> state | String | Order status not_trigger triggered fail_trigger cancel |
> hM | String | Hold mode |
> eps | String | enterPointSource. |
> triggerTime | String | trigger time, ms |
> userId | String | userId |
> version | Long | version |
> triggerPxType | String | 'mark': mark price; 'last': fill price(market price) |
> key | String | key ID |
> tS | String | Trade Side |
> uTime | String | Update time, Unix timestamp format in milliseconds |
> cTime | String | Creation time, Unix timestamp format in milliseconds |
RestAPI error codes
Error message | Error code | http status code |
---|---|---|
The request header "ACCESS_KEY" cannot be empty | 40001 | 400 |
The request header "ACCESS_SIGN" cannot be empty | 40002 | 400 |
The request header "ACCESS_TIMESTAMP" cannot be empty | 40003 | 400 |
Invalid ACCESS_TIMESTAMP | 40005 | 400 |
Invalid ACCESS_KEY | 40006 | 400 |
Invalid Content_Type, please use the "application/json" format | 40007 | 400 |
Request timestamp expired | 40008 | 400 |
Api verification failed | 40009 | 400 |
Request too frequent | 429 | 429 |
The request header "ACCESS_PASSPHRASE" cannot be empty | 40011 | 400 |
apikey/passphrase is incorrect | 40012 | 400 |
User is frozen | 40013 | 400 |
Incorrect permissions | 40014 | 400 |
System error | 40015 | 400 |
The user must bind a mobile phone or Google | 40016 | 400 |
Parameter verification failed | 40017 | 400 |
Illegal ip request | 40018 | 400 |
Take profit price needs to be > current price | 43013 | 400 |
Take profit price needs to be > current price | 43014 | 400 |
Stop loss price needs to be < current price | 43015 | 400 |
Stop loss price needs to be << current price | 43016 | 400 |
Take profit and stop loss order does not exist | 43020 | 400 |
The take-profit and stop-loss order has been closed | 43021 | 400 |
Failed to trigger the default stop loss | 43022 | 429 |
Insufficient position, can not set take profit or stop loss | 43023 | 400 |
Take profit/stop loss in an existing order, please change it after canceling all | 43024 | 400 |
Limit order does not exist | 43025 | 400 |
The limit order has been closed | 43026 | 400 |
Existing positions + open orders bigger than 60. | 45116 | 400 |
Duplicate clientOid | 40757 | 400 |
Not enough position is available. | 40786 | 400 |
service return an error | 40725 | 400 |
Request timed out | 40010 | 400 |
Parameter verification exception {0} | 40808 | 400 |
The parameter {0} should not be null | 40811 | 400 |
The condition {0} is not met | 40812 | 400 |
Parameter {0} error | 40020 | 400 |
User disable withdraw | 40021 | 400 |
The business of this account has been restricted | 40022 | 400 |
The business of this account has been restricted | 40023 | 400 |
Parameter {0} cannot be empty | 40019 | 400 |
Insufficient balance | 43012 | 400 |
symbol is offline | 41113 | 400 |
The current trading pair is under maintenance, please refer to the official announcement for the opening time | 41114 | 400 |
param error {0} | 43111 | 400 |
The amount of coins withdrawn is less than the handling fee {0} | 43112 | 400 |
The order price is higher than the highest bid price | 40815 | 400 |
The order price is lower than the lowest selling price | 40816 | 400 |
less than the minimum order quantity | 45111 | 400 |
The price you enter should be a multiple of {0} | 45115 | 400 |
The purchase limit of this currency is {0}, and there is still {1} left | 43122 | 400 |
Unknown error | 45001 | 400 |
WebSocket error codes
Error Message | Error Code |
---|---|
Channel does not exist | 30001 |
Illegal request | 30002 |
Invalid op | 30003 |
User needs to log in | 30004 |
Login failed | 30005 |
request too many | 30006 |
request over limit,connection close | 30007 |
Invalid ACCESS_KEY | 30011 |
Invalid ACCESS_PASSPHRASE | 30012 |
Invalid ACCESS_TIMESTAMP | 30013 |
Request timestamp expired | 30014 |
Invalid signature | 30015 |