繁體中文

OpenEX logo

General API Information Edit

  • The following base endpoints are available:
    • http base Url:https://api-mk.openex.xyz/
    • wss base Url:wss://ws-mk.openex.xyz/
  • All endpoints return either a JSON object or array.
  • All time and timestamp related fields are in milliseconds.
  • If there is an error, the API will return an error with a message of the reason.
    • Specific error codes and messages are defined in Error Codes

Basic Information Edit

  • Request Header
  • Signature

Request Header Parameters

Parameter name Description
apiKey api request authentication mark token
businessType 1 : U Contract,
2 : Coin Standard
signature the secretKey and timestamp corresponding to the token are used as the key of HMAC SHA256 in the format of secretKey+timestamp, and all other parameters are used as the operation objects of HMAC SHA256, and the output obtained is the signature.

Signature Encryption

Encrypt the request parameters using HMAC SHA256 algorithm secretKey+timestamp as salt, and place the encrypted data in the signature attribute of the header

Time Window

Network conditions are not reliable and cannot be fully relied on, so add the recvWindow time window. When high-frequency transaction is performed, the requirements for timeliness are higher and the user sets the value of recvWindow according to needs so as to meet the requirements

{
 "apiKey": "f23f58c04ac5439d8406e2e9e3rcc26f",
 "businessType": 1,
 "signature": "a7c4a3e4224db9bc31da7bd1a0095cb8d1f07d2d1cf1460aa4f83e055892a07d"
}
 if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {     //Logic after passing   } else {     // Logic that doesn't pass   }

List of Transfer Accounts Edit

Single User Accounts List

  • URL:/spot/v1/account/list
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Description Type Required or not Constraints
coin Currency name String Yes For example:
"USDT"
recvWindow Timestamp sliding window, how many milliseconds before and after the timestamp request is valid integer No  
timestamp Calling time Long Yes  
{
    "code": 1,
    "data": [
        {
            "type": "usdt", // Business Type usdt:U-standard contract account,spot:spot account,withdraw:Coin charging and withdrawal account
            "coin": "USDT", // Currency
            "amount": "1330.3704832" // Transferable amount
        },
        {
            "type": "spot",
            "coin": "USDT",
            "amount": "998937.3452574978"
        },
        {
            "type": "withdraw",
            "coin": "USDT",
            "amount": "9515878.623"
        }
    ]
}
{
 "code": 9999,
 "message": "Exception!"
}

Account Transfers Edit

Transfer of funds between single user accounts

  • URL:/spot/v1/account/transfer
  • Method:POST
  • Authentication required:Yes

Request Parameters

Parameter name Description Type Required or not Constraints
type Transfer out account String Yes Currently supported types of transfers:

"usdt-to-withdraw" : From U-standard contract account to Coin charging and withdrawal account,

"withdraw-to-usdt" : From U-standard contract account to Coin charging and withdrawal account,

"spot-to-withdraw" : From spot account to Coin charging and withdrawal account,

"withdraw-to-spot" : From Coin charging and withdrawal account to spot account,

"usdt-to-spot" : From U-standard to spot account,

"spot-to-usdt" : From spot to U-standard account
coin Currency of account transfer String Yes Refer to the currency list interface.
amount Amount of account transfer Decimal Yes Numbers greater than 0
recvWindow Timestamp sliding window, how many milliseconds before and after the timestamp request is valid integer No  
timestamp Calling time Long Yes  
{
  "type":"withdraw-to-usdt",
  "coin":"USDT",
  "amount":120
}
{
    "code": 1,
    "message": "",
    "data": true
}
{
 "code": 9998,
 "message": "Parameter requested error: type"
}

Transfer Records Edit

Single-user Transfer Records

  • URL:/spot/v1/account/transfer/history
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Description Type Required or not Constraints
startTime Start timestamp Long No 1 : USDT contract,
3 : Spot goods,
4 : Coin charging and withdrawal
endTime End timestamp Long No 1 : USDT contract,
3 : Spot goods,
4 : Coin charging and withdrawal
coin Currency of account transfer String Yes  
fromId The id of the last data in the last list Long No The first page is null, and the other pages must have values
limit Number of entries per page Integer Yes Integers greater than 0 and less than or equal to 100
signature Yes String Yes  
timestamp Calling time Long Yes  
{
    "code": 1,
    "data": [
        {
            "id": 1709,
            "type": "withdraw-to-usdt",
            "coin": "USDT",
            "amount": "120",
            "status": 1, // 1:success 0:To be processed
            "reason": "", // Cause of failure
            "createTime": 1657179001000
        },
        {
            "id": 1686,
            "type": "withdraw-to-spot",
            "coin": "USDT",
            "amount": "1000",
            "status": 1,  
            "reason": "",  
            "createTime": 1657173979000
        }
    ]
}
{
 "code": 9999,
 "message": "Exception!"
}

Single Business Account Assets Edit

Single-user single business account assets

  • URL:/spot/v1/account/assets/detail
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Description Type Required or not Constraints
convertCoin Asset display currency String No Default 
"USDT"
type Account type String Yes "usdt":U-standard contract account,
"spot":spot account,
"withdraw":coin charging and withdrawal account
recvWindow Timestamp sliding window, how many milliseconds before and after the timestamp request is valid integer No  
timestamp Calling time integer Yes  
{
    "code": 1,
    "data": {
        "type": "usdt", // Business Type usdt:USDT contract,swaps:Coin standard contract,spot:spot
        "convertCoin": "BTC", // Presentation of currency
        "assetsAsXXX": "0.065127782241623264", // Total assets(Convert to display currency)
        "assetsAsUSDT": "1330.3704832", // Total assets(convert USDT)
        "detailAssetsList": [
            {
                "coin": "USDT", // currency
                "assets": "1330.3704832", // assets(unconverted)
                "holdAssets": "0", // Frozen assets(unconverted)
                "availableBalance": "1330.3704832", // Available balance of orders
                "maxWithdrawAmount": "1330.3704832", // Maximum withdrawable balance
                "convertCoin": "BTC",
                "assetsAsXXX": "0.065127782241623264", // assets(Convert to display currency)
                "assetsAsUSDT": "1330.3704832", // assets(convert USDT)
                "holdAssetsAsXXX": "0", // Frozen assets(Convert to display currency)
                "holdAssetsAsUSDT": "0" // Frozen assets(convert USDT)
            }
        ]
    }
}

Single Business Position Information Edit

Obtain single business position information

  • URL:/usdt/v1/trade/positions
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Description Type Required or not Constraints
symbol Transaction pair String No Example:
"BTC/USDT",USDT contract can be null
marginType Margin mode String Yes "CROSSED" : Full position,
"ISOLATED" : Position by position
positionMode Position mode String Yes "MERGE" : combined position,
"PART" : separate position
positionSide Position direction String No "LONG" : long,
"SHORT" : short
recvWindow Timestamp sliding window, how many milliseconds before and after the timestamp request is valid integer No  
timestamp Calling time integer Yes  
{
    "code": 1,
    "data": [
        {
            "id": 1229568718259461, // Position id
            "type": "usdt", // Business Type usdt: U Contract
            "symbol": "BTC/USDT", // Transaction pair
            "marginType": "CROSSED", // Margin model CROSSED:Full position ISOLATED:Position by position
            "positionSide": "LONG", // Position direction LONG - long, SHORT -short
            "positionAmt": "2", 
            "availablePositionAmt": "2",
            "entryPrice": "20402.15", // Average opening price
            "leverage": "73", // Position leverage
            "positionMargin": "1.117926027397260243", // Position margin
            "closeCommission": "0.02448258", // Closing commission
            "positionValue": "81.6086", // Position value
            "indexPrice": "20399.703", 
            "unrealizedProfit": "-0.009788", // Position unrealized profit or loss
            "positionMode": "PART" // MERGE-combined position PART-separate position
        },
        {
            "id": 1229568766608645,
            "type": "usdt",
            "symbol": "BTC/USDT",
            "marginType": "CROSSED",
            "positionSide": "SHORT",
            "positionAmt": "2",
            "availablePositionAmt": "2",
            "entryPrice": "20401.51",
            "leverage": "73",
            "positionMargin": "1.117890958904109558",
            "closeCommission": "0.024481812",
            "positionValue": "81.60604",
            "indexPrice": "20399.703",
            "unrealizedProfit": "0.007228",
            "positionMode": "PART"
        }
    ]
}

Order Placing Edit

  • URL:/usdt/v1/trade/order
  • Method:POST
  • Authentication required:Yes

Note:

  1. positionId can get from Single Business Position Information response parameter id.
  2. Current position mode can be modified by Change of Position Merge and Part Configuration.

Request Parameters

Parameter name Type Required or not Description
symbol String Yes Transaction pair
side Enum Yes "BUY" : Buying direction,
"SELL" : Selling direction
positionSide Enum Yes Position direction :
"LONG", "SHORT"
positionId Long No Position ID
(only when current position mode is part, then might need to pass in)

Below scenario positionId is required:
1. Add to original position
2. Closing a position
 i. Closing a long position
(positionSide is LONG,side is SELL)
 ii. Closing a short position
(positionSide is SHORT,side is BUY)
type Enum Yes Order Type : "LIMIT", "MARKET"
quantity BigDecimal Yes Number of orders placed
price BigDecimal No Commissioning Price
clientOrderId String No Currently support for market marker account only.
It must be a combination of case-sensitive alphanumerics, up to 32 characters
recvWindow Long No Timestamp sliding window in milliseconds
timestamp Long Yes Calling time
{
 "symbol": "BTC/USDT",
 "side": "BUY",
 "positionSide": "LONG",
 "positionId": "1229231381528580",
 "type": "LIMIT",
 "quantity": 10,
 "price": 100.01
 "recvWindow": 0,
 "timestamp": 0,
}
{
 "code": 1,
 "data": [
   {
     "orderId": 1229231381528581//Order id
   }
 ],
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Bulk Orders Edit

  • URL:/usdt/v1/trade/batchOrders
  • Method:POST
  • Authentication required:Yes

Request example

Parameter name Type Required or not Description
batchOrders List<OrderRequest> Yes Order list, supporting up to 5 orders
recvWindow Long No Timestamp sliding window in milliseconds
timestamp Long Yes Calling time

OrderRequest

Parameter name Type Required or not Description
symbol String Yes  
side Enum Yes "BUY" : Buying direction,
"SELL" : Selling direction
positionSide Enum Yes Position direction,
"LONG", "SHORT"
positionId Long No Position ID
(only when current position mode is part, then might need to pass in)

Below scenario positionId is required:
1. Add to original position
2. Closing a position
 i. Closing a long position
(positionSide is LONG,side is SELL)
 ii. Closing a short position
(positionSide is SHORT,side is BUY)
type Enum Yes Required when closing a position:
"LIMIT", "MARKET"
quantity BigDecimal Yes Number of orders placed
price BigDecimal No Commissioning Price
clientOrderId String No Currently support for market marker account only.
It must be a combination of case-sensitive alphanumerics, up to 32 characters
{
 "batchOrders": [{
   "symbol": "BTC/USDT",
   "positionSide": "LONG",
   "positionId": "1229231381528580",
   "type": "LIMIT",
   "quantity": 10,
   "price": 100.01
  }],
 "recvWindow": 5000,
 "timestamp": 1657162729000
}
{
 "code": 1,
 "data": [
   {
     "orderId": 1229231381528581,
     "clientOrderId": "newClientOrderId0001"
   },
   {
     "orderId": 1229231381528582,
     "clientOrderId": "newClientOrderId0002"
   }
 ],
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Cancellation of Orders Edit

  • URL:/usdt/v1/trade/order
  • Method:DELETE
  • Authentication required:Yes

Note:

  1. For the request, either orderId or clientOrderId was required. If both parameters was pass in, only orderId will be used.

Request Parameters

Parameter name Type Required or not Description
symbol String Yes Transaction pair
orderId Long Conditional Order number
clientOrderId String Conditional Currently support for market marker account only.
It must be a combination of case-sensitive alphanumerics, up to 32 characters
recvWindow Long No Timestamp sliding window in milliseconds
timestamp Long Yes Calling time
{
 "symbol": "BTC/USDT",
 "orderId": 1229231391899653,
 "recvWindow": 5000,
 "timestamp": 1657162729000
}
{
 "code": 1,
 "data": true,
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Bulk Cancellation of Orders Edit

  • URL:/usdt/v1/trade/batchOrders
  • Method:DELETE
  • Authentication required:Yes

Note:

  1. For the request, either orderIdList or clientOrderIdList was required. If both parameters was pass in, only orderIdList will be used.

Request Parameters

Parameter name Type Required or not Description
symbol String Yes Transaction pair
orderIdList List<Long> Conditional Collection of order numbers
clientOrderIdList List<String> Conditional Collection of client order id.
Currently support for market marker account only.
It must be a combination of case-sensitive alphanumerics, up to 32 characters
recvWindow Long No Timestamp sliding window in milliseconds
timestamp Long Yes Calling time
/usdt/v1/trade/batchOrders?symbol=BTC/USDT&orderIdList=1229231391899653,1229231391899654&recvWindow=5000&timestamp=1657162729000
{
 "code": 1,
 "data": true,
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Cancellation of All Orders Edit

  • URL:/usdt/v1/trade/allOpenOrders
  • Method:DELETE
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String YES Transaction pair
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "symbol": "BTC/USDT",
 "recvWindow": 5000,
 "timestamp": 1657162729000
}
{
 "code": 1,
 "data": true,
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Create Take-Profit and Stop-Loss Edit

  • URL:/usdt/v1/trade/planOrder
  • Method:POST
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String YES Transaction pair
side Enum YES "BUY" : Buying direction,
"SELL" : Selling direction
positionSide Enum YES Position direction,
"LONG", "SHORT"
type Enum YES Order type,
"TAKE_PROFIT" :
Take profit limit order,

"TAKE_PROFIT_MARKET" :
Take profit market order,

"STOP" : Stop loss limit order,

"STOP_MARKET" : stop loss market order
quantity BigDecimal YES Quantity of orders placed
workingType Enum YES Trigger type,
"INDEX_PRICE" : Index price
stopPrice BigDecimal YES Trigger price
price BigDecimal NO Exercise price
sourceType Enum YES Source:
"ORDER", "POSITION"
sourceId Long YES Source id
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
	"positionSide": "LONG",
	"price": 20000,
	"quantity": 1,
	"recvWindow": 5000,
	"side": "BUY",
	"sourceId": 1208218841498181,
	"sourceType": "POSITION",
	"stopPrice": 19500,
	"symbol": "ETH/USDT",
	"timestamp": 1656913877424,
	"type": "TAKE_PROFIT_MARKET",
	"workingType": "INDEX_PRICE"
}
{
  "code": 1,
  "data": {
    "orderId": 120821181
  },
  "message": "SUCCESS"
}
{
  "code": 9999,
  "message": "Exception!"
}

Cancellation of Take-Profit and Stop-Loss Edit

  • URL:/usdt/v1/trade/planOrder
  • Method:DELETE
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String YES Transaction pair
orderId Long YES Order number
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
  "code": 1,
  "data": {
   "symbol": "ETH/USDT",
   "orderId": 1208218841498181,
   "timestamp": 1656913877424,
   "recvWindow": 5000
  }
}
{
 "code": 1,
 "data": true
}
{
 "code": 9999,
 "message": "Exception!"
}

Bulk Cancellation of Take-Profit and Stop-Loss Edit

  • URL:/usdt/v1/trade/planOrders
  • Method:DELETE
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String YES Transaction pair
orderIds List<Long> YES Collection of order numbers
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
/usdt/v1/trade/planOrders?symbol=ETH/USDT&orderIds=1208218841498181,1208218841498182&recvWindow=5000&timestamp=1656913877424
{
 "code": 1,
 "data": true
}
{
 "code": 9999,
 "message": "Exception!"
}

Modification of User Leverage Configuration Edit

  • URL:/usdt/v1/trade/leverage
  • Method:POST
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String YES Transaction pair
leverage Integer YES Leverage, use when place order in U Contract
recvWindow Long NO Timestamp sliding window in millisecond
timestamp Long YES Calling time
{
 "symbol": "BTC/USDT",
 "leverage": 100,
 "recvWindow": 5000,
 "timestamp": 1657162729000
}
{
 "code": 1,
 "data": true,
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Change of Full-position and Position-by-position Configuration Edit

  • URL:/usdt/v1/trade/marginType
  • Method:POST
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String NO Transaction pair
marginType Enum YES Margin type
"CROSSED": Full position,
"ISOLATED": Position by position
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "symbol": "BTC/USDT",
 "marginType": "CROSSED",
 "recvWindow": 5000,
 "timestamp": 1657162729000
}
{
 "code": 1,
 "data": true,
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Change of Position Merge and Part Configuration Edit

  • URL:/usdt/v1/trade/positionMode
  • Method:POST
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
positionMode Integer YES "MERGE" : combined position,
"PART" : separate position
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "positionMode": "MERGE",
 "recvWindow": 5000,
 "timestamp": 1657180630329
}
{
 "code": 1,
 "data": true,
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Adjustment of Position-by-position Margin Edit

  • URL:/usdt/v1/trade/positionMargin
  • Method:POST
  • Authentication required:Yes

Note:

  1. If get an error code 9008, means current margin type configuration is not position-by-position. Adjust Change of Full-position and Position-by-position Configuration and request parameter marginType need to set as ISOLATED.

  2. If get an error code 9009, means current position mode configuration is part, request parameter positionId need to pass in. Or change to merge position mode, by adjust Change of Position Merge and Part Configuration and request parameter positionMode need to set as MERGE.

Request Parameters

Parameter name Type Required or not Description
symbol String YES Transaction pair
amount BigDecimal YES Margin funds, need to greater than 0
type Integer YES Adjustment direction
1 : Increase position-by-position margin,
2 : Decrease position-by-position margin.
positionId Long NO Position id, required for position PART.
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "symbol": "BTC/USDT",
 "amount": 100.55,
 "type": 1,
 "positionId": 1229231408676869,
 "recvWindow": 0500,
 "timestamp": 1657180630329
}
{
 "code": 1,
 "data": true,
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Transaction History Edit

  • URL:/usdt/v1/trade/userTrades
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String YES Transaction pair
fromId Long NO Return the fromId and subsequent transactions. The default is to return the most recent transaction.
limit Integer NO The number of result sets returned,
default : 200,
maximum : 1000
startTime Long YES Start time
endTime Long YES End time
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "symbol": "ETH/USDT",
 "fromId": 1208218841498181,
 "limit": 200,
 "startTime": 1654840101939,
 "endTime": 1655099837239,
 "timestamp": 1655099837259,
 "recvWindow": 5000
}
{
 "code": 1,
 "data": [{
   "id": 1229231370945733, //Transaction idid
   "orderId": 1229231370027013, //Order number
   "symbol": "ETH/USDT", //Transaction pair
   "price": "1133.97", //Transaction price
   "qty": "1", //Trading volume
   "realizedPnl": "1.280800714285714285", //Realize profit and loss
   "commission": "0.01700955", 
   "commissionAsset": "USDT", //Commission unit
   "side": "SELL", //Buying and selling direction
   "positionSide": "LONG", //Position direction
   "time": 1657162731000 
  }],
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Inquiry for Commissioned Orders Edit

  • URL:/usdt/v1/trade/openOrder
  • Method:GET
  • Authentication required:Yes

Note:

  1. For the request, either orderId or clientOrderId was required. If both parameters was pass in, only orderId will be used.

Request Parameters

Parameter name Type Required or not Description
symbol String Yes Transaction pair
orderId Long Conditional Order number
clientOrderId String Conditional Currently support for market marker account only.
It must be a combination of case-sensitive alphanumerics, up to 32 characters
recvWindow Long No Timestamp sliding window in milliseconds
timestamp Long Yes Calling time
{
 "symbol": "ETH/USDT",
 "orderId": 1208218841498181,
 "timestamp": 1655099837259,
 "recvWindow": 5000
}
{
 "code": 1,
 "data": {
   "orderId": 1229231334670341,
   "symbol": "ETH/USDT",//Transaction pair
   "type": "LIMIT",//Order Type:LIMIT,MARKET
   "price": "1089.58",//The price or market price entered by the user
   "avgPrice": "0",//Average transaction price
   "side": "BUY",//Buying and selling direction:BUY,SELL
    "positionSide": "LONG",//Position direction:LONG,SHORT
   "origQty": "1",//Original order quantity
   "executedQty": "0",//Transaction quantity
   "status": "NEW",//Order status,NEW:order,PARTIALLY_FILLED:Partial transaction,FILLED:Close the deal,CANCELED:revoked
   "createTime": 1657162729000,
   "updateTime": 1657162729000
  }
}
{
 "code": 9999,
 "message": "Exception!"
}

Inquiry for all commissioned orders Edit

  • URL:/usdt/v1/trade/openOrders
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String NO Transaction pair
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "symbol": "ETH/USDT",
 "timestamp": 1655099837259,
 "recvWindow": 5000
}
{
 "code": 1,
 "data": [{
   "orderId": 1229231334670341,
   "symbol": "ETH/USDT",//Transaction pair
   "type": "LIMIT",//Order Type:LIMIT,MARKET
   "price": "1089.58",//The price or market price entered by the user
   "avgPrice": "0",//Average transaction price
   "side": "BUY",//Buying and selling direction:BUY,SELL
    "positionSide": "LONG",//Position direction:LONG,SHORT
   "origQty": "1",//Original order quantity
   "executedQty": "0",//Transaction quantity
   "status": "NEW",//Order status,NEW:order,PARTIALLY_FILLED:Partial transaction,FILLED:Close the deal,CANCELED:revoked
   "createTime": 1657162729000,
   "updateTime": 1657162729000
  }]
}
{
 "code": 9999,
 "message": "Exception!"
}

Inquiry for Take-profit and Stop-loss Edit

  • URL:/usdt/v1/trade/planOrder
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String YES Transaction pair
orderId Long YES Order number
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "symbol": "ETH/USDT",
 "orderId": 1208218841498181,
 "timestamp": 1656913877424,
 "recvWindow": 5000
}
{
 "code": 1,
 "data": {
   "id": 1220933363843653,
   "userId": 1119209245245445,
   "tenantId": 0,
   "symbol": "BTC/USDT",//Transaction pair
   "businessType": 1,//Business Type,1:U Contract
   "marginMode": 1,//Margin mode,1:Full position,,2:Position by position
   "userType": 1,//User type型 1:Work account,2:General account
   "sourceId": 1225311700583109,
   "sourceType": 1,//source,1:Order,2:position
   "type": "TAKE_PROFIT",//TAKE_PROFIT:Take profit limit order,TAKE_PROFIT_MARKET:Take profit market order,STOP:Stop loss limit order,STOP_MARKET:stop loss market order
   "side": "BUY",//Buying and selling direction
   "positionSide": "LONG",//Position direction:LONG,SHORT
   "workingType": 2,
   "stopPrice": 19500.2,//Trigger price
   "positionMode": 1,//Position pattern,1: combined position,2:separate position
   "indexPrice": 19600.3,//Index price at trigger
   "orderIndexPrice": 19400.3,//Index price at time of order
   "quantity": 10,//Order quantity
   "status": 3,//status,1:Not in effect,2:Have come into effect,3:triggered,4:cancel,5:Warehouse bursting Cancel an order,6:closing a position Cancel an order,7:preset Take-Profit and Stop-Loss failure Cancel an order
   "createTime": "2022-07-04 16:31:34",
   "updateTime": "2022-07-04 16:50:21"
   "triggeredDate": "2022-07-04 16:50:21"//Trigger time
  },
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Bulk Inquiry for Take-profit and Stop-loss Edit

  • URL:/usdt/v1/trade/planOrders
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
symbol String NO Transaction pair
fromId Long NO Return the fromId and subsequent transactions. The default is to return the most recent transaction.
limit Integer NO The number of result sets returned,
default : 200,
maximum : 1000
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "symbol": "ETH/USDT",
 "fromId": 1208218841498181,
 "limit": 200,
 "timestamp": 1656913877424,
 "recvWindow": 5000
}
{
 "code": 1,
 "data": [{
   "id": 1220933363843653,
   "userId": 1119209245245445,
   "tenantId": 0,
   "symbol": "BTC/USDT",//Transaction pair
   "businessType": 1,//Business Type,1:U Contract
   "marginMode": 1,//Margin mode,1:Full position,,2:Position by position
   "userType": 1,//User type型 1:Work account,2:General account
   "sourceId": 1225311700583109,
   "sourceType": 1,//source,1:Order,2:position
   "type": "TAKE_PROFIT",//TAKE_PROFIT:Take profit limit order,TAKE_PROFIT_MARKET:Take profit market order,STOP:Stop loss limit order,STOP_MARKET:stop loss market order
   "side": "BUY",//Buying and selling direction
   "positionSide": "LONG",//Position direction:LONG,SHORT
   "workingType": 2,
   "stopPrice": 19500.2,//Trigger price
   "positionMode": 1,//Position pattern,1: combined position,2:separate position
   "indexPrice": 19600.3,//Index price at trigger
   "orderIndexPrice": 19400.3,//Index price at time of order
   "quantity": 10,//Order quantity
   "status": 3,//status,1:Not in effect,2:Have come into effect,3:triggered,4:cancel,5:Warehouse bursting Cancel an order,6:closing a position Cancel an order,7:preset Take-Profit and Stop-Loss failure Cancel an order
   "createTime": "2022-07-04 16:31:34",
   "updateTime": "2022-07-04 16:50:21",
   "triggeredDate": "2022-07-04 16:50:21"//Trigger time
  }],
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Historical Take-profit and Stop-loss Edit

  • URL:/usdt/v1/trade/planOrdersHistory
  • Method:GET
  • Authentication required:Yes

Request example

Parameter name Type Required or not Description
symbol String NO Transaction pair
fromId Long NO Return the fromId and subsequent transactions. The default is to return the most recent transaction.
limit Integer NO The number of result sets returned,
default : 200,
maximum : 1000
recvWindow Long NO Timestamp sliding window in milliseconds
timestamp Long YES Calling time
{
 "symbol": "ETH/USDT",
 "fromId": 1208218841498181,
 "limit": 200,
 "timestamp": 1656913877424,
 "recvWindow": 5000
}
{
 "code": 1,
 "data": [{
   "id": 1220933363843653,//Order id
   "userId": 1119209245245445,//
   "tenantId": 0,
   "symbol": "BTC/USDT",//Transaction pair
   "businessType": 1,//Business Type,1:U Contract
   "marginMode": 1,//Margin mode,1:Full position,2:Position by position
   "userType": 1,//User type 1:Work account,2:General account
   "sourceId": 1225311700583109,
   "sourceType": 1,//source,1:Order,2:position
   "type": "TAKE_PROFIT",//TAKE_PROFIT:Take profit limit order,TAKE_PROFIT_MARKET:Take profit market order,STOP:Stop loss limit order,STOP_MARKET:stop loss market order
   "side": "BUY",//Buying and selling direction
   "positionSide": "LONG",//Position direction:LONG,SHORT
   "workingType": 2,
   "stopPrice": 19500.2,//Trigger price
   "positionMode": 1,//Position pattern,1: combined position,2:separate position
   "indexPrice": 19600.3,//Index price at trigger
   "orderIndexPrice": 19400.3,//Index price at time of order
   "quantity": 10,//Order quantity
   "status": 3,//status,1:Not in effect,2:Have come into effect,3:triggered,4:cancel,5:Warehouse bursting Cancel an order,6:closing a position Cancel an order,7:preset Take-Profit and Stop-Loss failure Cancel an order
   "createTime": "2022-07-04 16:31:34",
   "updateTime": "2022-07-04 16:50:21"
  }],
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Currency list Edit

  • URL:/spot/v1/coins
  • Method:GET
  • Authentication required:No

Request Parameters

None

{
 "code": 1,
 "data": [{
   "coin": ETH,//Currency
   "isDeposit": 1,//Whether to charge coins,1 Yes,0 No
   "isWithdraw": 1,//Whether to support coin withdrawal,1 Yes,0 No
   "status": 0//status,1:effective ,0 void
  }],
 "message": ""
}
{
 "code": 9999,
 "message": "Exception!"
}

Transaction Pairs List Edit

  • URL:/usdt/v1/trade/symbols
  • Method:GET
  • Authentication required:No

Request Parameters

None

{
 "code": 1,
 "data": [{
   "symbol": "BTC/USDT",//Transaction pair
   "coin": "BTC",//Measuring currency
   "quoteCoin": "USDT",//Denomination currency
   "coinScale": 2,//Measure coins in decimal places
   "quoteCoinScale": 2,//Denomination decimal place
   "status": 1//status:1:enable,0:deactivate
  }]
}
{
 "code": 9999,
 "message": "exception!"
}

System Time Edit

  • URL:spot/v1/time
  • Method:GET
  • Authentication required:No

Request Parameters

None

{
 "code": 1,
 "data": {
    "serverTime": 1657173423730//System Time
  }
}
{
 "code": 9999,
 "message": "Exception!"
}

Index Price Edit

  • URL:/usdt/v1/market/index?symbol=ETH/USDT
  • Method:GET

Request Parameters

Parameter Parameter Required or not Description
symbol String true Coin pair
{
  "code": 1,
  "data": {
   "orderId": 120821181
  }
}
{
  "code": 0,
  "data": null,
  "message": "FAILURE"
}

Index Price (lot size) Edit

  • URL:/usdt/v1/market/index/list
  • Method:POST

Request Parameters

Parameter Type Required or not Description
symbolArray String[] true Coin pair
{
	"symbolArray": ["BTC/USDT","EOS/USDT"]
}
{
  "code": 1,
  "data": [
    {
      "symbol": "BTC/USDT",
      "indexPrice": "40781.23"
    },
    {
      "symbol": "EOS/USDT",
      "indexPrice": "2.445"
    }
  ],
  "message": "SUCCESS"
}
{
  "code": 0,
  "data": null,
  "message": "FAILURE"
}

Depth Edit

  • URL:/usdt/v1/market/depth?symbol=EOS/USDT
  • Method:GET

Request Parameters

Parameter Type Required or not Description
symbol String true Coin pair
{
  "code": 1,
  "data": {
    "symbol": "EOS/USDT",//Coin pair
    "bids": [ //
      [
        "1.999",//Price
        "9592"//Quantity
      ]
    ],
    "asks": [
      [
        "2.6",
        "1"
      ],
      [
        "2.55",
        "4840"
      ]
      
    ]
  },
  "message": "SUCCESS"
}
{
  "code": 0,
  "data": null,
  "message": "FAILURE"
}

Real-time Transactions Edit

  • URL:/usdt/v1/market/realTime?symbol=EOS/USDT
  • Method:GET

Request Parameters

Parameter Type Required or not Description
symbol String true Coin pair
{
  "code": 1,
  "data": [
    {
      "size": "1",
      "price": "1.999",
      "side": 2,//direction 1:buy 2:sell
      "time": 1650274754613,
      "symbol": "EOS/USDT"
    },
    {
      "size": 1,
      "price": 2.55,
      "side": 1,
      "time": 1650274751574,
      "symbol": "EOS/USDT"
    },
    {
      "size": 1,
      "price": 2.55,
      "side": 1,
      "time": 1650274719644,
      "symbol": "EOS/USDT"
    }
  ],
  "message": "SUCCESS"
}
{
  "code": 0,
  "data": null,
  "message": "FAILURE"
}

K Line Edit

  • URL:/usdt/v1/market/kline
  • Method:GET

Request Parameters

Parameter Type Required or not Description
symbol String true Coin pair
type Integer true Cycle Type :
0 : 1 min, 2 : 5 min, 3 : 15 min,
4 : 30 min, 5 : 1 hour, 7 : 4 hour,
10 : 1 day, 11 : 1 week, 12 : 1 month,
13 : 1 year
since Long true k-line start timestamp accurate to the minute(1650016682000)
end Long true k-line end timestamp accurate to the minute
{
  "code": 1,
  "data": [
    {
      "open": "40373.2",
      "high": "40391.82",
      "low": "40372.84",/
      "close": "40391.72",
      "volume": "0.0522",//Transaction number
      "amount": "2107.840752",//turnover
      "type": 0,//Cycle Type
      "time": 1650096180000,
      "symbol": "BTC/USDT"
    }
  ]
  "message": "SUCCESS"
}
{
  "code": 0,
  "data": null,
  "message": "FAILURE"
}

24-hour Market Conditions Edit

  • URL:/usdt/v1/market/ticker?symbol=BTC/USDT
  • Method:GET

Request Parameters

Parameter Type Required or not Description
symbol String true Coin pair
{
  "code": 1,
  "data": {
    "time": "1650278049804",
    "last": "39056.18",//price
    "change": "-3.43",//ups and downs
    "symbol": "BTC/USDT",
    "open": "40421.94",
    "high": "40593.22",//24-hour maximum price
    "low": "38538.02",//24-hour minimum price
    "volume": "182.40568",//Trading volume
    "amount": "7223419.4784845"
  },
  "message": "SUCCESS"
}
{
  "code": 0,
  "data": null,
  "message": "FAILURE"
}

24-hour Market Conditions (lot size) Edit

  • URL:/usdt/v1/market/ticker/list
  • Method:POST

Request Parameters

Parameter Type Required or not Description
symbolArray String[] true Coin pair
{
	"symbolArray": ["BTC/USDT","EOS/USDT"]
}
{
  "code": 1,
  "data": [
    {
      "time": "1650269906549",//time
      "last": "38989",//price
      "change": "-3.56",//the Up-Down
      "symbol": "BTC/USDT"//Coin pair
    },
    {
      "time": "1650274754627",
      "last": "1.999",
      "change": "-21.61",
      "symbol": "EOS/USDT"
    }
  ],
  "message": "SUCCESS"
}
{
  "code": 0,
  "data": null,
  "message": "FAILURE"
}

Latest Price Edit

  • URL:/usdt/v1/market/ticker/last?symbol=EOS/USDT
  • Method:GET

Request Parameters

Parameter Type Required or not Description
symbol String true Coin pair
{
  "code": 1,
  "data": {
    "time": "1650274754627",
    "last": "1.999",//price
    "symbol": "EOS/USDT"
  },
  "message": "SUCCESS"
}
{
  "code": 0,
  "data": null,
  "message": "FAILURE"
}

Basic Information Edit

  • The connections are as follows:
    • Base Url:wss://ws-mk.openex.xyz
    • The URL format is /usdt
  • Heartbeat rules:
    • Number of heartbeats/30s
    • User end sending:{"event":"ping"}
    • Service end receipt:{"event":"pong"}

      public code (the type field is the subscription type)  
      Subscribe successfully {"code":1,"desc":"success","type":"MARKET"}
      Event type does not exist {"code":10001,"desc":"Non-existent event types","type":"MARKET"}
      Request json format error {"code":10000,"desc":"json format error","type":"MARKET"}

Index Edit

{
	"event": "SUB",
	"type": "INDEX_PRICE",
	"symbol": "BTC/USDT"
}
{
	"event": "UNSUB",
	"type": "INDEX_PRICE",
	"symbol": "BTC/USDT"
}
{
  "symbol": "BTC/USDT",
  "type": "INDEX_PRICE",
  "data": "40658.981000000",
  "ts": 1650352557873
}
{
	"code": 1,
	"desc": "success",
	"topic": {
		"event": "SUB",
		"type": "INDEX_PRICE_ALL",
		"symbols": "BTC/USDT,ETH/USDT"
	}
}

Index (lot size) Edit

{
	"event": "SUB",
	"type": "INDEX_PRICE_ALL",
	"symbols": "BTC/USDT,ETH/USDT"
}
{
	"event": "UNSUB",
	"type": "INDEX_PRICE_ALL"
}
{
	"type": "INDEX_PRICE_ALL",
	"data": [{
		"symbol": "BTC/USDT",
		"price": "20547.103000000"
	}, {
		"symbol": "ETH/USDT",
		"price": "1095.646000000"
	}],
	"ts": 1655971790464
}
{
	"code": 1,
	"desc": "success",
	"topic": {
		"event": "SUB",
		"type": "INDEX_PRICE_ALL",
		"symbols": "BTC/USDT,ETH/USDT"
	}
}

Depth Edit

{
	"event": "SUB",
	"type": "DEPTH",
	"symbol": "BTC/USDT"
}
{
	"event": "UNSUB",
	"type": "DEPTH",
	"symbol": "BTC/USDT"
}
{
	"symbol": "BTC/USDT",
	"type": "DEPTH",
	"data": {
		"asks": [//asks (Ascending order)sell subscript 0 price,1 quantity
			["40592", "1.33301"],
			["40593", "1.02589"],
			["40594", "0.17704"],
			["40595", "0.1593"],
			["40596", "1.15614"]
		],
		"bids": [//bids (Descending order)buy
			["40497", "0.62148"],
			["40498", "0.47407"],
			["40499", "1.05067"],
			["40500", "0.26455"],
			["40501", "0.78471"],
			["40502", "0.44409"],
		]
	},
	"ts": 1650352632920
}
{
	"code": 1,
	"desc": "success",
	"topic": {
		"event": "SUB",
		"type": "DEPTH",
		"symbol": "BTC/USDT"
	}
}

24-hour market conditions Edit

{
	"event": "SUB",
	"type": "TICKER",
	"symbol": "BTC/USDT"
}
{
	"event": "UNSUB",
	"type": "MARKET",
	"symbol": "BTC/USDT"
}
{
	"symbol": "BTC/USDT",
	"type": "TICKER",
	"data": {
		"amount": "12041429.0669052",//Trading volume
		"change": "3.62",//ups and downs
		"high": "41258.86",//
		"last": "40680.6",//Latest price
		"low": "38538.02",
		"open": "38821.7",//Opening price
		"time": "1650347625464",
		"volume": "301.7915"//Trading volume
	},
	"ts": 1650347625841
}
{
	"code": 1,
	"desc": "success",
	"topic": {
		"event": "SUB",
		"type": "TICKER",
		"symbol": "BTC/USDT"
	}
}

K line Edit

periods:k-line type

"1min":0

"5min": 2

"15min":3

"30min":4

"1hour":5

"4hour":7

"1day":10

"1week":11

"1month":12

"1year":13

Multiple k-line types separated by commas

{
	"event": "SUB",
	"type": "KLINE",
	"symbol": "BTC/USDT",
	"params": {
		"periods": "0,2"
	}
}

{
	"event": "UNSUB",
	"type": "KLINE",
	"symbol": "BTC/USDT"
}
{
	"symbol": "BTC/USDT",
	"type": "KLINE",
	"data": [{
		"open": "40716.4",
		"high": "40716.6",
		"low": "40702.8",
		"close": "40702.8",
		"volume": "0.00735",
		"amount": "299.24742",
		"type": 0,
		"time": 1650352200000
	}],
	"ts": 1650352218714
}
{
	"code": 1,
	"desc": "success",
	"topic": {
		"event": "SUB",
		"type": "KLINE",
		"params": {
			"periods": "0,2"
		},
		"symbol": "BTC/USDT"
	}
}

Real-time transactions Edit

{
	"event": "SUB",
	"type": "TRADE",
	"symbol": "BTC/USDT"
}
{
	"event": "UNSUB",
	"type": "TRADE",
	"symbol": "BTC/USDT"
}
{
	"symbol": "BTC/USDT",
	"type": "TRADE",
	"data": [{
		"size": "0.0003",//quantity
		"price": "40711.4",
		"side": 1,//Buying and selling direction 1:buy 2:sell
		"time": 1650352384250
	}],
	"ts": 1650352384312
}
{
	"code": 1,
	"desc": "success",
	"topic": {
		"event": "SUB",
		"type": "TRADE",
		"symbol": "BTC/USDT"
	}
}

Recharge address inquiry Edit

  • URL:/spot/v1/capital/deposit/address
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
coin String YES Currency
chain String NO Chain name
signature String YES Signature
timestamp Long YES Calling time
{
    "coin": "USDT",
    "timestamp": 1656913877424,
    "recvWindow": 5000
}
{
    "code": 1,
    "data": [
        {
            "coin": "USDT",
            "chain": "BEP20",
            "address": "0x01feea3cbb1c12ff0357751b134e574x8d1b4x85",
            "addressTag": ""
        },
        {
            "coin": "USDT",
            "chain": "TRC20",
            "address": "T9yT4UUY3m2s182XwRwVYHckrR5Acxs6Fb",
            "addressTag": ""
        }
    ]
}
{
    "code": 9202,
    "message": "currency can not be empty"
}

Recharge Record Edit

  • URL:/spot/v1/capital/deposit/history
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
coin String YES Currency
startTime Long NO Start time
endTime Long NO End time
fromId Long NO Query start ID
limit Integer NO Query record size
signature String YES Signature
timestamp Long YES Calling time
{
    "coin": "USDT",
    "timestamp": 1656913877424,
    "recvWindow": 5000
}
{
    "code": 1,
    "data": [
        {
            "id": 1100828149039493,
            "coin": "USDT",
            "amount": "100",
            "address": "18600531753",
            "addressTag": "",
            "txId": "1100828109930501",
            "createTime": 1657188020000
        }
    ]
}
{
    "code": 9202,
    "message": "The currency cannot be empty"
}

Coin Withdrawal Record Edit

  • URL:/v1/capital/withdraw/history
  • Method:GET
  • Authentication required:Yes

Request Parameters

Parameter name Type Required or not Description
coin String YES Currency
startTime Long NO Start time
endTime Long NO End time
fromId Long NO Query start ID
limit Integer NO Query record size
signature String YES Signature
timestamp Long YES Calling time

Coin Withdrawal Status

  • 0 : Under audit
  • 1 : Audit completed
  • 2 : Successful coin withdrawal
  • 3 : Audit Failure
  • 4 : Coin withdrawal failure
  • 5 : Coin withdrawal cancellation
  • 6 : On-chain processing in progress
  • 7 : On-chain processing completed
  • 8 : On-chain processing failure
{
    "coin": "USDT",
    "timestamp": 1656913877424,
    "recvWindow": 5000
}
{
    "code": 1,
    "data": [
        {
            "id": 1189938193498373,
            "coin": "USDT",
            "amount": "10",
            "address": "TA778a8koXvHPHmhM1rjwUd1rECFdT3LXX",
            "addressTag": "",
            "txId": "1234556",
            "createTime": 1654764465575,
            "status": 2
        },
        {
            "id": 1189935202320645,
            "coin": "USDT",
            "amount": "6",
            "address": "TA778a8koXvHPHmhM1rjwUd1rECFdT3LXX",
            "addressTag": "",
            "createTime": 1654764283009,
            "status": 4
        },
        {
            "id": 1189931341644037,
            "coin": "USDT",
            "amount": "5",
            "address": "TA778a8koXvHPHmhM1rjwUd1rECFdT3LXX",
            "addressTag": "",
            "createTime": 1654764047370,
            "status": 5
        }
    ]
}
{
    "code": 9201,
    "message": "时间间隔不能超过90天" // The interval cannot exceed 90 days
}

Error Codes Edit

error code message
287 RPC error
9001 Invalid business type
9002 Invalid symbol
9003 Invalid side
9004 Invalid positionSide
9005 Invalid orderType
9006 Invalid price
9007 Invalid quantity
9201 The interval cannot exceed 90 days
9202 The currency cannot be empty
9984 Request timestamp validation failed
9985 Invalid apiKey
9986 Operating frequency
9987 The end time cannot be later than the start time
9988 Sign verification failed
9990 The source IP address is not in the trust list
9998 Parameter requested error: type
9999 Exception
10001 Event type does not exist
10000 Request json format error 
100024 Invalid token, please log in again