HTTP

The authorization process is as follows

  1. The input parameter string of the http message is as follows:
    market=BTCUSD&type=buy&price=680&amount=1.0&timestamp=1550743431000

  2. Paste the secret_key to the end of the above string as:
    market=BTCUSD&type=buy&price=680&amount=1.0&timestamp=1550743431000&secret_key=B51068CF10B34E7789C374AB932696A05E0A629BE7BFC62F
    Note: secret_key parameter is not required to send the http message body, this step is just for calculating the sha256 signature.

  3. Perform sha256 on the above string, convert it to hexadecimal lowercase, and the length is 64 bits, and then add this signature to the http header as follows:
    Authorization: a174066d9ccbeb33803c2a84e20792d31bed5a6e3da8fca23e38fc8dbb917a13

  4. Add AccessId in the http header, and the server will look for the corresponding user information according to AccessId: 4DA36FFC61334695A66F8D29020EB589

  5. After receiving the http message, the server finds the user’s secret key according to the AccessId, and performs the same operation as above to determine whether the received signature is equal to the signature calculated by itself. If they are equal, the authorization succeeds, otherwise it fails.

  6. Click to view Demo for signature generation

When the server receives the request, it will determine the timestamp in the request.If it is sent before 5000 milliseconds, the request will be considered invalid.The time window value can be customized by sending the optional parameter recvWindow.

Name Type Required Description
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • GET Request

GET request example

http://api.coinex.com/perpetual/v1/market/depth?market=BTCUSD&merge=1
  • POST Request

POST request example

http://api.coinex.com/perpetual/v1/order/put_limit

Request parameters are put in the http body in the form of application/x-www-form-urlencoded
  • RESPONSE

RESPONSE example

// success
{
    "message": "OK",
    "data": {
      .... },
    "code": 0
}

// error
{
    "message": "error message",
    "data": {},
    "code": 11
}
  • Error code description
Error Code Error message Description
3001 invalid argument Invalid argument
3002 service unavailable Service unavailable
3003 service timeout Service timeout
3004 method not found Method not found
3005 require auth Require auth
3006 internal error Internal error
3007 Service is not available during funding fee settlement. Please try again later. Service is not available during funding fee settlement
3008 service too busy Service timeout
3101 market not exists Market does not exist
3102 user id not exists The user does not exist
3103 order not exists Order does not exist
3104 stop price equal to deal price The price of stop-loss, take-profit or stop order is equal to the transaction price
3105 position not exists The position does not exist
3106 asset not exists Asset does not exist
3107 balance update repeated Balance update repeated
3108 amount exceed limit The position amount exceeds the upper limit
3109 balance not enough Balance insufficient
3110 trader not enough Counterparties insufficient
3111 exceed max limit limit value exceeds the maximum limit
3112 user not match Users do not match
3113 invalid leverage value Invalid leverage value
3115 position liquidating The position is being liquidated
3116 can not complete deal, kill order Failed to fill the transaction, terminate the order
3117 position will liquidation This operation will lead to forced liquidation
3118 limit price lower than liquidation price Limit price lower than forced liquidation price
3119 limit price higher than liquidation price Limit price higher than forced liquidation price
3120 no position The position does not exist
3121 cross position The margin cannot be changed in cross margin mode
3122 order exist Order already exists
3123 margin less init margin The margin cannot be less than the initial margin
3124 sub too much margin Too much margin withdrawn
3125 stop price equal to index price The stop-loss, take-profit or stop-order price is equal to the index price
3126 stop price equal to sign price The price of stop-loss, take-profit or stop order is equal to the mark price
3127 amount too small Amount too small
3128 invalid price size Invalid price size
3129 not only maker, kill order Maker only unavailable, terminate the order
3130 trading is unavailable in this market Trading service is currently prohibited in this market
3131 Stop order amount limit exceeded 100 orders at most for one market The number of stop orders in a single market cannot exceed 100
3132 position is closing The user’s other closing strategies are being implemented, e.g. closing all positions and TP/SL settings
3133 Stop-Loss price cannot be lower than the forced liquidation price Stop-Loss price for long positions cannot be lower than the forced liquidation price
3134 Stop-Loss price cannot be higher than the current price Stop-Loss price for short positions cannot be higher than the current price
3135 Take-Profit price cannot be lower than the current price Take-Profit price for long positions cannot be lower than the current price
3136 invalid close amount Invalid closing amount
3137 Take-Profit price cannot be higher than the current price Take-Profit price for short positions cannot be higher than the current price
3138 Stop-Loss price cannot be higher than the forced liquidation price Stop-Loss price for short positions cannot be higher than forced liquidation price
3139 Stop-Loss price cannot be lower than the current price Stop-Loss price for long positions cannot be lower than the current price
4001 service unavailable Service unavailable
4002 service timeout Service timed out
4003 internal error Internal error
4004 invalid argument Invalid parameter.
4005 access_id not exists Access ID does not exist
4006 authorization fail Authorization failed
4007 ip not allow visit IP access prohibited
4008 need authorization header HTTP header requires authorization info
4009 unknown method Invalid method
4010 time check error Time check error
4011 user is forbidden User prohibited
4012 The deviation between your estimated execution price and the index price is greater than 10%, you can reduce your delegation amount appropriately and try again. The deviation between your estimated execution price and the target price is greater than 10%, please adjust the price appropriately and try again
4013 The deviation between your delegated price and the index price is greater than x%, you can appropriately adjust your delegation price and try again The deviation between your order price and the index price is greater than x%, please adjust your order price appropriately and try again.
Note: 5% for BTCUSD, BTCUSDT, ETHUSD, ETHUSDT markets, while 10% for other contract markets
4014 The deviation between your delegated price and the trigger price is greater than x%, you can appropriately adjust your delegated price and try again The deviation between your order price and the stop price is greater than x%, please adjust your order price appropriately and try again.
Note: 5% for BTCUSD, BTCUSDT, ETHUSD, ETHUSDT markets, and 10% for other contract markets
4015 The current market depth is low, please reduce your selling amount appropriately and try again. The current market depth is insufficient, please reduce the selling volume appropriately and try again
4016 read only Read only

Example

// Request
timestamp=1513746038205

// Response
{
    "code": 0,
    "data": "pong",
    "message": "OK"
}
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/ping
  • Request parameter description: none
  • Return parameter description:
Name Type Description
data String “pong”

Example

// Request
timestamp=1513746038205

// Response
{
    "code": 0,
    "data": 1513746038205,
    "message": "OK"
}
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/time
  • Request parameter description: none
  • Return parameter description:
Name Type Description
data Integer Server time, milliseconds

Example

// Request
timestamp=1513746038205

// Response
"data": [
  {
    "name": "BTCUSD",
    "type": 2,
    "stock": "BTC",
    "money": "USD",
    "fee_prec": 4,
    "stock_prec": 8,
    "money_prec": 8,
    "multiplier": 1,
    "amount_prec": 0,
    "amount_min": "10",
    "tick_size": "0.5",
    "leverages": ["3", "5", "8", "10", "15", "20", "30", "50", "100"],
    "available": true,
    "funding": {
        "interval": 28800,
        "min": 0.00375,
        "max": -0.00375
    }
  },
  ...
]
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/market/list
  • Request parameter description: none
  • Return parameter description:
Name Type Description
name String Market name
type Integer Contract type, 1: Linear contract, 2: Inverse contract
stock String Base coin
money money String Price coin
fee_prec Integer Rate decimal
stock_prec Integer Base coin decimal
money_prec Integer Price coin decimal
multiplier Integer Multiplier
amount_prec Integer Quantity decimal
amount_min String Minimum amount
tick_size String Price granularity
leverages Array<String> Margin list
available Bool Whether the market is open
funding Object Funding rate
>interval Integer Funding rate collection period (sec)
>min String Maximum Funding Rate
>max String Minimum Funding Rate

Example

// Request
timestamp=1513746038205

// Response
"data": {
  "BTCUSD": [
    ["1000", "100", "0.005"],
    ["10000", "50", "0.01"],
    ["15000", "30", "0.015"],
    ["25000", "20", "0.02"],
    ["50000", "15", "0.025"],
    ["75000", "10", "0.03"],
    ["80000", "6", "0.035"],
    ["110000", "6", "0.04"],
    ["120000", "5", "0.045"],
    ["130000", "5", "0.05"],
    ["140000", "5", "0.055"],
    ["150000", "3", "0.06"]
  ]
}
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/market/limit_config
  • Request parameter description: none
  • Return parameter description:
Name Type Description
params[0] String amount, amount
params[1] String leverage, leverage
params[2] String mainten margin, maintenance margin rate

Example

// Request
timestamp=1513746038205
&market=ETHUSDT

// Response
"data": {
  "date": 1640165898905,
  "ticker": {
    "vol": "2374.8320",
    "low": "48300.07",
    "open": "48589.34",
    "high": "49588.57",
    "last": "49005.74",
    "buy": "49002.74",
    "period": 86400,
    "funding_time": 381,
    "position_amount": "179.5737",
    "funding_rate_last": "-0.00007488",
    "funding_rate_next": "-0.00027732",
    "funding_rate_predict": "-0.00043509",
    "insurance": "10647261.12543132884543148442",
    "sign_price": "48999.27",
    "index_price": "49010.06000000",
    "sell_total": "17.5542",
    "buy_total": "11.3251",
    "buy_amount": "0.0510",
    "sell": "49004.85",
    "sell_amount": "1.5010"
  }
}
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/market/ticker
  • Return parameter description:
Name Type Required Description
market String Y Market name
  • Return parameter description:
Name Type Description
period Integer Period
funding_time Integer The remaining time for the next collection of the funding rate, unit: minute
position_amount String Amount
funding_rate_last String Last funding rate
funding_rate_next String Next funding rate
funding_rate_predict String Predicted funding rate
last String Latest Price
sign_price String Mark Price
index_price String Index Price
sell_total String The number of ask orders in the last 1,000 transactions
buy_total String The number of bid orders in the last 1,000 transactions
open String Opening price
close String Closing price
high String Highest price
low String Lowest price
vol String Amount
buy String Bid1 price
buy_amount String Bid1 amount
sell String Ask1 price
sell_amount String Ask1 amount
date Integer Date timestamp

Example

// Request
timestamp=1513746038205

// Response
"data": {
  "ticker":{
    "BTCUSD": {
      "vol": "2374.8320",
      "low": "48300.07",
      "open": "48589.34",
      "high": "49588.57",
      "last": "49005.74",
      "buy": "49002.74",
      "period": 86400,
      "funding_time": 381,
      "position_amount": "179.5737",
      "funding_rate_last": "-0.00007488",
      "funding_rate_next": "-0.00027732",
      "funding_rate_predict": "-0.00043509",
      "insurance": "10647261.12543132884543148442",
      "sign_price": "48999.27",
      "index_price": "49010.06000000",
      "sell_total": "17.5542",
      "buy_total": "11.3251",
      "buy_amount": "0.0510",
      "sell": "49004.85",
      "sell_amount": "1.5010"
    }
      ...
  },
  "date": 1640165898905
}
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/market/ticker/all
  • Request parameter description: none
  • Return parameter description:
Name Type Description
period Integer Period
funding_time Integer The remaining time for the next collection of the funding rate, unit: minute
position_amount String Amount
funding_rate_last String Latest funding rate
funding_rate_next String Next funding rate
funding_rate_predict String Predicted funding rate
last String Latest Price
sign_price String Mark Price
index_price String Index Price
sell_total String The number of ask orders in the last 1,000 transactions
buy_total String The number of bid orders in the last 1,000 transactions
open String Opening price
close String Closing price
high String Highest price
low String Lowest price
vol String Amount
buy String Bid1 price
buy_amount String Bid1 amount
sell String Ask1 price
sell_amount String Ask1 amount
date Integer Date timestamp

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&merge=0.01
&limit=1

// Response
"data": {
  "asks": [
    ["48969.85", "0.0005"],
    ["48974.84", "0.0146"],
    ...
  ],
  "bids": [
    ["48969.84", "3.4175"],
    ["48969.83", "0.0025"],
    ...
  ],
  "last": "48969.85",
  "sign_price": "48966.61",
  "index_price": "48977.08"
}
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/market/depth
  • Request parameter description:
Name Type Required Description
market String Y Market name, such as: “BTCUSD” contract market
merge String Y Merge depth, the value is one of the values in [“10”, “1”, “0”, “0.1”, “0.01”]
limit Integer Y The number of obtained items, the value is one of the values in [5, 10, 20, 50]
  • Return parameter description:
Name Type Description
asks[0][0] String Ask1 price
asks[0][1] String Ask1 amount
bids[0][0] String Bid1 price
bids[0][1] String Bid1 amount
last String Price
sign_price String Mark Price
index_price String Index Price

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&last_id=0
&limit=1

// Response
"data": [
  {
    "id": 227979125,
    "type": "sell",
    "price": "48926.49",
    "amount": "0.0264",
    "date": 1640166869,
    "date_ms": 1640166869509
  }
   ...
]
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/market/deals
  • Request parameter description:
Name Type Required Description
market String Y Market name
last_id Integer N The largest ID of the last returned result
limit Integer N Number of query
  • Return parameter description:
Name Type Description
id Integer Txid
type String Type, “buy”: buy, “sell”: sell
price String Executed Price
amount String Amount
date String Transaction time, unit: second
date_ms String Transaction time, unit: milliseconds

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&type=1day
&limit=1

// Response
"data": [
  [
    1440308700,
    "233.37",
    "233.48",
    "243.37",
    "223.48",
    "52.01",
    "12284.48"
  ],
  ...
]
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/market/kline
  • Request parameter description:
Name Type Required Description
market String Y Market market
limit Integer N Get the K-line number, cannot exceed 1000 and the default is 1000
type String Y K-line information category, supports the following parameters: 1min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 12hour, 1day, 3day, 1week
  • Return parameter description:
Name Type Description
data[0][0] Integer Timestamp
data[0][1] String Opening price
data[0][2] String Closing price
data[0][3] String Highest price
data[0][4] String Lowest price
data[0][5] String Amount
data[0][6] String Value

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=0
&start_time=1636451914
&end_time=1681724907
&offset=0
&limit=1

// Response
"data": {
  "offset": 10,
  "limit": 100,
  "records": [
    {
      "id": 1, 
      "time": 102001.123,
      "deal_type": 1,
      "market": "BTCUSD",
      "user_id": 11,
      "deal_user_id": 11,
      "order_id": 13,
      "deal_order_id": 13,
      "position_id": 12,
      "side": 1,
      "role": 1,
      "position_type": 1,
      "price": "110.1",
      "open_price": "120.1",
      "settle_price": "120.1",
      "amount": "110",
      "position_amount": "220",
      "margin_amount": "220",
      "leverage": "10",
      "deal_stock": "0.222",
      "deal_fee": "0.001",
      "deal_margin": "20",
      "fee_rate": "0.02",
      "deal_profit": "100",      
      "deal_insurance": "0.004",
      "fee_asset": "CET",
      "fee_discount": "0.03",
      "fee_price": "0.1"
    }
      ...
  ]
}
  • Request type: GET
  • Signature required: Yes
  • Request Url: https://api.coinex.com/perpetual/v1/market/user_deals
  • Request parameter description:
  • Request parameter description:
Name Type Required Description
market String Y Market name
side Integer Y 0 unlimited, 1 sell, 2 buy
start_time Integer N Start
end_time Integer N End
offset Integer Y Offset
limit Integer Y Number of query
  • Return parameter description:
Name Type Description
offset Integer Offset
limit Integer Number of query
id Integer Transaction ID
time Integer Timestamp
deal_type Integer Transaction type, 1: open position, 2: add margin, 3: reduce margin, 4: close position, 5: reduce by system, 6: liquidate position, 7: position adl
market String Market name
user_id Integer User ID
deal_user_id Integer Counter-party user id
order_id Integer Order id
deal_order_id Integer Counter-party order id
position_id Integer Position id
side Integer 1: sell, 2: buy
role Integer 1: maker, 2: taker
position_type Integer Margin type, 1: Isolated, 2: Cross
price String Price
open_price String Opening Price
settle_price String Settlement Price
amount String Amount
position_amount String Amount
margin_amount String Position margin after transaction
leverage String Margin
deal_stock String Number of base coin transactions
deal_fee String Fee
deal_margin String Trading margin
fee_rate String Fee rate
deal_profit String Realized PNL
deal_insurance String Consumed or increased insurance fund

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&leverage=10
&position_type=1

// Response
"data": {
  "position_type": 1,
  "leverage": "10"
}
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/market/adjust_leverage
  • Request parameter description:
Name Type Required Description
market String Y Market name
leverage String Y Margin
position_type Integer Y 1 Isolated Margin 2 Cross Margin
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name type Description
position_type Integer Position Type
leverage String Margin

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&price=1100
&side=2

// Response
"data": {
  "position_expect": "10"
}
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”, “Access_id”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/market/position_expect
  • Request parameter description:
Name Type Required Description
market String Y Market name
price String Y Price
side Integer Y 1: sell 2: buy
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
position_expect String Estimated Amount of Positions To Be Opened

Example

// Request
timestamp=1513746038205

// Response
"data": {
  "BTC": {
    "available": "250",
    "frozen": "10",
    "tranfer": "10",
    "balance_total": "11",
    "margin", "10",
    "profit_unreal": "100"
  },
  "ETH": {
    "available": "250",
    "frozen": "10",
    "tranfer": "10",
    "balance_total": "11",
    "margin", "10",
    "profit_unreal": "100"
  }
}
  • Request type: GET
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/asset/query
  • Request parameter description: none
  • Return parameter description:
Name Type Description
available String Available
frozen String Frozen
tranfer String Available
balance_total String Balance
margin String Margin
profit_unreal String Unrealized PNL

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=2
&amount=1
&price=1100
&effect_type=1
&option=0
&client_id=client1

// Response
"data": {
  "order_id": 10,
  "position_id": 0,
  "stop_id": 1,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "target": 2,
  "effect_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "API",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "left": "80",
  "deal_stock": "0.9",
  "deal_fee": "0.01",
  "deal_profit": "0.1",
  "last_deal_amount": "0.1",
  "last_deal_price": "9101.1",
  "last_deal_time": 111111111,
  "last_deal_id": 1,
  "last_deal_type": 1,
  "last_deal_role": 1,
  "client_id": "",
  "fee_asset": "",
  "fee_discount": "0.03",
  "deal_asset_fee": "0.01",
  "leverage": "10",
  "position_type": 1
}
Name Type Required Description
market String Y Market name
side Integer Y Order type, 1: short sell, 2: long buy
amount String Y Amount
price String Y Price
effect_type Integer N Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
option Integer N Option, 1: place maker orders only, 2: hidden order, 3: place maker orders only and hide the order.Default is 0
client_id String N client_id is the custom ID of the order. Currently it only supports uppercase and lowercase letters, numbers, hyphens and underscores, and within 32 bytes limit.
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, 1: always valid, 2: immediate or cancel, 3: fill or kill.
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=2
&amount=1
&client_id=client1

// Response
"data": {
  "order_id": 10,
  "position_id": 0,
  "stop_id": 1,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "target": 2,
  "effect_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "API",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "left": "80",
  "deal_stock": "0.9",
  "deal_fee": "0.01",
  "deal_profit": "0.1",
  "last_deal_amount": "0.1",
  "last_deal_price": "9101.1",
  "last_deal_time": 111111111,
  "last_deal_id": 1,
  "last_deal_type": 1,
  "last_deal_role": 1,
  "client_id": "",
  "fee_asset": "",
  "fee_discount": "0.03",
  "deal_asset_fee": "0.01",
  "leverage": "10",
  "position_type": 1
}
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/put_market
  • Request parameter description:
Name Type Required Description
market String Y Market name
side Integer Y Order type, 1: short sell, 2: long buy
amount String Y Amount
client_id String N client_id is the custom ID of the order. Currently it only supports uppercase and lowercase letters, numbers, hyphens and underscores, and within 32 bytes limit.
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=2
&stop_type=1
&amount=1
&price=1100
&stop_price=1000
&effect_type=1
&option=0
&client_id=client1

// Response
"data": "success"
Name Type Required Description
market String Y Market name
side Integer Y Order type 1short sell, 2long buy
stop_type Integer Y Trigger type 1: Triggered by the latest transaction price, 2: Triggered by the mark price, 3: Triggered by the index price
amount String Y Amount
stop_price String Y Stop Price
price String Y Price
effect_type Integer N Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
option Integer N Option, 1: place maker orders only, 2: hidden order, 3: place maker orders only and hide the order.Default is 0
client_id String N client_id is the custom ID of the order. Currently it only supports uppercase and lowercase letters, numbers, hyphens and underscores, and within 32 bytes limit.
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=2
&stop_type=1
&amount=1
&stop_price=1000
&client_id=client1

// Response
"data": "success"
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/put_stop_market
  • Request parameter description:
Name Type Required Description
market String Y Market name
side Integer Y Order type, 1: short sell, 2: long buy
stop_type Integer Y Trigger type, 1: Triggered by the latest transaction price, 2: Triggered by the mark price, 3: Triggered by the index price
amount String Y Amount
stop_price String Y Stop Price
client_id String N client_id is the custom ID of the order. Currently it only supports uppercase and lowercase letters, numbers, hyphens and underscores, and within 32 bytes limit.
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&order_ids=39950p39950

// Response
"data": [
  {
    "code": 0,
    "message": "",
    "order": {
      "order_id": 10,
      "position_id": 0,
      "stop_id": 1,
      "market": "BTCUSD",
      "type": 1,
      "side": 2,
      "target": 2,
      "effect_type": 1,
      "user_id": 10,
      "create_time": 102001.123,
      "update_time": 102003.123,
      "source": "API",
      "price": "9100.1",
      "amount": "100",
      "taker_fee": "0.005",
      "maker_fee": "-0.002",
      "left": "80",
      "deal_stock": "0.9",
      "deal_fee": "0.01",
      "deal_profit": "0.1",
      "last_deal_amount": "0.1",
      "last_deal_price": "9101.1",
      "last_deal_time": 111111111,
      "last_deal_id": 1,
      "last_deal_type": 1,
      "last_deal_role": 1,
      "client_id": "",
      "fee_asset": "",
      "fee_discount": "0",
      "deal_asset_fee": "0",
      "leverage": "10",
      "position_type": 1
    }
  },
  {
    // order detail
  },
  {
    // ...
  }
]
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/cancel_batch
  • Request parameter description:
Name Type Required Description
market String Y Market name
order_ids String Y In the ID list of unexecuted orders, use “p” to separate multiple IDs
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
code Integer Error code
message String Error message
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&order_id=39950

// Response
"data": {
  "order_id": 10,
  "position_id": 0,
  "stop_id": 1,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "target": 2,
  "effect_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "API",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "left": "80",
  "deal_stock": "0.9",
  "deal_fee": "0.01",
  "deal_profit": "0.1",
  "last_deal_amount": "0.1",
  "last_deal_price": "9101.1",
  "last_deal_time": 111111111,
  "last_deal_id": 1,
  "last_deal_type": 1,
  "last_deal_role": 1,
  "client_id": "",
  "fee_asset": "",
  "fee_discount": "0.03",
  "deal_asset_fee": "0.01",
  "leverage": "10",
  "position_type": 1
}
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/cancel
  • Request parameter description:
Name Type Required Description
market String Y Market name
order_id Integer Y Unexecuted order ID
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=0

// Response
"data": "success"
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/cancel_all
  • Request parameter description:
Name Type Required Description
market String Y Market name
side Integer N 0: All 1: Sell, 2: Buy
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&order_id=39950

// Response
"data": {
  "order_id": 10,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "effect_type": 1,
  "stop_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "web",
  "state": 1,
  "stop_price": "9200",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "client_id": ""
}
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”, “Access_id”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/cancel_stop
  • Request parameter description:
Name Type Required Description
market String Y Market name
order_id Integer Y Unexecuted order ID
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, 1: always valid, 2: immediate or cancel, 3: fill or kill.
stop_type Integer Trigger method 1: by latest transaction price, 2: by index price, 3: by mark price
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
stop_price String Stop Price
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
client_id String Client id

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=0

// Response
"data": "success"
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”, “Access_id”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/cancel_stop_all
  • Request parameter description:
Name Type Required Description
market String Y Market name
side Integer N 0: All 1: Sell, 2: Buy
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=0
&client_id=client1
&offset=0
&limit=1

// Response
"data": {
  "records": [
    {
      "order_id": 10,
      "position_id": 0,
      "stop_id": 1,
      "market": "BTCUSD",
      "type": 1,
      "side": 2,
      "target": 2,
      "effect_type": 1,
      "user_id": 10,
      "create_time": 102001.123,
      "update_time": 102003.123,
      "source": "API",
      "price": "9100.1",
      "amount": "100",
      "taker_fee": "0.005",
      "maker_fee": "-0.002",
      "left": "80",
      "deal_stock": "0.9",
      "deal_fee": "0.01",
      "deal_profit": "0.1",
      "last_deal_amount": "0.1",
      "last_deal_price": "9101.1",
      "last_deal_time": 111111111,
      "last_deal_id": 1,
      "last_deal_type": 1,
      "last_deal_role": 1,
      "client_id": "",
      "fee_asset": "",
      "fee_discount": "0.03",
      "deal_asset_fee": "0.01",
      "leverage": "10",
      "position_type": 1
    },
    ...
  ],
  "total": 10,
  "offset": 0,
  "limit": 10
}
  • Request type: GET
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/pending
  • Request parameter description:
Name Type Required Description
market String Y Market name
side Integer Y 0: All 1: Sell, 2: Buy
client_id String N client_id is the custom ID of the order. Orders with the same client_id can be queried in batches.
offset Integer Y Offset, that is, from which one to get
limit Integer Y The number of records obtained at one time, the default is 20 and the maximum is 100
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross
total Integer Number of total records
offset Integer Offset
limit Integer Number of records per query

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&order_id=39950

// Response
"data": {
  "order_id": 10,
  "position_id": 0,
  "stop_id": 1,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "target": 2,
  "effect_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "API",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "left": "80",
  "deal_stock": "0.9",
  "deal_fee": "0.01",
  "deal_profit": "0.1",
  "last_deal_amount": "0.1",
  "last_deal_price": "9101.1",
  "last_deal_time": 111111111,
  "last_deal_id": 1,
  "last_deal_type": 1,
  "last_deal_role": 1,
  "client_id": "",
  "fee_asset": "",
  "fee_discount": "0.03",
  "deal_asset_fee": "0.01",
  "leverage": "10",
  "position_type": 1,
  "status": "not_deal"
}
  • Request type: GET
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/status
  • Request parameter description:
Name Type Required Description
market String Y Market name
order_id Integer Y Order id
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross
status String Status not_deal: not executed, part_deal: partially executed, done: executed, cancel: canceled

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=0
&client_id=client1
&offset=0
&limit=1

// Response
"data": {
  "records": [
    {
      "order_id": 10,
      "market": "BTCUSD",
      "type": 1,
      "side": 2,
      "effect_type": 1,
      "stop_type": 1,
      "user_id": 10,
      "create_time": 102001.123,
      "update_time": 102003.123,
      "source": "web",
      "state": 1,
      "stop_price": "9200",
      "price": "9100.1",
      "amount": "100",
      "taker_fee": "0.005",
      "maker_fee": "-0.002",
      "client_id": ""
    },
    ...
  ],
  "total": 10,
  "offset": 10,
  "limit": 5
}
  • Request type: GET
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/stop_pending
  • Request parameter description:
Name Type Required Description
market String Y Market name
side Integer Y 0: All 1: Sell, 2: Buy
client_id String N client_id is the custom ID of the order. Orders with the same client_id can be queried in batches.
offset Integer Y Offset, that is, from which one to get
limit Integer Y The number of records obtained, the default is 20 and the maximum is 100
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
stop_type Integer Trigger method 1: by latest transaction price, 2: by index price, 3: by mark price
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
state Integer The relationship between the stop price of a stop order and the current market price
1: Lower than the price in the current market
2: Higher than the price in the current market
stop_price String Stop Price
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
client_id String Client id
total Integer Number of total records
offset Integer Offset
limit Integer Number of records per query

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&order_id=39950

// Response
"data": {
  "order_id": 10,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "effect_type": 1,
  "stop_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "web",
  "state": 1,
  "stop_price": "9200",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "client_id": ""
}
  • Request type: GET
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/stop_status
  • Request parameter description:
Name Type Required Description
market String Y Market name
order_id Integer Y Order id
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
stop_type Integer Trigger method 1: by latest transaction price, 2: by index price, 3: by mark price
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
state Integer The relationship between the stop price of a stop order and the current market price
1: Lower than the price in the current market
2: Higher than the price in the current market
stop_price String Stop Price
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
client_id String Client id

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&side=0
&start_time=1636451914
&end_time=1681724907
&offset=0
&limit=1

// Response
"data": {
  "records": [
    {
      "order_id": 10,
      "position_id": 0,
      "stop_id": 1,
      "market": "BTCUSD",
      "type": 1,
      "side": 2,
      "target": 2,
      "effect_type": 1,
      "user_id": 10,
      "create_time": 102001.123,
      "update_time": 102003.123,
      "source": "API",
      "price": "9100.1",
      "amount": "100",
      "taker_fee": "0.005",
      "maker_fee": "-0.002",
      "left": "80",
      "deal_stock": "0.9",
      "deal_fee": "0.01",
      "deal_profit": "0.1",
      "last_deal_amount": "0.1",
      "last_deal_price": "9101.1",
      "last_deal_time": 111111111,
      "last_deal_id": 1,
      "last_deal_type": 1,
      "last_deal_role": 1,
      "client_id": "",
      "fee_asset": "",
      "fee_discount": "0.03",
      "deal_asset_fee": "0.01",
      "leverage": "10",
      "position_type": 1
    },
    ...
  ],
  "offset": 10,
  "limit": 5
}
  • Request type: GET
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/finished
  • Request parameter description:
Name Type Required Description
market String Y Market name, empty string to query all markets
side Integer Y 0: All 1: Sell, 2: Buy
start_time Integer N Start
end_time Integer N End
offset Integer Y Offset
limit Integer Y Number of records obtained
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross
offset Integer Offset
limit Integer Number of records per query

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&position_id=32114
&amount=1
&price=1100
&effect_type=1
&option=0
&client_id=client1

// Response
"data": {
  "order_id": 10,
  "position_id": 0,
  "stop_id": 1,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "target": 2,
  "effect_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "API",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "left": "80",
  "deal_stock": "0.9",
  "deal_fee": "0.01",
  "deal_profit": "0.1",
  "last_deal_amount": "0.1",
  "last_deal_price": "9101.1",
  "last_deal_time": 111111111,
  "last_deal_id": 1,
  "last_deal_type": 1,
  "last_deal_role": 1,
  "client_id": "",
  "fee_asset": "",
  "fee_discount": "0.03",
  "deal_asset_fee": "0.01",
  "leverage": "10",
  "position_type": 1
}
Name Type Required Description
market String Y Market name
position_id Integer Y Position ID
amount String Y Amount of closed positions
price String Y Price
effect_type Integer N Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
option Integer N Option, 1: place maker orders only. Default is 0.
client_id String N client_id is the custom ID of the order. Currently it only supports uppercase and lowercase letters, numbers, hyphens and underscores, and within 32 bytes limit.
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&position_id=32114
&amount=1
&client_id=client1

// Response
"data": {
  "order_id": 10,
  "position_id": 0,
  "stop_id": 1,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "target": 2,
  "effect_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "API",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "left": "80",
  "deal_stock": "0.9",
  "deal_fee": "0.01",
  "deal_profit": "0.1",
  "last_deal_amount": "0.1",
  "last_deal_price": "9101.1",
  "last_deal_time": 111111111,
  "last_deal_id": 1,
  "last_deal_type": 1,
  "last_deal_role": 1,
  "client_id": "",
  "fee_asset": "",
  "fee_discount": "0.03",
  "deal_asset_fee": "0.01",
  "leverage": "10",
  "position_type": 1
}
Name Type Required Description
market String Y Market name
position_id Integer Y Position ID
amount String N The number of positions to be closed, null to close all positions
client_id String N client_id is the custom ID of the order. Currently it only supports uppercase and lowercase letters, numbers, hyphens and underscores, and within 32 bytes limit.
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, the default is 1
1: always valid (GTC)
2: immediate or cancel (IOC)
3: fill or kill (FOK)
user_id Integer User ID
create_time Float Create time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&amount=1
&type=1

// Response
"data": {
  "position_id": 1,
  "create_time":1635760817.787848,
  "update_time":1636536470.973876,
  "market":"BTCUSDT",
  "user_id":1415,
  "type":1,
  "finish_type":1,
  "side":2,
  "sys":0,
  "amount":"2.0000",
  "amount_max":"2.0000",
  "amount_max_margin":"4000.00",
  "close_left":"2.0000",
  "open_price":"40000.00",
  "open_val":"80000.00",
  "open_val_max":"80000.00",
  "open_margin":"0.050",
  "open_margin_imply":"0.00",
  "mainten_margin":"0.005",
  "mainten_margin_amount":"400.00",
  "margin_amount":"4001.00",
  "profit_real":"61270.00",
  "profit_clearing":"0",
  "adl_sort_val":"0.00049987",
  "liq_time":0,
  "liq_order_time":0,
  "liq_amount":"0.0000",
  "liq_profit":"0.00",
  "liq_order_price":"0.00",
  "take_profit_price":"0.00",
  "stop_loss_price":"0.00",
  "taker_fee":"0.00000",
  "maker_fee":"0.00000",
  "take_profit_type":0,
  "stop_loss_type":0,
  "insurance":"0.00",
  "fee_asset":"",
  "deal_asset_fee":"0",
  "leverage":"20",
  "liq_price":"38199.50",
  "bkr_price":"37999.50",
  "liq_price_imply":"0.00",
  "bkr_price_imply":"0.00",
  "profit_unreal":"0.00",
  "settle_price": "1659.56",
  "settle_val": "1576.58200000000000000000",
  "adl_sort":1,
  "total":1
}
  • Request type: POST
  • Signature required: Yes
  • Request header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/position/adjust_margin
  • Request parameter description:
Name Type Required Description
market String Y Market name
amount String Y Adjustment limit
type Integer Y Adjustment type: 1 means increase margin, 2 means decrease margin
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
position_id Integer Position id
create_time Float Create time
update_time Float Update time
market String Market name
user_id Integer User ID
type Integer Margin type, 1: Isolated, 2: Cross
side Integer 1: Short, 2: Long
amount String Amount
amount_max String ATH position amount
amount_max_margin String Maximum margin amount
close_left String Available Amount to Liquidate
open_price String Average entry price
open_val String Cumulative opening value
open_val_max String Maximum opening value
open_margin String Margin%
mainten_margin String Maintenance Margin Rate
mainten_margin_amount String Maintenance margin
margin_amount String Margin, Initial Margin + Margin Call - Reduced Margin
profit_real String Realized PNL
profit_clearing String Unsettled PNL
take_profit_price String Take-profit price
stop_loss_price String Stop-loss price
taker_fee String Taker fee
maker_fee String Maker fee
take_profit_type Integer Take-profit price type, 1: transaction price, 3: mark price
stop_loss_type Integer Stop-loss price type, 1: transaction price, 3: mark price
fee_asset String Payment coin deducted as trading fees
deal_asset_fee String Executed trading fee
leverage String Margin
liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”
bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”
profit_unreal String Unrealized PNL
settle_price String Settlement Price
settle_val String Settlement Value
adl_sort Integer Sort by ADL
total Integer Number of accounts with positions

Example

// Request
timestamp=1513746038205
&market=ETHUSDT

// Response
"data": [
  {
    "position_id": 1,
    "create_time": 111.11,
    "update_time": 222.11,
    "market": "BTCUSD",
    "user_id": 2,
    "type": 1,
    "finish_type": 2,
    "side": 1,
    "sys": 0,
    "amount_max": "120",
    "amount_max_margin": "4000.00",
    "open_price": "100",
    "open_val_max": "0.2",
    "mainten_margin": "0.005",
    "profit_real": "0.1",
    "liq_price": "11.22",
    "bkr_price": "11",
    "leverage": "10",
    "fee_asset": "CET", 
    "deal_all": "0",
    "deal_asset_fee": "0.006",
    "settle_price": "1659.56",
    "settle_val": "1576.58200000000000000000",
    "first_price": "0",
    "latest_price": "0",
  }
]
  • Request type: GET
  • Signature required: Yes
  • Request header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request address: https://api.coinex.com/perpetual/v1/position/finished
  • Request parameter description:
Name Type Required Description
market String Y Market name
side Integer Y 0: All 1: Sell, 2: Buy
limit Integer Y Number of query
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
position_id Integer Position id
create_time Float Creation time
update_time Float Update time
market String Market name
user_id Integer User ID
type Integer Margin type, 1: Isolated, 2: Cross
side Integer 1: Short, 2: Long
amount_max String ATH position amount
amount_max_margin String Maximum margin amount
open_price String Average entry price
open_val_max String Maximum opening value
mainten_margin String Maintenance Margin Rate
profit_real String Realized PNL
liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”
bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”
leverage String Margin
fee_asset String Payment coin deducted as trading fees
deal_all String Total execution
deal_asset_fee String Trading fee
settle_price String Settlement Price
settle_val String Settlement Value
first_price String First transaction price
latest_price String Last transaction price

Example

// Request
timestamp=1513746038205
&market=ETHUSDT

// Response
"data": [
  {
    "position_id": 1,
    "create_time": 111.11,
    "update_time": 222.11,
    "market": "BTCUSD",
    "user_id": 2,
    "type": 1,
    "finish_type": 2,
    "side": 1,
    "sys": 0,
    "amount": "100",
    "amount_max": "120",
    "amount_max_margin": "4000.00",
    "close_left": 20,
    "open_price": "100",
    "open_val": "0.1",
    "open_val_max": "0.2",
    "open_margin": "0.01",
    "open_margin_imply": "0",
    "mainten_margin": "0.005",
    "mainten_margin_amount": "0.015",
    "margin_amount": "1.2",
    "profit_real": "0.1",
    "profit_clearing": "-1.1",
    "adl_sort_val": "1.1",
    "liq_time": 111.11,
    "liq_order_time": 222.22,
    "liq_amount": "10",
    "liq_profit": "0.1",
    "liq_order_price": "11.11", 
    "liq_price": "11.22",
    "liq_price_imply": "0",
    "bkr_price": "11",
    "bkr_price_imply": "0",
    "leverage": "10",
    "adl_sort": 100,
    "total": 10,
    "fee_asset": "CET", 
    "deal_asset_fee": "0.006",
    "take_profit_price": "109",
    "stop_loss_price": "109",
    "take_profit_type": 1,
    "stop_loss_type": 3,
    "profit_unreal": "0.00",
    "settle_price": "1659.56",
    "settle_val": "1576.58200000000000000000",
    "taker_fee": "0.00000",
    "maker_fee": "0.00000",
    "insurance": "0.00"
  }
]
  • Request type: GET
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/position/pending
  • Request parameter description:
Name Type Required Description
market String N Market name
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
position_id Integer Position id
create_time Float Create time
update_time Float Update time
market String Market name
user_id Integer User ID
type Integer Margin type, 1: Isolated, 2: Cross
side Integer 1: Short, 2: Long
amount String Amount
amount_max String ATH position amount
amount_max_margin String Maximum margin amount
close_left String Available Amount to Liquidate
open_price String Average entry price
open_val String Cumulative opening value
open_val_max String Maximum opening value
open_margin String Margin%
mainten_margin String Maintenance Margin Rate
mainten_margin_amount String Maintenance margin
margin_amount String Margin, Initial Margin + Margin Call - Reduced Margin
profit_real String Realized PNL
profit_clearing String Unsettled PNL
take_profit_price String Take-profit price
stop_loss_price String Stop-loss price
taker_fee String Taker fee
maker_fee String Maker fee
take_profit_type Integer Take-profit price type, 1: transaction price, 3: mark price
stop_loss_type Integer Stop-loss price type, 1: transaction price, 3: mark price
fee_asset String Payment coin deducted as trading fees
deal_asset_fee String Executed trading fee
leverage String Margin
liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”
bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”
profit_unreal String Unrealized PNL
settle_price String Settlement Price
settle_val String Settlement Value
adl_sort Integer Sort by ADL
total Integer Number of accounts with positions

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&start_time=1636451914
&end_time=1681724907
&offset=0
&limit=1

// Response
"data": {
  "records":[
    {
      "user_id": 1,
      "time": 1111111,
      "market": "BTCUSD",
      "asset": "BTC",
      "type": 1,
      "position_id": 2,
      "side": 1,
      "amount": 20,
      "price": "100",
      "funding_rate": "0.01",
      "funding": "0.2"
    },
    ...
  ],
  "offset": 0,
  "limit": 10
}
  • Request type: GET
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/position/funding
  • Request parameter description:
Name Type Required Description
market String Y Market name
start_time Integer N Start
end_time Integer N End
offset Integer Y Offset
limit Integer Y Number of records obtained
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
user_id Integer User ID
time Integer Timestamp
market String Market name
asset String Asset name
type Integer Margin type, 1: Isolated, 2: Cross
position_id Integer Position id
side Integer 1: Short, 2: Long
amount String Amount
price String Price
funding_rate String Funding rate
funding String Funding fee
offset Integer Offset
limit Integer Number of records per query

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&position_id=32114
&stop_type=1
&stop_loss_price=1000

// Response
"data": {
    "position_id": 1,
    "create_time": 111.11,
    "update_time": 222.11,
    "market": "BTCUSD",
    "user_id": 2,
    "type": 1,
    "finish_type": 2,
    "side": 1,
    "sys": 0,
    "amount": "100",
    "amount_max": "120",
    "amount_max_margin": "4000.00",
    "close_left": 20,
    "open_price": "100",
    "open_val": "0.1",
    "open_val_max": "0.2",
    "open_margin": "0.01",
    "open_margin_imply": "0",
    "mainten_margin": "0.005",
    "mainten_margin_amount": "0.015",
    "margin_amount": "1.2",
    "profit_real": "0.1",
    "profit_clearing": "-1.1",
    "adl_sort_val": "1.1",
    "liq_time": 111.11,
    "liq_order_time": 222.22,
    "liq_amount": "10",
    "liq_profit": "0.1",
    "liq_order_price": "11.11", 
    "liq_price": "11.22",
    "liq_price_imply": "0",
    "bkr_price": "11",
    "bkr_price_imply": "0",
    "leverage": "10",
    "adl_sort": 100,
    "total": 10,
    "fee_asset": "CET", 
    "deal_asset_fee": "0.006",
    "take_profit_price": "109",
    "stop_loss_price": "109",
    "take_profit_type": 1,
    "stop_loss_type": 3,
    "profit_unreal": "0.00",
    "settle_price": "1659.56",
    "settle_val": "1576.58200000000000000000",
    "taker_fee": "0.00000",
    "maker_fee": "0.00000",
    "insurance": "0.00"
}
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/position/stop_loss
  • Request parameter description:
Name Type Required Description
market String Y Market name
position_id Integer Y Position id
stop_type Integer Y 1: Transaction price, 3: Mark price
stop_loss_price String Y Stop-loss price
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
position_id Integer Position id
create_time Float Create time
update_time Float Update time
market String Market name
user_id Integer User ID
type Integer Margin type, 1: Isolated, 2: Cross
side Integer 1: Short, 2: Long
amount String Amount
amount_max String ATH position amount
amount_max_margin String Maximum margin amount
close_left String Available Amount to Liquidate
open_price String Average entry price
open_val String Cumulative opening value
open_val_max String Maximum opening value
open_margin String Margin%
mainten_margin String Maintenance Margin Rate
mainten_margin_amount String Maintenance margin
margin_amount String Margin, Initial Margin + Margin Call - Reduced Margin
profit_real String Realized PNL
profit_clearing String Unsettled PNL
take_profit_price String Take-profit price
stop_loss_price String Stop-loss price
taker_fee String Taker fee
maker_fee String Maker fee
take_profit_type Integer Take-profit price type, 1: transaction price, 3: mark price
stop_loss_type Integer Stop-loss price type, 1: transaction price, 3: mark price
fee_asset String Payment coin deducted as trading fees
deal_asset_fee String Trading fee
leverage String Margin
liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”
bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”
profit_unreal String Unrealized PNL
settle_price String Settlement Price
settle_val String Settlement Value
adl_sort Integer Sort by ADL
total Integer Number of accounts with positions

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&position_id=32114
&stop_type=1
&take_profit_price=1000

// Response
"data": {
    "position_id": 1,
    "create_time": 111.11,
    "update_time": 222.11,
    "market": "BTCUSD",
    "user_id": 2,
    "type": 1,
    "finish_type": 2,
    "side": 1,
    "sys": 0,
    "amount": "100",
    "amount_max": "120",
    "amount_max_margin": "4000.00",
    "close_left": 20,
    "open_price": "100",
    "open_val": "0.1",
    "open_val_max": "0.2",
    "open_margin": "0.01",
    "open_margin_imply": "0",
    "mainten_margin": "0.005",
    "mainten_margin_amount": "0.015",
    "margin_amount": "1.2",
    "profit_real": "0.1",
    "profit_clearing": "-1.1",
    "adl_sort_val": "1.1",
    "liq_time": 111.11,
    "liq_order_time": 222.22,
    "liq_amount": "10",
    "liq_profit": "0.1",
    "liq_order_price": "11.11", 
    "liq_price": "11.22",
    "liq_price_imply": "0",
    "bkr_price": "11",
    "bkr_price_imply": "0",
    "leverage": "10",
    "adl_sort": 100,
    "total": 10,
    "fee_asset": "CET", 
    "deal_asset_fee": "0.006",
    "take_profit_price": "109",
    "stop_loss_price": "109",
    "take_profit_type": 1,
    "stop_loss_type": 3,
    "profit_unreal": "0.00",
    "settle_price": "1659.56",
    "settle_val": "1576.58200000000000000000",
    "taker_fee": "0.00000",
    "maker_fee": "0.00000",
    "insurance": "0.00"
}
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/position/take_profit
  • Request parameter description:
Name Type Required Description
market String Y Futures market
position_id Integer Y Position id
stop_type Integer Y 1: Transaction price, 3: Mark price
take_profit_price String Y Take-profit price
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
position_id Integer Position id
create_time Float Create time
update_time Float Update time
market String Market name
user_id Integer User ID
type Integer Margin type, 1: Isolated, 2: Cross
side Integer 1: Short, 2: Long
amount String Amount
amount_max String ATH position amount
amount_max_margin String Maximum margin amount
close_left String Available Amount to Liquidate
open_price String Average entry price
open_val String Cumulative opening value
open_val_max String Maximum opening value
open_margin String Margin%
mainten_margin String Maintenance Margin Rate
mainten_margin_amount String Maintenance margin
margin_amount String Margin, Initial Margin + Margin Call - Reduced Margin
profit_real String Realized PNL
profit_clearing String Unsettled PNL
take_profit_price String Take-profit price
stop_loss_price String Stop-loss price
taker_fee String Taker fee
maker_fee String Maker fee
take_profit_type Integer Take-profit price type, 1: transaction price, 3: mark price
stop_loss_type Integer Stop-loss price type, 1: transaction price, 3: mark price
fee_asset String Payment coin deducted as trading fees
deal_asset_fee String Trading fee
leverage String Margin
liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”
bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”
profit_unreal String Unrealized PNL
settle_price String Settlement Price
settle_val String Settlement Value
adl_sort Integer Sort by ADL
total Integer Number of accounts with positions

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&position_id=32114

// Response
"data": "success"
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/position/market_close
  • Request parameter description:
Name Type Required Description
market String Y Market name
position_id Integer Y Position id
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&start_time=1636451914
&end_time=1681724907
&offset=0
&limit=1

// Response
"data": {
  "offset": 10,
  "limit": 100,
  "records": [
    {
      "time": 1615233600.7274661,
      "market": "BTCUSD",
      "asset": "BTC",
      "funding_rate": "0.00175",
      "funding_rate_real": "0.00175"
    }
       ...
  ]
}
  • Request type: GET
  • Signature required: No
  • Request Url: https://api.coinex.com/perpetual/v1/market/funding_history
  • Request parameter description:
Name Type Required Description
market String Y Market name
start_time Integer N Start
end_time Integer N End
offset Integer Y Offset
limit Integer Y Number of records obtained
  • Return parameter description:
Name Type Description
time Float Timestamp
market String Market name
asset String Asset name
funding_rate String Theoretical Funding Rate
funding_rate_real String Actual Funding Rate
offset Integer Offset
limit Integer Number of records per query

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&order_id=39950
&amount=1
&price=1100

// Response
"data": {
  "order_id": 10,
  "position_id": 0,
  "stop_id": 1,
  "market": "BTCUSD",
  "type": 1,
  "side": 2,
  "target": 2,
  "effect_type": 1,
  "user_id": 10,
  "create_time": 102001.123,
  "update_time": 102003.123,
  "source": "API",
  "price": "9100.1",
  "amount": "100",
  "taker_fee": "0.005",
  "maker_fee": "-0.002",
  "left": "80",
  "deal_stock": "0.9",
  "deal_fee": "0.01",
  "deal_profit": "0.1",
  "last_deal_amount": "0.1",
  "last_deal_price": "9101.1",
  "last_deal_time": 111111111,
  "last_deal_id": 1,
  "last_deal_type": 1,
  "last_deal_role": 1,
  "client_id": "",
  "fee_asset": "",
  "fee_discount": "0.03",
  "deal_asset_fee": "0.01",
  "leverage": "10",
  "position_type": 1
}
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/modify
  • Request parameter description:
Name Type Required Description
market String Y Market name
order_id Integer Y Order id
amount String N Amount
price String N Price
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds
  • Return parameter description:
Name Type Description
order_id Integer Order id
position_id Integer Position id
stop_id Integer Stop order id
market String Market name
type Integer Order type, 1: limit order, 2: market order
side Integer 1: sell, 2: buy
effect_type Integer Order effective type, 1: always valid, 2: immediate or cancel, 3: fill or kill.
user_id Integer User ID
create_time Float Creation time
update_time Float Update time
source String Source
price String Price
amount String Amount
taker_fee String Taker rate
maker_fee String Maker rate
left String The remaining Unexecuted amount of the order
deal_stock String Executed value
deal_fee String Used trading fee
deal_profit String Realized PNL
last_deal_amount String Latest transaction amount
last_deal_price String Latest transaction price
last_deal_time Integer Latest transaction time
last_deal_id Integer Latest txid
last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
last_deal_role Integer Latest role 1: Maker 2: Taker
client_id String Client id
leverage String Margin
position_type Integer Margin type, 1: Isolated, 2: Cross

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&order_id=39950
&amount=1
&price=1100
&stop_price=1000

// Response
"data": "success"
  • Request type: POST
  • Signature required: Yes
  • Request Header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request Url: https://api.coinex.com/perpetual/v1/order/modify_stop
  • Request parameter description:
Name Type Required Description
market String Y Market name
order_id Integer Y Order id
amount String N Amount
price String N Price
stop_price String N Stop Price
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&position_id=32114
&start_time=1636451914
&end_time=1681724907
&offset=0
&limit=1

// Response
"data": {
    "limit": 10,
    "offset": 0,
    "records": [
        {
            "amount": "0.20000000",
            "deal_id": 1122,
            "market": "BTCUSDT",
            "order_id": 3322,
            "pirce": "40975.66",
            "position_id": 2233,
            "role": 1,
            "side": 1,
            "time": 1635760817.787848
        }
        ...
    ]
}
  • Request type: GET
  • Signature required: Yes
  • Request header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request address: https://api.coinex.com/perpetual/v1/position/adl_history
  • Request parameter description:
Name Type Required Description
market String Y Market name, empty string to query all markets
position_id Integer Y Order ID, value 0 to query all positions
start_time Integer N Start
end_time Integer N End
offset Integer Y Offset
limit Integer Y Number of query
  • Return parameter description:
Name Type Description
amount String Amount
deal_id Integer Transaction ID
market String Market name
order_id Integer Order id
price String Price
position_id Integer Position id
role Integer 1: maker, 2: taker
side Integer 1: sell, 2: buy
time Integer Timestamp

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&client_id=client1

// Response
{
  "code": 0,
  "data": [
    {
      "code": 0,
      "order": {
        "id": 35435975,
        "account_id": 0,
        "create_time": 1636020972,
        "finished_time": 1636020972,
        "amount": "1000",
        "price": "0",
        "deal_amount": "811.88590061",
        "deal_money": "43814713.2324293",
        "deal_fee": "60763.149707616",
        "stock_fee": "0",
        "money_fee": "60763.149707616",
        "asset_fee": "3269.137012494808",
        "fee_asset": "CET",
        "fee_discount": "0.7",
        "avg_price": "53966.58963963985619139301",
        "market": "BTCUSDT",
        "left": "0",
        "maker_fee_rate": "0",
        "taker_fee_rate": "0.0016",
        "order_type": "market",
        "type": "sell",
        "status": "done",
        "client_id": ""
      },
      "message": ""
    }
  ],
  "message": "Ok"
}
Name Type Required Description
market String no Market name
client_id String Yes client_id is the custom ID of the order. Orders with the same client_id can be cancelled in batches.
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&client_id=client1

// Response
{
  "code": 0,
  "data": [
    {
      "code": 0,
      "order": {
        "id": 35435975,
        "account_id": 0,
        "create_time": 1636020972,
        "finished_time": 1636020972,
        "amount": "1000",
        "price": "0",
        "deal_amount": "811.88590061",
        "deal_money": "43814713.2324293",
        "deal_fee": "60763.149707616",
        "stock_fee": "0",
        "money_fee": "60763.149707616",
        "asset_fee": "3269.137012494808",
        "fee_asset": "CET",
        "fee_discount": "0.7",
        "avg_price": "53966.58963963985619139301",
        "market": "BTCUSDT",
        "left": "0",
        "maker_fee_rate": "0",
        "taker_fee_rate": "0.0016",
        "order_type": "market",
        "type": "sell",
        "status": "done",
        "client_id": ""
      },
      "message": ""
    }
  ],
  "message": "Ok"
}
Name Type Required Description
market String no Market name
client_id String Yes client_id is the custom ID of the order. Orders with the same client_id can be cancelled in batches.
timestamp Integer Y Client timestamp, unit: milliseconds
windowtime Integer N Time window, unit: milliseconds

The returned data is the overall futures market configuration

Example

// Request
timestamp=1513746038205

// Response
{
    "code": 0,
    "data": {
        "settle_switch": 2  // 1: enable settle; 2: disable settle
    },
    "message": "OK"
}
  • Request type: GET
  • Signature required: Yes
  • Request header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request address: https://api.coinex.com/perpetual/v1/market/preference
  • Return parameter description:
Name Type Description
settle_switch Integer 1: Enable auto-settlement. 2: Disable auto-settlement.

The updated data is the overall futures market configuration

Example

// Request
timestamp=1513746038205
&settle_switch=1

// Response
{
    "code": 0,
    "message": "Success",
    "data": {}
}

  • Request type: POST
  • Signature required: Yes
  • Request header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request address: https://api.coinex.com/perpetual/v1/market/preference
  • Request parameter description:
Name Type Required Description
settle_switch Integer Yes 1: Enable auto-settlement. 2: Disable auto-settlement.

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&position_id=32114
&start_time=1636451914
&end_time=1681724907
&offset=0
&limit=1

// Response
"data": {
    "limit": 1,
    "offset": 0,
    "records": [
        {
            "bkr_price": "0",
            "leverage": "3",
            "liq_price": "0",
            "margin_amount": "205.33333333333333333333",
            "margin_change": "111",
            "market": "BTCUSDT",
            "position_amount": "0.01",
            "position_id": 975,
            "position_type": 2,
            "settle_price": "28300",
            "time": 1682413268.680759,
            "type": 1,
            "user_id": 1367
        }
    ]
}
  • Request type: GET
  • Signature required: Yes
  • Request header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request address: https://api.coinex.com/perpetual/v1/position/margin_history
  • Request parameter description:
Name Type Required Description
market String Y Market name, empty string to query all markets
position_id Integer Y Order ID, value 0 to query all positions
start_time Integer N Start
end_time Integer N End
offset Integer Y Offset
limit Integer Y Number of query
  • Return parameter description:
Name Type Description  
position_id Integer Position id  
market String Market name  
user_id Integer User ID  
type Integer Margin type, 1: Isolated, 2: Cross  
leverage String Margin  
liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”  
bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”  
settle_price String Settlement Price  
margin_amount String Position margin after transaction  
margin_change String Adjusted position margin  
position_amount String Amount  
position_type Integer Y 1 Isolated 2 Cross
time Float Timestamp  

Example

// Request
timestamp=1513746038205
&market=ETHUSDT
&position_id=32114
&start_time=1636451914
&end_time=1681724907
&offset=0
&limit=1

// Response
"data": {
    "limit": 10,
    "offset": 0,
    "records": [
        {
            "time": 1682413268.680759,
            "market":"BTCUSDT",
            "user_id":1367,
            "position_id":975,
            "type":5,
            "margin_change":"209498",
            "margin_amount":"310599.3354",
            "liq_price":"0",
            "bkr_price":"0",
            "position_type":2,
            "leverage":"3",
            "position_amount":"3100",
            "settle_price":"90"
        }
        ...
    ]
}
  • Request type: GET
  • Signature required: Yes
  • Request header: Authorization: “xxxx”,”AccessId”: “xxx”
  • Request address: https://api.coinex.com/perpetual/v1/position/settle_history
  • Request parameter description:
Name Type Required Description
market String Y Market name, empty string to query all markets
position_id Integer Y Order ID, value 0 to query all positions
start_time Integer N Start
end_time Integer N End
offset Integer Y Offset
limit Integer Y Number of query
  • Return parameter description:
Name Type Description  
position_id Integer Position id  
market String Market name  
user_id Integer User ID  
type Integer Margin type, 1: Isolated, 2: Cross  
leverage String Margin  
liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”  
bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”  
settle_price String Settlement Price  
margin_amount String Position margin after transaction  
margin_change String Adjusted position margin  
position_amount String Amount  
position_type Integer Y 1 Isolated 2 Cross
time Float Timestamp  

WebSocket

The websocket address is wss://perpetual.coinex.com/

If you repeatedly subscribe to the same data in a connection, the previous subscription will be canceled

  • Compressed request

When trying to connect, you need to configure compression using Deflate algorithm, under reference standard RFC7692, whose feature is supported in most developers’ tool libraries, and all you need is configuration.

The following example is the Python code implementation of websockets

import websockets

websockets.connect(..., compression='deflate')
  • Request parameter description:
    • method: method, String.
    • params: parameters, Array.
    • id: request id, Integer

Request example:

{
  "id": 4,
  "method": "state.subscribe",
  "params": []
}
  • Return result
    • result: Json object, null means failure.
    • error: Json object, null for success, not null for failure.
    • id: request id, Integer.

Return example:

//success
{
  "error": null,
  "id": 4,
  "result": "success"
}

//success with result
{
  "error": null
  "id": 4,
  "result": {}
}

//error
{
  "error": {
    "code": 1,
    "message": ""
  },
  "id": 4,
  "result": null
}

  • Push
    • method: method, String
    • params: parameters, Array
    • id: null

Push example:

{
  "id": null,
  "method": "state.update",
  "params": []
}
  • Error code description
Error Code Error message Description
1001 invalid argument Contract invalid argument
1002 service unavailable Service unavailable
1003 service timeout Service timeout
1004 unknown method Invalid method
1005 require auth Authorization required
1006 internal error Contract internal error
1007 direct result null No market found
1009 authorization fail Authorization failed
1010 access_id not exists AccessId does not exist
1011 time check error Time check error
1012 user is forbidden User prohibited
1013 ip not allow visit IP access prohibited
1014 too quick Visit too frequent
3008 service too busy Service is busy

Example:

// Request
{
  "method":"server.sign",
  "params": [
    "4DA36FFC61334695A66F8D29020EB589",
    "3e9e58c40d18358bb129c98139eec99af781275708895e522f572a87dc8d9137",
    1513746038205
  ],
  "id": 15,
 }

// Response
{
  "error": null,
  "result": {
    "status": "success"
  },
  "id": 15
}
  • method: “server.sign”
  • Request parameter description:

    Name Type Required Description
    access_id String Yes access_id
    sign_data String Yes Perform sha256 calculation on the string access_id={access_id}&timestamp={timestamp}&secret_key={secret_key}, convert it to hexadecimal lowercase, and the length is 64 bits
    timestamp Interger Yes Timestamp, milliseconds, the difference between the server timestamp and the server timestamp cannot be more than 1 minute
  • Return parameter description:

    Name Type Description
    status String Request result, when the authentication is successful, the return value is “success”, and the authentication failure information exists in the error field

Example:

// Request
{
  "method":"server.ping",
  "params":[],
  "id": 11
}

// Response
{
  "error": null,
  "result": "pong",
  "id": 11
}
  • method: “server.ping”
  • Return parameter description:

    Name Type Description
    result String “pong”

Example:

// Request
{
  "method":"server.time",
  "params":[],
  "id": 11
}

// Response
{
  "error": null,
  "result": 1493285895,
  "id": 11
}
  • method: “server.time”
  • Return parameter description:

    Name Type Description
    timestamp Integer Timestamp, unit: seconds

Example:

// Request
{
  "method":"state.query",
  "params":[
    "BTCUSD",
     86400,
  ],
  "id":15
}

// Response
{
  "error ": null, 
  "result": {
    "close":"430.33",
    "deal":"1574489.5181782117",
    "high":"445.68",
    "last":"430.33",
    "low" :"420.32",
    "open":"434.11",
    "period":86400,
    "volume":"3624.85992531",
    "funding_time": 10,
    "position_amount": "100",
    "funding_rate_last" : "0.001",
    "funding_rate_next": "0.001",
    "funding_rate_predict": "0.001",
    "insurance": "1000",
    "sign_price": "100",
    "index_price": "200",
    "sell_total": "",
    "buy_total": ""
  },
  "id": 15
}

  • method: “state.query”
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes period, period, e.g. 86400 is the past 24 hours
  • Return parameter description:

    Name Type Description
    close String Closing price
    deal String Total Trading Value
    high String Highest price
    last String Price
    low String Lowest price
    open String Opening price
    period Integer Period
    volume String Total transaction volume
    funding_time String Time to the next funding rate, minutes
    position_amount String Current position
    funding_rate_last String Last funding rate
    funding_rate_next String Next funding rate
    funding_rate_predict String Predicted funding rate
    insurance String Current insurance fund
    sign_price String Mark Price
    index_price String Index Price
    sell_total String The number of ask orders in the last 1,000 transactions
    buy_total String The number of bid orders in the last 1,000 transactions

Example:

// Request
{
  "method":"state.subscribe",
  "params":[
    "BTCUSD"
  ],
  "id":15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “state.subscribe”
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name, empty to subscribe to all markets
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "state.update", 
  "params": [
    {
      "BTCUSD": {
        "close": "430.33",
        "deal": "1574489.5181782117",
        "high":"445.68",
        "last":"430.33",
        "low":"420.32",
        "open":"434.11",
        "period":86400,
        "volume":"3624.85992531",
        "funding_time": 10,
        "position_amount": "100",
        "funding_rate_last": "0.001",
        "funding_rate_next": "0.001",
        "funding_rate_predict": "0.001",
        "insurance": "1000 ",
        "sign_price": "100",
        "index_price": "200",
        "sell_total": "",
        "buy_total": ""
      },
    }
  ], 
  "id": 15
}
  • method: “state.update”
  • Notification parameter description:

    Name Type Description
    close String Closing price
    deal String Total Trading Value
    high String Highest price
    last String Price
    low String Lowest price
    open String Opening price
    period Integer Period
    volume String Total transaction volume
    funding_time String Time to the next funding rate, minutes
    position_amount String Current position
    funding_rate_last String Last funding rate
    funding_rate_next String Next funding rate
    funding_rate_predict String Predicted funding rate
    insurance String Current insurance fund
    sign_price String Mark Price
    index_price String Index Price
    sell_total String The number of ask orders in the last 1,000 transactions
    buy_total String The number of bid orders in the last 1,000 transactions

Example:

// Request
{
  "method":"state.unsubscribe",
  "params":[],
  "id":15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “state.unsubscribe”
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method":"depth.query",
  "params":[
    "BTCUSD",
    20,
    "0"
  ],
  "id":15
}

// Response
{
  "error": null, 
  "result": {
    "bids": [
      [
        "12.25",
        "0.0588"
      ]
    ],
    "asks": [
      [
        "12.94",
        "0.1524"
      ]
    ],
    "last": "3740",
    "time": 111111,
    "sign_price": "3750",
    "index_price": "3750",
    "checksum": 1533284725
  } ,
  "id": 15
}
  • method: “depth.query”
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes limit, number of records obtained, one of [5, 10, 20, 50]
    params[2] Integer Yes interval, market depth aggregation level, one of String [“10”, “1”, “0”, “0.1”, “0.01”]
  • Return parameter description:

    Name Type Description
    last String Price
    time Integer Timestamp
    sign_price String Mark Price
    index_price String Index Price
    checksum Integer The checksum is a signed 32-bit integer of the full depth data, used to verify the accuracy of the depth data.
    1.Construct the checksum string: bid1_price:bid1_amount:bid2_price:bid2_amount:ask1_price:ask1_amout:… (if there is no bid, the checksum string will be ask1_price:ask1_amount:ask2_price:ask2_amount:…)
    2. Use crc32 algorithm to encode the checksum string
    asks[0][0] String Ask1 price
    asks[0][1] String Ask1 amount
    bids[0][0] String Bid1 price
    bids[0][1] String Bid1 amount

Example:

// Request
{
  "method":"depth.subscribe",
  "params":[
    "BTCBCH",
    5, 
    "0",
    true
  ],
  "id":15
}

/ / Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “depth.subscribe”
  • Note: all previous market depth subscriptions will be cancelled, when this command is called
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes limit, number of records obtained, one of [5, 10, 20, 50]
    params[2] Integer Yes interval, market depth aggregation level, one of String [“10”, “1”, “0”, “0.1”, “0.01”]
    params[3] Bool No diff, true: incremental subscription, false: full subscription, default is true
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Request
{
  "method":"depth.subscribe_multi",
  "params":[
    ["BTCUSDT", 10, "0", true],
    ["ETHUSDT", 10, "0", false],
  ] ,
  "id":15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “depth.subscribe_multi”
  • Note: all previous market depth subscriptions will be cancelled, when this command is called
  • Request parameter description:

    Name Type Required Description
    params[0][0] String Yes market, market name
    params[0][1] Integer Yes limit, number of records obtained, one of [5, 10, 20, 50]
    params[0][2] Integer Yes interval, market depth aggregation level, one of String [“10”, “1”, “0”, “0.1”, “0.01”]
    params[0][3] Bool No diff, true: incremental subscription, false: full subscription, default is true
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "depth.update", 
  "params": [
    false,
    {
      "bids": [
        [
          "12.25",
          "0.0588"
        ]
      ],
      "asks": [
        [
          "12.94",
          "0.1524"
        ]
      ],
      "last": "3740",
      "time": 111111,
      "sign_price": "3750",
      "index_price" : "3750",
      "checksum": 1533284725
    },
    "BTCUSDT"
  ], 
  "id": null
}
  • method: “depth.update”
  • Push parameter description:
    • Params [0] indicates whether it is an incremental push or a full push.
    • Incremental push: Each push only delivers the depth data updated from the last push to the present time. In every 200 milliseconds. No push if there is no deep update.
    • Full push: Each push delivers the complete depth data. In every 200 milliseconds. No push if there is no deep update.
    • For multiple market subscriptions, use the params [2] to separate push messages in different markets.
    • Full market depth push is delivered every 1 minute.
  • Push parameter description:

    Name Type Description
    params[0] Bool true: complete result, false: return latest result
    last String Price
    time Integer Timestamp
    sign_price String Mark Price
    index_price String Index Price
    checksum Integer The checksum is a signed 32-bit integer of the full depth data, used to verify the accuracy of the depth data.
    1. Construct the checksum string: bid1_price:bid1_amount:bid2_price:bid2_amount:ask1_price:ask1_amout:… (if there is no bid, the checksum string will be ask1_price:ask1_amount:ask2_price:ask2_amount:…)
    2. Use crc32 algorithm to encode the checksum string
    asks[0][0] String Ask1 price
    asks[0][1] String Ask1 amount
    bids[0][0] String Bid1 price
    bids[0][1] String Bid1 amount
    params[2] String market, market name

Example:

// Request
{
  "method":"depth.unsubscribe",
  "params":[],
  "id":15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “depth.unsubscribe”
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method":"depth.unsubscribe_multi",
  "params":[],
  "id":15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “depth.unsubscribe_multi”
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method":"deals.query",
  "params":[
    "BTCUSDT",
    10,
    0
  ],
  "id":16
}

// Response
{
  "error": null, 
  "result": [
    {
      "type": "sell",
      "time": 1496458040.059284,
      "price": "17868.41",
      "id": 29433,
      "amount" : "10"
    }
  ],
  "id": 16
}
  • method: “deals.query”
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes limit, the number of records obtained
    params[2] Integer Yes last_id, the largest ID of the last returned result
  • Return parameter description:

    Name Type Description
    type String Type, “sell”: sell, “buy”: buy
    time Float Timestamp
    price String Price
    id Integer No.
    amount String Amount

Example:

// Request
{
  "method":"deals.query_user",
  "params":[
    "BTCUSDT",
    1,
    1637548343,
    1637548800,
    0,
    10,
  ],
  "id": 16
}

// Response
{
  "error": null, 
  "result": [
    {
      "type": "sell",
      "time": 1496458040.059284,
      "price": "17868.41",
      "id": 29433,
      "amount": "10"
    }
  ],
  "id": 16
}
  • method: “deals.query_user”
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes side, tx direction, 0: all, 1: sell, 2: buy
    params[2] Integer Yes start_time, start time, 0: no limit
    params[3] Integer Yes end_time, end time, 0: no limit
    params[4] Integer Yes offset, that is, from which one to get
    params[5] Integer Yes limit, the number of records obtained
  • Return parameter description:

    Name Type Description
    type String Type, “sell”: sell, “buy”: buy
    time Float Timestamp
    price String Price
    id Integer No.
    amount String Amount

Example:

// Request
{
  "method":"deals.subscribe",
  "params":[
    "BTCBCH"
  ],
  "id":16
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “deals.subscribe”
  • Request parameter description:
Name Type Required Description
params Array\<String\> No Market list, empty to subscribe to all markets
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "deals.update", 
  "params": [
    "BTCUSD",
    [
      {
        "type": "sell",
        "time": 1496458040.059284,
        "price ": "17868.41",
        "id": 29433,
        "amount": "10"
      }
    ],
    true
  ], 
  "id": null
}
  • method: “deals.update”
  • Push parameter description:

    Name Type Description
    params[0] String market, market name
    type String Type, “sell”: sell, “buy”: buy
    time Float Timestamp
    price String Price
    id Integer No.
    amount String Amount
    params[2] Bool If this parameter is true, the transaction is performed by the user.If this parameter is not set, it indicates the transaction of all users.

Example:

// Request
{
  "method":"deals.unsubscribe",
  "params":[],
  "id":16
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “deals.unsubscribe”
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method":"kline.query",
  "params":[
    "BTCUSD",
    60
  ],
  "id": 5
}

// Response
{
  "error" : null, 
  "result": [
    [
      1496458500,
      "16.65",
      "11.57",
      "17.65",
      "10.57",
      "1862"
    ]
  ],
  "id": 5
}
  • method: “kline.query”
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes period, period
    1min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 12hour, 1day, 3day, 1week
  • Return parameter description:

    Name Type Description
    result[0][0] Integer Timestamp
    result[0][1] String Opening price
    result[0][2] String Closing price
    result[0][3] String Highest price
    result[0][4] String Lowest price
    result[0][5] String Amount

Example:

// Request
{
  "method":"kline.subscribe",
  "params":[
    "BTCUSD",
    60
  ],
  "id": 5
}

// Response
{
  "error" : null,
  "id": 4,
  "result": "success"
}
  • method: “kline.subscribe”
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes period, period
    1min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 12hour, 1day, 3day, 1week
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "kline.update", 
  "params":[
    [
      1496458500,
      "16.65",
      "11.57",
      "17.65",
      "10.57",
      "1862 "
    ]
  ],
  "id": null
}
  • method: “kline.update”
  • Push parameter description:

    Name Type Description
    result[0][0] Integer Timestamp
    result[0][1] String Opening price
    result[0][2] String Closing price
    result[0][3] String Highest price
    result[0][4] String Lowest price
    result[0][5] String Amount

Example:

// Request
{
  "method":"kline.unsubscribe",
  "params":[],
  "id": 5
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “kline.unsubscribe”
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method": "order.query",
  "params": [
    "BTCUSD",
    0,
    0,
    10
  ],
  "id": 15
}

// Response
{
  "error": null, 
  "result": {
    "limit": 10,
    "offset": 0,
    "total": 1,
    "records": [{
      "order_id": 10,
      "position_id": 0,
      "stop_id": 1,
      "market": "BTCUSD",
      "type": 1,
      "side": 2,
      "target": 2,
      "effect_type": 1,
      "user_id": 10,
      "create_time": 102001.123,
      "update_time": 102003.123,
      "source": "API",
      "price": "9100.1",
      "amount": "100",
      "taker_fee": "0.005",
      "maker_fee": "-0.002",
      "left": "80",
      "deal_stock": "0.9",
      "deal_fee": "0.01",
      "deal_profit": "0.1",
      "last_deal_amount": "0.1",
      "last_deal_price": "9101.1",
      "last_deal_time": 111111111,
      "last_deal_id": 1,
      "last_deal_type": 1,
      "last_deal_role": 1,
      "client_id": "",
      "fee_asset": "",
      "fee_discount": "0.03",
      "deal_asset_fee": "0.01",
      "leverage": "10",
      "position_type": 1
    }]
  },
  "id": 15
}
  • method: “order.query”
  • Authorization: required, refer to server.sign
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes side, 0: all, 1: sell, 2: buy
    params[2] Integer Yes offset, that is, from which one to get
    params[3] Integer Yes limit, the number of records obtained
  • Return parameter description:

    Name Type Description
    total Integer Number of order results returned
    limit Integer Number of records obtained
    offset Integer Offset
    order_id Integer Order id
    position_id Integer Position id
    stop_id Integer Stop order id
    market String Market name
    type Integer Order type, 1: limit order, 2: market order
    side Integer 1: sell, 2: buy
    effect_type Integer Order effective type, the default is 1
    1: always valid (GTC)
    2: immediate or cancel (IOC)
    3: fill or kill (FOK)
    user_id Integer User ID
    create_time Float Create time
    update_time Float Update time
    source String Source
    price String Price
    amount String Amount
    taker_fee String Taker rate
    maker_fee String Maker rate
    left String The remaining Unexecuted amount of the order
    deal_stock String Executed value
    deal_fee String Used trading fee
    deal_profit String Realized PNL
    last_deal_amount String Latest transaction amount
    last_deal_price String Latest transaction price
    last_deal_time Integer Latest transaction time
    last_deal_id Integer Latest txid
    last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
    last_deal_role Integer Latest role 1: Maker 2: Taker
    client_id String Client id
    leverage String Margin
    position_type Integer Margin type, 1: Isolated, 2: Cross

Example:

// Request
{
  "method": "order.query_stop",
  "params": [
    "BTCUSD",
    2,
    0,
    10
  ],
  "id": 15
}

// Response
{
  "error": null, 
  "result": {
    "limit":10,
    "offset":0,
    "total":1,
    "records":[
      {
        "order_id":7349 ,
        "type":2,
        "side":2,
        "user_id":1415,
        "create_time":1640483587.5513339,
        "update_time":1640483587.5513339,
        "market":"BTCUSDT",
        "source": "test",
        "state":1,
        "client_id":"",
        "target":0,
        "effect_type":1,
        "stop_type":1,
        "stop_price":"45000.00",
        "price":"0",
        "amount":"10000.0000",
        "taker_fee":"0.00050",
        "maker_fee":"0.00030",
        "fee_asset":"",
        "fee_discount":"0 "
      }
    ]
  },
  "id": 15
}
  • method: “order.query_stop”
  • Authorization: required, refer to server.sign
  • Request parameter description:

    Name Type Required Description
    params[0] String Yes market, market name
    params[1] Integer Yes side, 0: all, 1: sell, 2: buy
    params[2] Integer Yes offset, that is, from which one to get
    params[3] Integer Yes limit, the number of records obtained
  • Return parameter description:

    Name Type Description
    total Integer Number of order results returned
    limit Integer Number of records obtained
    offset Integer Offset
    order_id Integer Order id
    market String Market name
    type Integer Order type, 1: limit order, 2: market order
    side Integer 1: sell, 2: buy
    effect_type Integer Order effective type, the default is 1
    1: always valid (GTC)
    2: immediate or cancel (IOC)
    3: fill or kill (FOK)
    stop_type Integer Trigger type 1: Triggered by the latest transaction price, 2: Triggered by the mark price, 3: Triggered by the index price
    stop_price String Stop Price
    user_id Integer User ID
    create_time Float Create time
    update_time Float Update time
    source String Source
    price String Price
    amount String Amount
    taker_fee String Taker rate
    maker_fee String Maker rate
    client_id String Client id

Example:

// Request
{
  "method": "order.subscribe",
  "params": ["BTCUSD"],
  "id": 15
}

// Response
{
  "error": null,
  " id": 4,
  "result": "success"
}
  • method: “order.subscribe”
  • Authorization: required, refer to server.sign
  • Request parameter description:
Name Type Required Description
params Array\<String\> Yes market list, market list
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "order.update", 
  "params": [
    3,
    {
      "order_id": 10,
      "position_id": 0,
      "stop_id": 1,
      "market": "BTCUSD",
      "type": 1,
      "side": 2,
      "target": 2,
      "effect_type": 1,
      "user_id": 10,
      "create_time": 102001.123,
      "update_time": 102003.123,
      "source": "API",
      "price": "9100.1",
      "amount": "100",
      "taker_fee": "0.005",
      "maker_fee": "-0.002",
      "left": "80",
      "deal_stock": "0.9",
      "deal_fee": "0.01",
      "deal_profit": "0.1",
      "last_deal_amount": "0.1",
      "last_deal_price": "9101.1",
      "last_deal_time": 111111111,
      "last_deal_id": 1,
      "last_deal_type": 1,
      "last_deal_role": 1,
      "client_id": "",
      "fee_asset": "",
      "fee_discount": "0.03",
      "deal_asset_fee": "0.01",
      "leverage": "10",
      "position_type": 1
    }
  ], 
  "id": null
}
  • method: “order.update”
  • Authorization: required, refer to server.sign
  • Push parameter description:

    Name Type Description
    params[0] Integer Event type, 1: PUT, 2: UPDATE, 3: FINISH
    order_id Integer Order id
    position_id Integer Position id
    stop_id Integer Stop order id
    market String Market name
    type Integer Order type, 1: limit order, 2: market order
    side Integer 1: sell, 2: buy
    effect_type Integer Order effective type, the default is 1
    1: always valid (GTC)
    2: immediate or cancel (IOC)
    3: fill or kill (FOK)
    user_id Integer User ID
    create_time Float Create time
    update_time Float Update time
    source String Source
    price String Price
    amount String Amount
    taker_fee String Taker rate
    maker_fee String Maker rate
    left String The remaining Unexecuted amount of the order
    deal_stock String Executed value
    deal_fee String Used trading fee
    deal_profit String Realized PNL
    last_deal_amount String Latest transaction amount
    last_deal_price String Latest transaction price
    last_deal_time Integer Latest transaction time
    last_deal_id Integer Latest txid
    last_deal_type Integer Latest position operation 1: Open position 2: Add position 3: Reduce position 4: Close position 5: Reduce position 8: Reduce position (System forced liquidation) 9: Reduce position (ADL) 10: Reduce position (TP) 11: Reduce position (SL) 12: Close position (System forced liquidation) 13: Close position (ADL) 14: Close position (TP) 15: Close position (SL)
    last_deal_role Integer Latest role 1: Maker 2: Taker
    client_id String Client id
    leverage String Margin
    position_type Integer Margin type, 1: Isolated, 2: Cross

Example:

// Request
{
  "method": "order.unsubscribe",
  "params": [],
  "id": 15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “order.unsubscribe”
  • Authorization: required, refer to server.sign
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method":"asset.query",
  "params":["BCH","BTC"],
  "id":15
}

// Response
{
  "error": null, 
  "result": {
    "BCH": {
      "available": "250",
      "frozen": "10",
      "tranfer": "10",
      "balance_total": "11",
      "margin", "10"
    },
    "BTC":{
      "available": "250",
      "frozen": "10",
      "tranfer": "10",
      "balance_total": " 11",
      "margin", "10"
    }
  },
  "id": 15
}
  • method: “asset.query”
  • Authorization: required, refer to server.sign
  • Request parameter description:
Name Type Required Description
params Array\<String\> Yes asset list, asset list
  • Return parameter description:

    Name Type Description
    available String Available amount
    frozen String Amount frozen
    tranfer String Transferable amount
    balance_total String Balance
    margin String Margin

Example:

// Request
{
  "method": "asset.subscribe",
  "params": ["BTC"],
  "id":15
}

// Response
{
  "error": null,
  " id": 4,
  "result": "success"
}
  • method: “asset.subscribe”
  • Authorization: required, refer to server.sign
  • Request parameter description:
Name Type Required Description
params Array\<String\> Yes asset list, asset list
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "asset.update", 
  "params": [
    {
      "BCH": {
        "available": "250",
        "frozen": "10",
        " tranfer": "10",
        "balance_total": "11",
        "margin", "10"
      }
    }
  ], 
  "id": null
}
  • method: “asset.update”
  • Authorization: required, refer to server.sign
  • Push parameter description:

    Name Type Description
    available String Amount available
    frozen String Amount frozen
    tranfer String Transferable amount
    balance_total String Balance
    margin String Margin

Example:

// Request

{
  "method":"asset.unsubscribe",
  "params":[],
  "id":15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “asset.unsubscribe”
  • Authorization: required, refer to server.sign
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method": "position.query",
  "params": [
    "BTCUSD"
  ],
  "id": 15
}

// Response
{
  "error": null, 
  "result": [
    {
      "position_id": 1,
      "create_time":1635760817.787848,
      "update_time":1636536470.973876,
      "market":"BTCUSDT",
      "user_id":1415,
      "type":1,
      "finish_type":1,
      "side":2,
      "sys":0,
      "amount":"2.0000",
      "amount_max":"2.0000",
      "amount_max_margin":"4000.00",
      "close_left":"2.0000",
      "settle_price": "100",
        "settle_val": "12000",
      "open_price":"40000.00",
      "open_val":"80000.00",
      "open_val_max":"80000.00",
      "open_margin":"0.050",
      "open_margin_imply":"0.00",
      "mainten_margin":"0.005",
      "mainten_margin_amount":"400.00",
      "margin_amount":"4001.00",
      "profit_real":"61270.00",
      "profit_clearing":"0",
      "adl_sort_val":"0.00049987",
      "liq_time":0,
      "liq_order_time":0,
      "liq_amount":"0.0000",
      "liq_profit":"0.00",
      "liq_order_price":"0.00",
      "take_profit_price":"0.00",
      "stop_loss_price":"0.00",
      "taker_fee":"0.00000",
      "maker_fee":"0.00000",
      "take_profit_type":0,
      "stop_loss_type":0,
      "insurance":"0.00",
      "fee_asset":"",
      "deal_asset_fee":"0",
      "leverage":"20",
      "liq_price":"38199.50",
      "bkr_price":"37999.50",
      "liq_price_imply":"0.00",
      "bkr_price_imply":"0.00",
      "profit_unreal":"0.00",
      "adl_sort":1,
      "total":1
    },
    {
      //position detail
    }
  ],
  "id": 15
}
  • method: “position.query”
  • Authorization: required, refer to server.sign
  • Request parameter description:
Name Type Required Description
params Array\<String\> Yes market list, market list
  • Return parameter description:

    Name Type Description
    position_id Integer Position id
    create_time Float Create time
    update_time Float Update time
    market String Market name
    user_id Integer User ID
    type Integer Margin type, 1: Isolated, 2: Cross
    side Integer 1: Short, 2: Long
    amount String Amount
    amount_max String ATH position amount
    amount_max_margin String Maximum margin amount
    close_left String Available Amount to Liquidate
    settle_price String Settlement Price
    settle_val String Settlement Value
    open_price String Average entry price
    open_val String Cumulative opening value
    open_val_max String Maximum opening value
    open_margin String Margin Rate
    mainten_margin String Maintenance Margin Rate
    mainten_margin_amount String Maintenance margin
    margin_amount String Margin, Initial Margin + Margin Call - Reduced Margin
    profit_real String Realized PNL
    profit_clearing String Unsettled PNL
    take_profit_price String Take-profit price
    stop_loss_price String Stop-loss price
    taker_fee String Taker fee
    maker_fee String Maker fee
    take_profit_type Integer Take-profit price type, 1: transaction price, 3: mark price
    stop_loss_type Integer Stop-loss price type, 1: transaction price, 3: mark price
    fee_asset String Payment coin deducted as trading fees
    deal_asset_fee String Trading fee
    leverage String Margin
    liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”
    bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”
    profit_unreal String Unrealized PNL
    adl_sort Integer Sort by ADL
    total Integer Number of accounts with positions

Example:

// Request
{
  "method": "position.subscribe",
  "params": [
    "BTCUSD"
  ],
  "id":15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “position.subscribe”
  • Authorization: required, refer to server.sign
  • Request parameter description:
Name Type Required Description
params Array\<String\> Yes market list, market list
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "position.update", 
  "params": [
    1,
    {
      "position_id": 1,
      "create_time":1635760817.787848,
      "update_time":1636536470.973876,
      "market":"BTCUSDT",
      "user_id":1415,
      "type":1,
      "finish_type":1,
      "side":2,
      "sys":0,
      "amount":"2.0000",
      "amount_max":"2.0000",
      "amount_max_margin":"4000.00",
      "close_left":"2.0000",
      "settle_price": "100",
        "settle_val": "12000",
      "open_price":"40000.00",
      "open_val":"80000.00",
      "open_val_max":"80000.00",
      "open_margin":"0.050",
      "open_margin_imply":"0.00",
      "mainten_margin":"0.005",
      "mainten_margin_amount":"400.00",
      "margin_amount":"4001.00",
      "profit_real":"61270.00",
      "profit_clearing":"0",
      "adl_sort_val":"0.00049987",
      "liq_time":0,
      "liq_order_time":0,
      "liq_amount":"0.0000",
      "liq_profit":"0.00",
      "liq_order_price":"0.00",
      "take_profit_price":"0.00",
      "stop_loss_price":"0.00",
      "taker_fee":"0.00000",
      "maker_fee":"0.00000",
      "take_profit_type":0,
      "stop_loss_type":0,
      "insurance":"0.00",
      "fee_asset":"",
      "deal_asset_fee":"0",
      "leverage":"20",
      "liq_price":"38199.50",
      "bkr_price":"37999.50",
      "liq_price_imply":"0.00",
      "bkr_price_imply":"0.00",
      "profit_unreal":"0.00",
      "adl_sort":1,
      "total":1
    },
    {
      //position detail
    }
  ], 
  "id": null
}
  • method: “position.update”
  • Authorization: required, refer to server.sign
  • Push parameter description:

    Name Type Description
    params[0] Integer Event 1:position update, 2:close position, 3:system close, 4:ADL, 5:liquidation, 6:liquidation alert
    position_id Integer Position id
    create_time Float Create time
    update_time Float Update time
    market String Market name
    user_id Integer User ID
    type Integer Margin type, 1: Isolated, 2: Cross
    side Integer 1: Short, 2: Long
    amount String Amount
    amount_max String ATH position amount
    amount_max_margin String Maximum margin amount
    close_left String Available Amount to Liquidate
    settle_price String Settlement Price
    settle_val String Settlement Value
    open_price String Average entry price
    open_val String Cumulative opening value
    open_val_max String Maximum opening value
    open_margin String Margin Rate
    mainten_margin String Maintenance Margin Rate
    mainten_margin_amount String Maintenance margin
    margin_amount String Margin, Initial Margin + Margin Call - Reduced Margin
    profit_real String Realized PNL
    profit_clearing String Unsettled PNL
    take_profit_price String Take-profit price
    stop_loss_price String Stop-loss price
    taker_fee String Taker fee
    maker_fee String Maker fee
    take_profit_type Integer Take-profit price type, 1: transaction price, 3: mark price
    stop_loss_type Integer Stop-loss price type, 1: transaction price, 3: mark price
    fee_asset String Payment coin deducted as trading fees
    deal_asset_fee String Trading fee
    leverage String Margin
    liq_price String Liquidation price, when the liquidation price is greater than 1000000000000, return “Infinity”
    bkr_price String Bankruptcy price, when the bankruptcy price is greater than 1000000000000, return “Infinity”
    profit_unreal String Unrealized PNL
    adl_sort Integer Sort by ADL
    total Integer Number of accounts with positions

Example:

// Request
{
  "method": "position.unsubscribe",
  "params": [],
  "id": 15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • method: “position.unsubscribe”
  • Authorization: required, refer to server.sign
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method": "bbo.subscribe",
  "params": ["BTCUSDT"],
  "id": 15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • Method: “bbo.subscribe”
  • Request parameter description:
Name Type Required Description
params Array\<String\> Yes market list, market list
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
    "market": "BTCUSDT"
    "time": 1656660154,
    "bid_price": "20000",
    "bid_amount": "0.1",
    "ask_price": "200001",
    "ask_amount": "0.15"
}
  • Method: “bbo.update”
  • Push parameter description:

    Name Type Description
    market String Market name
    time Integer Timestamp
    bid_price String Bid1 price
    bid_amount String Bid1 amount
    ask_price String Ask1 price
    ask_amount String Ask1 amount

Example:

// Request
{
  "method": "bbo.unsubscribe",
  "params": [],
  "id": 15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • Method: “bbo.unsubscribe”
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method": "market.subscribe",
  "params": [
    "BTCUSDT"
  ],
  "id":15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • Method: “market.subscribe”
  • Authorization: required, refer to server.sign
  • Request parameter description:
Name Type Required Description
params Array\<String\> Yes market list, market list
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "market.update", 
  "params": [
    {
        "market": "BTCUSDT",
        "timestamp": 1656660154,
        "index_price": "20000",
        "sign_price": "0.1"
    },
  ], 
  "id": null
}
  • Method: “market.update”
  • Authorization: required, refer to server.sign
  • Push parameter description:

    Name Type Description
    market String Market name
    timestamp Integer Timestamp
    index_price String Index Price
    sign_price String Mark Price

Example:

// Request
{
  "method": "market.unsubscribe",
  "params": [],
  "id": 15
}

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • Method: “market.unsubscribe”
  • Authorization: required, refer to server.sign
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result

Example:

// Request
{
  "method": "deals_own.subscribe",
  "params": [
    "BTCUSDT"
  ],
  "id":15
}

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • Method: “deals_own.subscribe”
  • Authorization: required, refer to server.sign
  • Request parameter description:
Name Type Required Description
params Array\<String\> No Market list, empty to subscribe to all markets
  • Return parameter description:

    Name Type Description
    result String Subscription results

Example:

// Notify
{
  "method": "deals_own.update",
  "params": [
    "BTCUSDT",
    [
      {
        "type": "sell",
        "time": 1496458040.059284,
        "price": "46444.74",
        "id": 29433,
        "amount": "0.00120000",
        "order_id": 523941,
        "client_id": ""
      }
    ]
  ],
  "id": null
}
  • Method: “deals_own.update”
  • Push parameter description:

    Name Type Description
    params[0] String Market
    type String Type, “sell”: sell, “buy”: buy
    time float Timestamp
    price String Price
    id Integer No.
    amount String Amount
    order_id Integer Order id
    client_id String Client id

Example:

// Request
{
  "method": "deals_own.unsubscribe",
  "params": [],
  "id":15
}

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • Method: “deals_own.unsubscribe”
  • Authorization: required, refer to server.sign
  • Return parameter description:

    Name Type Description
    result String Cancel subscription result
Exclusive MM Contact
Telegram @CoinExvipmanager
Email vip@coinex.com