中文
API introduction
Welcome to CoinW API!
This is the official CoinW API document, and it will be continuously updated, please stay tuned for the latest updates.
You can switch to different API business in the top menu, and switch to different language by clicking the button in the top right.
On the right side of the document are examples for request parameters and response results.
Description
1. Get Access Key and Secret Key
The Access Key and Secret Key can be obtained from API Key creation. The Access Key is for API access and the Secret Key, as a private key, is for request parameter signature. Attention! For your account security, do not disclose your keys to anyone.
2. Generate Unsigned String
HTTP Header
Param | value |
---|---|
timestamp | Timestamp |
api_key | Access Key |
sign | Encryption parameters |
The signature (sign) uses base64 + HMAC SHA256 algorithm. Use "secret_key" as the key for HMAC SHA256. After applying all other parameters as the operand, obtain the output result, then proceed with base64 encoding.
Example:
GET /v1/fapi/getStopProfit
Parameters
Param | value |
---|---|
openId | 0 |
orderId | 54635502191944903 |
instrument | BTC |
Encryption Concatenation Method:
signParam = timestamp + 'GET' + endpoint name + get request parameters
Sample:
1701944491793GET/v1/fapi/getStopProfit?orderId=54635502191944903&instrument=BTC&openId=0
Encryption:
Use "secret_key" as the key for HMAC SHA256. After applying "signParam" as the operand, obtain the output result, then proceed with base64 encoding.
Note: The timestamp value should be identical to that of the header. "GET" must be in uppercase.
POST Request Example:
POST /v1/fapi/open
Parameters
Param | value |
---|---|
direction | long |
positionModel | 0 |
positionType | execute |
instrument | ADA |
leverage | 50 |
quantityUnit | 1 |
quantity | 1 |
contractType | 1 |
Encryption Concatenation Method:
signParam = timestamp + 'POST' + endpoint name + Post body parameters
Sample:
1701945494169POST/v1/fapi/open{"leverage":"50","quantity":"1","positionType":"execute","contractType":"1","instrument":"ADA","quantityUnit":"1","positionModel":"0","direction":"long"}
Encryption:
Use "secret_key" as the key for HMAC SHA256. After applying "signParam" as the operand, obtain the output result, then proceed with base64 encoding.
Note: The timestamp value should be identical with that of the header. The "POST" must be in uppercase.
USDT-Margined Futures
Futures Open API
Check Open Orders
Check Open Orders
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/orders/open
curl "https://api.coinw.com/v1/perpum/orders/open?positionType=moveStopProfitLoss&instrument=BTC"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | true | null | Symbol |
positionType | string | true | null | plan: limit, execute: market, planTrigger: conditional, moveStopProfitLoss: trailing stop |
page | int | false | 1 | Current page |
pageSize | int | false | 50 | Current page data count |
Responses
Param | Type | Description |
---|---|---|
id | string | Position id |
userId | Long | User id |
baseSize | BigDecimal | Description |
createdDate | timestamp | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | long: open long, short: open short |
frozenFee | BigDecimal | Fees frozen for order placing |
indexPrice | BigDecimal | Index trigger price |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
liquidateBy | string | Open/close position |
margin | BigDecimal | Margin used for position |
orderPrice | BigDecimal | Order price |
orderStatus | string | unFinish: unfilled, part: partially filled, Finish: fully filled, Cancel: canceled |
originalType | string | Original order type |
posType | string | Position type: plan/planTrigger/execute |
positionMargin | BigDecimal | Position margin |
positionModel | int | Position mode: 0-isolated, 1-cross |
quantity | string | Holding contracts or amount |
quantityUnit | BigDecimal | Amount unit: 0-USDT, 1-contacts, 2-coins |
status | string | Status: Open position/close position |
takerFee | BigDecimal | Take fee rate |
totalPiece | BigDecimal | Total contracts |
updatedDate | string | Last update |
Response:
{ "code": 0, "data": { "rows": [ { "baseSize": 1, "createdDate": 1698211897000, "currentPiece": 1000, "direction": "short", "frozenFee": 44.407308, "id": 43308284486163264, "indexPrice": 33998.37, "instrument": "BTC", "leverage": 20, "liquidateBy": "manual", "makerFee": 0.0004, "margin": 1850.3045, "orderPrice": 37006.09, "orderStatus": "unFinish", "originalType": "plan", "posType": "plan", "positionMargin": 1850.3045, "positionModel": 1, "processStatus": 0, "quantity": 1000, "quantityUnit": 1, "source": "web", "status": "open", "takerFee": 0.0006, "totalPiece": 1000, "updatedDate": 1698211897000, "userId": 600003366 } ], "total": 0 }, "msg": "" }
Check Pending Order Quantity
Check Pending Order Quantity
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/orders/openQuantity
curl "https://api.coinw.com/v1/perpum/orders/openQuantity"
Parameters
Param | Type | Mandatory | Default | Description |
---|
Responses
Param | Type | Description |
---|---|---|
data | Integer | Pending orders |
Response:
{ "code": 0, "data": 0, "msg": "" }
Check Personal Transaction History
Check Personal Transaction History
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/orders/trades
curl "https://api.coinw.com/v1/perpum/orders/trades?instrument=BTC"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | true | null | Symbol |
page | int | false | 1 | Current page |
pageSize | int | false | 50 | Current page data count |
Responses
Param | Type | Description |
---|---|---|
closedPiece | integer | Closed position size |
createdDate | long | Transaction timestamp |
dealPrice | BigDecimal | Filled price |
direction | string | long: open long, short: open short |
id | long | Position id |
Response:
{ "code": 0, "data": { "rows": [{ "closedPiece": 0, "createdDate": 1698045441000, "dealPrice": 30672.18, "direction": "long", "id": 15192429605009413 }, { "closedPiece": 1000, "createdDate": 1698045360000, "dealPrice": 1000, "direction": "short", "id": 15192428913604613 } ], "total": 2 }, "msg": "" }
Check Product Information
Check Product Information
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/instruments
curl "https://api.coinw.com/v1/perpum/instruments?name=BTC"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
name | string | false | null | Symbol |
Responses
Param | Type | Description |
---|---|---|
base | string | Symbol |
defaultLeverage | Integer | Default leverage |
defaultStopLossRate | BigDecimal | Stop loss ratio |
defaultStopProfitRate | BigDecimal | Take profit ratio |
indexId | Integer | Index id: Index of underlying assets |
leverage | String | Supported leverage multipliers, e.g.: 50x, 100x, 150x |
makerFee | BigDecimal | Maker fee |
maxLeverage | Integer | Maximum leverage |
minLeverage | Integer | Minimum leverage |
maxPosition | BigDecimal | Position limit |
minSize | BigDecimal | Minimum size |
name | String | Symbol |
oneLotMargin | BigDecimal | Margin amount per contract |
oneMaxPosition | BigDecimal | Margin limit per contract |
pricePrecision | Integer | Decimal places of price |
quote | String | USDT |
settledAt | Long | Settlement time |
settlementRate | BigDecimal | Swap fees |
status | String | offline-delisted, online-listed, pretest-pending listing, settlement-settlement |
takerFee | BigDecimal | Taker Fee |
Response:
{ "code":"200", "data":{ { "base": "btc", "closeSpread": 0.0002, "commissionRate": 0.0006, "configBo": { "margins": { "100": 0.075, "5": 0.00375, "50": 0.0375, "20": 0.015, "10": 0.0075 }, "simulatedMargins": { "5": 0.00375, "20": 0.015, "10": 0.0075 } }, "createdDate": 1548950400000, "defaultLeverage": 20, "defaultStopLossRate": 0.99, "defaultStopProfitRate": 100, "indexId": 1, "leverage": [ 5, 10, 20, 50, 100, 125, 200 ], "makerFee": 0.0004, "maxLeverage": 125, "maxPosition": 20000, "minLeverage": 1, "minSize": 1, "name": "BTC", "oneLotMargin": 1, "oneLotSize": 0.001, "oneMaxPosition": 10000000, "openSpread": 0.0003, "pricePrecision": 2, "quote": "usdt", "selected": 0, "settledAt": 1698220800000, "settlementRate": 0.0004, "sort": 1, "status": "online", "stopCrossPositionRate": 0.1, "stopSurplusRate": 0.01, "takerFee": 0.0006, "updatedDate": 1679453232000 } } }, "msg":"SUCCESS" }
Check Current Funding Rate of Perpetual Contract
Check Current Funding Rate of Perpetual Contract
Request Limit
5 requests/2s
HTTP Request
GET /v1/perpum/fundingRate
curl "https://api.coinw.com/v1/perpum/fundingRate?instrument='BTC'"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | String | true | null | Symbol |
Responses
Param | Type | Description |
---|---|---|
data | BigDecimal | Funding rate |
Response:
{ "code":0, "data":0.0001, "msg":"" }
Check Server Time
Check Server Time
Request Limit
5 requests/s
HTTP Request
GET /v1/perpum/time
curl "https://api.coinw.com/v1/perpum/time"
Parameters
This endpoint does not require any parameters.
Responses
Param | Type | Description |
---|---|---|
time | Long | Timestamp |
Response:
{ "code": 0, "data": 1698719090155, "msg": "" }
Check Derivative Position Tiers
Check Derivative Position Tiers
Request Limit
5 requests/s
HTTP Request
GET /v1/perpum/ladders
curl "https://api.coinw.com/v1/perpum/ladders"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
Responses
Param | Type | Description |
---|---|---|
id | string | Tier id |
instrument | String | Symbol |
ladder | Integer | Tier |
lastLadder | boolean | The last tier or not |
marginKeepRate | BigDecimal | Maintenance margin ratio |
maxLeverage | Integer | Maximum leverage |
marginStartRate | BigDecimal | Initial margin ratio |
maxPiece | Integer | Maximum number of contracts |
Response:
{ "code": 0, "data": { "ladderConfig": [{ "ladderList": [ { "id": 238, "instrument": "BTC", "ladder": 1, "lastLadder": true, "marginKeepRate": 0.002, "marginStartRate": 0.005, "maxLeverage": 200, "maxPiece": 1000 } ], "name": "BTC" }] }, "msg": "" }
Switch Measure Unit
Switch Measure Unit
Request Limit
10 requests/s
HTTP Request
POST /v1/perpum/pieceConvert
POST "https://api.coinw.com/v1/perpum/pieceConvert"
body:
{ "convertType": 1, "dealPiece": 20000, "faceValue": 0.0001, "baseSize": 0.9 }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
convertType | Long | true | null | 1: coin, 2: contract |
dealPiece | BigDecimal | false | null | Number of contract |
faceValue | BigDecimal | true | null | Minimum face value per contract |
baseSize | BigDecimal | false | null | Face value * number of contract |
Responses
Param | Type | Description |
---|---|---|
data | BigDecimal | Result |
Response:
{ "code": 0, "data": {"value": 40000}, "msg": "" }
Check Position Information
Check Position Information
Request Limit
5 requests/s
HTTP Request
GET /v1/perpum/positions
curl "https://api.coinw.com/v1/perpum/positions?instrument=BTC&openIds=123"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | String | true | null | Symbol |
openIds | List | false | null | Opening position id, separated by commas. The total number should not exceed 20 ids. |
Responses
Param | Type | Description |
---|---|---|
id | Long | Position id |
base | string | Symbol |
baseSize | BigDecimal | Coin amount |
createdDate | timestamp | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | Side: long/short |
fee | BigDecimal | Fees |
fundingSettle | BigDecimal | Funding Fee |
indexPrice | BigDecimal | Index trigger price |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
margin | BigDecimal | Margin used for position |
orderPrice | BigDecimal | Order price |
openPrice | BigDecimal | Opening price |
originalType | string | Original order type |
posType | string | Position type: plan/planTrigger/execute |
positionMargin | BigDecimal | Position margin |
positionModel | int | Position mode: 0-isolated, 1-cross |
quantity | string | Number of contract or amount |
quantityUnit | BigDecimal | Amount unit: 0-USDT, 1-contacts, 2-coins |
status | string | Status: Open position/close position |
stopLossPrice | string | Stop loss price |
stopLossRate | string | Stop loss ratio |
stopProfitPrice | string | Take profit price |
stopProfitRate | string | Take profit ratio |
stopLossOrderPrice | string | Stop loss price |
stopProfitOrderPrice | string | Take profit price |
stopProfitType | string | Order type after conditional order of perpetual contract is triggered. plan: Limit order, execute: Market order. |
stopLossType | string | Order type after conditional order of perpetual contract is triggered. plan: Limit order, execute: Market order. |
totalPiece | BigDecimal | Total contracts |
updatedDate | string | Last update |
userId | Long | User id |
Response:
{ "code": 0, "data": [ { "base": "btc", "baseSize": 0.0330, "closedPiece": 0, "createdDate": 1718891138000, "currentPiece": 33, "direction": "long", "fee": 1.2928, "fundingSettle": -2.65378069, "id": 2435521222622111184, "indexPrice": 64830.5, "instrument": "BTC", "leverage": 20, "margin": 107.7387, "openPrice": 65296.2272727272727273, "orderPrice": 66351.3, "originalType": "plan", "posType": "execute", "positionMargin": 107.738775, "positionModel": 1, "profitReal": 0, "profitUnreal": -69.6013, "quantity": 107.738775, "quantityUnit": 0, "source": "web", "status": "open", "stopLossOrderPrice": 58000, "stopLossPrice": 60000, "stopLossRate": 1.6400346, "stopLossType": "plan", "stopProfitOrderPrice": 68000, "stopProfitPrice": 70000, "stopProfitRate": 1.4199598, "stopProfitType": "plan", "totalPiece": 33, "updatedDate": 1719195932000, "userId": 600001274 } ], "msg": "" }
Query All Positions
Query All Positions
Request Limit
1 request/5s
HTTP Request
GET /v1/perpum/positions/all
curl "https://api.coinw.com/v1/perpum/positions/all"
Parameters
Param | Type | Mandatory | Default | Description |
---|
Responses
Param | Type | Description |
---|---|---|
id | Long | Position id |
base | string | Symbol |
baseSize | BigDecimal | Coin amount |
createdDate | timestamp | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | Side: long/short |
fee | BigDecimal | Fees |
fundingSettle | BigDecimal | Funding Fee |
indexPrice | BigDecimal | Index trigger price |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
margin | BigDecimal | Margin used for position |
orderPrice | BigDecimal | Order price |
openPrice | BigDecimal | Opening price |
originalType | string | Original order type |
posType | string | Position type: plan/planTrigger/execute |
positionMargin | BigDecimal | Position margin |
positionModel | int | Position mode: 0-isolated, 1-cross |
quantity | string | Number of contract or amount |
quantityUnit | BigDecimal | Amount unit: 0-USDT, 1-contacts, 2-coins |
status | string | Status: Open position/close position |
stopLossPrice | string | Stop loss price |
stopLossRate | string | Stop loss ratio |
stopProfitPrice | string | Take profit price |
stopProfitRate | string | Take profit ratio |
stopLossOrderPrice | string | Stop loss price |
stopProfitOrderPrice | string | Take profit price |
stopProfitType | string | Order type after conditional order of perpetual contract is triggered. plan: Limit order, execute: Market order. |
stopLossType | string | Order type after conditional order of perpetual contract is triggered. plan: Limit order, execute: Market order. |
totalPiece | BigDecimal | Total contracts |
updatedDate | string | Last update |
userId | Long | User id |
Response:
{ "code": 0, "data": [ { "base": "btc", "baseSize": 0.0330, "closedPiece": 0, "createdDate": 1718891138000, "currentPiece": 33, "direction": "long", "fee": 1.2928, "fundingSettle": -2.65378069, "id": 2435521222622111184, "indexPrice": 64830.5, "instrument": "BTC", "leverage": 20, "margin": 107.7387, "openPrice": 65296.2272727272727273, "orderPrice": 66351.3, "originalType": "plan", "posType": "execute", "positionMargin": 107.738775, "positionModel": 1, "profitReal": 0, "profitUnreal": -69.6013, "quantity": 107.738775, "quantityUnit": 0, "source": "web", "status": "open", "stopLossOrderPrice": 58000, "stopLossPrice": 60000, "stopLossRate": 1.6400346, "stopLossType": "plan", "stopProfitOrderPrice": 68000, "stopProfitPrice": 70000, "stopProfitRate": 1.4199598, "stopProfitType": "plan", "totalPiece": 33, "updatedDate": 1719195932000, "userId": 600001274 } ], "msg": "" }
Check Position History
Check Position History
Request Limit
1 request/10s
HTTP Request
GET /v1/perpum/positions/history
curl "https://api.coinw.com/v1/perpum/positions/history"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | false | null | Symbol |
positionModel | string | false | null | Position mode: 0-isolated, 1-cross |
Responses
Param | Type | Description |
---|---|---|
avgOpenPrice | string | Average opening price |
completeUsdt | string | Filled amount |
direction | string | long: open long, short: open short |
entrustUsdt | string | Order amount |
fee | string | Fees |
havShortfall | boolean | Position breached or not |
indexPrice | BigDecimal | Trigger price |
instrument | string | Symbol |
leverage | string | Leverage of position |
liquidateBy | string | Root cause for position close manual: manual close of position stopProfit: take profit stopLoss: stop loss cancel: cancel stepMarginClose: partial liquidation @TODO待翻译 @TODO待翻译 @TODO待翻译 |
margin | string | Position margin |
openId | long | Open position id |
orderId | long | Order id |
orderStatus | string | unFinish: unfilled, part: partially filled, Finish: fully filled, Cancel: canceled |
originalType | string | Original order type |
positionModel | integer | Position mode: 0-isolated, 1-cross |
status | string | Status: Open position/close position |
totalPiece | string | Order contracts |
tradePiece | string | Filled contracts |
tradeStartDate | long | First execution time |
userId | long | User id |
Response:
{ "code": 0, "data": { "rows": [{ "avgOpenPrice": "30672.18", "completeUsdt": "30672.18", "direction": "long", "entrustUsdt": "30672.18", "fee": "18.4", "havShortfall": false, "indexPrice": "30672.08", "instrument": "BTC", "leverage": "5", "liquidateBy": "manual", "margin": "6134.436", "openId": 15192429609366533, "orderId": 43308284248522487, "orderStatus": "unFinish", "originalType": "execute", "positionModel": 0, "status": "open", "totalPiece": "1000", "tradePiece": "1000", "tradeStartDate": 1698045441000, "userId": 600006598 } ], "total": 4 }, "msg": "" }
Set Position Mode
Set Position Mode
Request Limit
5 requests/2s
HTTP Request
POST /v1/perpum/positions/type
POST "https://api.coinw.com/v1/perpum/positions/type"
body:
{ "layout": 0, "positionModel": 1 }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
layout | Long | true | null | 0: merge, 1: split |
positionModel | Long | true | null | Position mode: 0-isolated, 1-cross |
Responses
Param | Type | Description |
---|---|---|
data | string | Operation succeed |
Response:
{ "code": 0, "data":"TRANSACTION_SUCCESS", "msg": "" }
Check Position Mode
Check Position Mode
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/positions/type
GET "https://api.coinw.com/v1/perpum/positions/type"
Parameters
This endpoint does not require any parameters.
Responses
Param | Type | Description |
---|---|---|
layout | Integer | 0: merge, 1: split |
positionModel | Integer | Position mode: 0-isolated, 1-cross |
Response:
{ "code": 0, "data": { "layout": 1, "positionModel": 0 }, "msg": "" }
Check Max Order Contracts
Check Max Order Contracts
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/orders/maxSize
curl "https://api.coinw.com/v1/perpum/orders/maxSize?instrument=BTC&leverage=2&positionModel=1&orderPrice=0.22"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
leverage | integer | true | null | Leverage of position |
instrument | string | true | null | Symbol |
orderPrice | BigDecimal | false | null | Order price |
positionModel | integer | true | null | Position mode: 0-isolated, 1-cross |
Responses
Param | Type | Description |
---|---|---|
maxBuy | BigDecimal | Maximum available buy |
maxSell | BigDecimal | Maximum available sell |
Response:
{ "code": 0, "data": { "maxBuy": 13539, "maxSell": 13539 }, "msg": "" }
Check Max Available Contracts
Check Max Available Contracts
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/orders/availSize
curl "https://api.coinw.com/v1/perpum/orders/availSize?instrument=BTC"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | true | null | Symbol |
Responses
Param | Type | Description |
---|---|---|
availBuy | BigDecimal | Maximum size available to close |
availSell | BigDecimal | Maximum size available to close |
Response:
{ "code": 0, "data": { "availBuy": 1000, "availSell": 0 }, "msg": "" }
Check Max Transfer
Check Max Transfer
Request Limit
5 requests/s
HTTP Request
GET /v1/perpum/account/available
curl "https://api.coinw.com/v1/perpum/account/available"
Responses
Param | Type | Description |
---|---|---|
data | BigDecimal | Maximum available transfer |
Response:
{ "code": 0, "data": {"value":6576.150442}, "msg": "" }
Adjust Margin Amount
Adjust Margin Amount
Request Limit
10 requests/s
HTTP Request
POST /v1/perpum/positions/margin
POST "https://api.coinw.com/v1/perpum/positions/margin"
body:
{ "addMargin": "100", "id" : 15362255519893509, "type" : "all" }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
id | Long | true | null | Position id |
addMargin | Bigdecimal | false | null | Mandatory fields when increasing margin. The increased amount must be greater than 0. |
reduceMargin | Bigdecimal | false | null | Mandatory fields when decreasing margin. The decreased amount must be greater than 0. |
type | string | false | all | all: balance + mega coupon/almithtyGold: only mega coupon/balance: only balance |
Responses
Param | Type | Description |
---|---|---|
Response:
{ "code": 0, "msg": "成功" }
Check Leverage Multiplier
Check Leverage Multiplier
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/positions/leverage
curl "https://api.coinw.com/v1/perpum/positions/leverage"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
positionId | Long | false | null | Position id. Mandatory field when checking position leverage |
orderId | Long | false | null | Order id. Mandatory field when checking order leverage |
Responses
Param | Type | Description |
---|---|---|
data | BigDecimal | Leverage of position |
Response:
{ "code": 0, "data": { "value": 10 }, "msg": "" }
Current Fee Rate
Current Fee Rate
Request Limit
5 requests/2s
HTTP Request
GET /v1/perpum/account/fees
curl "https://api.coinw.com/v1/perpum/account/fees"
Parameters
This endpoint does not require any parameters.
Responses
Param | Type | Description |
---|---|---|
makerFee | BigDecimal | Maker fee |
takerFee | BigDecimal | Taker Fee |
userId | Long | User id |
Response:
{ "code": 0, "data": { "makerFee": 0.004, "takerFee": 0.006, "userId": 600003366 }, "msg": "" }
Place Order
Place Order
Request Limit
10 requests/s
HTTP Request
POST /v1/perpum/order
POST "https://api.coinw.com/v1/perpum/order"
body:
{"instrument":"BTC","direction":"long","leverage":20, "quantityUnit":1,"quantity":"100","positionModel":1, "positionType":"execute"}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | true | null | Symbol |
direction | string | true | null | Side: Long/short |
leverage | int | true | null | Leverage of position |
quantityUnit | int | true | null | Amount unit: 0-USDT, 1-contacts, 2-coins |
quantity | BigDecimal | true | null | Holding contracts or amount |
positionModel | int | true | null | Position mode: 0-isolated, 1-cross |
positionType | int | true | null | Order type: execute/plan/moveStop/stopProfitLoss (only available for order cancellation) |
openPrice | BigDecimal | false | null | Opening price |
stopLossPrice | BigDecimal | false | null | Stop loss price |
stopProfitPrice | BigDecimal | false | null | Take profit price |
triggerPrice | BigDecimal | false | null | Trigger price for perpetual contract trigger order |
triggerType | int | false | null | Conditional order of perpetual contract, order type upon trigger: 0-limit, 1-market. |
goldId | int | false | null | Super Bonus ID |
thirdOrderId | string | false | null | Client order ID |
useAlmightyGold | boolean | false | null | Mega coupon in use or not |
Responses
Param | Type | Description |
---|---|---|
data | Long | Order id |
Response:
{ "code": 0, "data": {"value":43308285573557893}, "msg": "" }
Bulk Place Order
Bulk Place Order
Request Limit
1 request/5s
HTTP Request
POST /v1/perpum/batchOrders
POST "https://api.coinw.com/v1/perpum/batchOrders"
body:
[{"instrument":"BTC","direction":"long","leverage":20, "quantityUnit":1,"quantity":"100","positionModel":1, "positionType":"execute"}]
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | true | null | Symbol |
direction | string | true | null | Side: Long/short |
leverage | int | true | null | Leverage of position |
quantityUnit | int | true | null | Amount unit: 0-USDT, 1-contacts, 2-coins |
quantity | BigDecimal | true | null | Holding contracts or amount |
positionModel | int | true | null | Position mode: 0-isolated, 1-cross |
positionType | int | true | null | Order type: execute/plan/moveStop/stopProfitLoss (only available for order cancellation) |
openPrice | BigDecimal | false | null | Opening price |
stopLossPrice | BigDecimal | false | null | Stop loss price |
stopProfitPrice | BigDecimal | false | null | Take profit price |
triggerPrice | BigDecimal | false | null | Trigger price for perpetual contract trigger order |
triggerType | int | false | null | Conditional order of perpetual contract, order type upon trigger: 0-limit, 1-market. |
goldId | int | false | null | Super Bonus ID |
thirdOrderId | string | false | null | Client order ID |
useAlmightyGold | boolean | false | null | Mega coupon in use or not |
Responses
Param | Type | Description |
---|---|---|
openId | Long | Order id |
thirdOrderId | string | Client order ID |
Response:
[{ "code": 0, "data": [{ 'msgCode': 0, 'openId': '54635512739464964', 'thirdOrderId': 'order1' }, { 'msgCode': 0, 'openId': '54635512739465067', 'thirdOrderId': 'order2' }], "msg": "" }]
Bulk Close Position
Bulk Close Position
HTTP Request
DELETE /v1/perpum/batchClose
DELETE "https://api.coinw.com/v1/perpum/batchClose"
body:
[{"thirdOrderId":"bab23207-aecd-1e69-41e9-c98af43ef405"}]
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
thirdOrderId | string | true | null | Client order ID |
Responses
Param | Type | Description |
---|---|---|
openId | Long | Open position id |
thirdOrderId | string | Client order ID |
Response:
{ "code": 0, "data": [ {'msgCode': 0, 'openId': '54635512739466292', 'thirdOrderId': 'order2'}, {'msgCode': 0, 'openId': '54635512739466565', 'thirdOrderId': 'order1'} ], "msg": "" }
Cancel Order
Cancel Order
Request Limit
10 requests/s
HTTP Request
DELETE /v1/perpum/order
DELETE "https://api.coinw.com/v1/perpum/order"
body:
{"id":"12893856437614597"}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
id | Long | true | null | Order id |
Response:
{ "code": 0, "msg": "Success" }
Bulk Cancel Order
Bulk Cancel Order
Request Limit
5 requests/2s
HTTP Request
DELETE /v1/perpum/batchOrders
DELETE "https://api.coinw.com/v1/perpum/batchOrders"
body:
{"posType":"plan","sourceIds":[1233213123213]}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
posType | string | true | null | Order type: execute/plan/moveStop/stopProfitLoss (only available for order cancellation) |
sourceIds | List | true | null | IDs of orders to bulk cancel, separated with ",". Maximum limit: 20 IDs. |
Responses
Response:
{ "code": 0, "msg": "" }
Modify Order
Modify Order
Request Limit
10 requests/s
HTTP Request
PUT /v1/perpum/order
PUT "https://api.coinw.com/v1/perpum/order"
body:
{ "id":43308285706896000,"instrument": "BTC", "direction": "long","leverage": 20,"quantityUnit": 1,"quantity": "1000", "positionModel": 1,"positionType": "plan","openPrice": "35526.00"}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
id | Long | true | null | ID of the order to modify |
instrument | string | true | null | Symbol |
direction | string | true | null | Side: Long/short |
leverage | int | true | null | Leverage of position |
quantityUnit | int | true | null | Amount unit: 0-USDT, 1-contacts, 2-coins |
quantity | BigDecimal | true | null | Holding contracts or amount |
positionModel | int | true | null | Position mode: 0-isolated, 1-cross |
positionType | int | true | null | Order type: execute/plan/moveStop/stopProfitLoss (only available for order cancellation) |
openPrice | BigDecimal | false | null | Opening price |
stopLossPrice | BigDecimal | false | null | Stop loss price |
stopProfitPrice | BigDecimal | false | null | Take profit price |
triggerPrice | BigDecimal | false | null | Trigger price for perpetual contract trigger order |
triggerType | int | false | null | Conditional order of perpetual contract, order type upon trigger: 0-limit, 1-market. |
goldId | int | false | null | Super Bonus ID |
feeType | int | false | null | Fee type: 1-maker, 0-taker |
orderPrice | int | false | null | Order price |
orderBookId | Long | false | null | Order id |
useAlmightyGold | boolean | false | null | Mega coupon in use or not |
Responses
Param | Type | Description |
---|---|---|
originId | Long | Id of modified order |
editId | Long | Order id |
Response:
{ "code": 0, "data": { "editId": 43308285729917609, "originId": 43308285729301175 }, "msg": "" }
Close Position
Close Position
Request Limit
10 requests/s
HTTP Request
DELETE /v1/perpum/positions
DELETE "https://api.coinw.com/v1/perpum/positions"
body:
{"positionType":"plan", "orderPrice":"73.15", "closeNum":100, "id":16006808418015237}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
positionType | String | false | execute | plan: conditional, execute: market |
closeNum | BigDecimal | false | null | Number of closed contracts. Choose either the number of closed contracts or the liquidation ratio. |
closeRate | BigDecimal | false | null | Liquidation ratio. You can choose either the liquidation ratio or the number of closed contracts. The liquidation ratio ranges from 0 to 1. For example, if you request a liquidation ratio of 0.5, 50% of the positions will be closed. |
id | Long | true | null | Position id |
orderPrice | BigDecimal | false | null | Order price |
Responses
Param | Type | Description |
---|---|---|
data | Long | Order id |
Response:
{ "code": 0, "data": { "value": 54635506469415362 }, "msg": "" }
Market Close All Positions
Market Close All Positions
Request Limit
10 requests/s
HTTP Request
DELETE /v1/perpum/allpositions
DELETE "https://api.coinw.com/v1/perpum/allpositions"
body:
{"instrument":"BTC"}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | String | true | null | Close all positions of the specified coin |
Responses
Response:
{ "code": 0, "msg": "" }
Reverse
Reverse
Request Limit
10 requests/s
HTTP Request
POST /v1/perpum/positions/reverse
POST "https://api.coinw.com/v1/perpum/positions/reverse"
body:
{"id":"12893856437614597"}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
id | Long | true | null | Position id |
Responses
Param | Type | Description |
---|---|---|
data | Long | Order id |
Response:
{ "code": 0, "data": {"value": 54635505938261257}, "msg": "" }
Get Order Information
Get Order Information
Request Limit
5 requests/s
HTTP Request
GET /v1/perpum/order
curl "https://api.coinw.com/v1/perpum/order?positionType=moveStopProfitLoss&sourceIds=15473770755361797,15474397135342597"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
sourceIds | List | false | null | Order id or Position id, separated by commas. If positionType is 'plan,' fill in the orderId parameter; if positionType is 'moveStopProfitLoss,' fill in the openId; for positionType 'planTrigger' parameters, either orderId or openId can be filled in during the request. The total number should not exceed 20. |
positionType | string | true | null | plan: limit, execute: market, planTrigger: conditional, moveStopProfitLoss: trailing stop |
instrument | string | false | null | Symbol |
Responses
Param | Type | Description |
---|---|---|
id | string | Position id |
baseSize | BigDecimal | Amount of base currency |
userId | Long | User id |
fee | BigDecimal | Fees |
createdDate | Date | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | long: open long, short: open short |
frozenFee | BigDecimal | Fees frozen for order placing |
indexPrice | BigDecimal | Index price/last price |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
liquidateBy | string | Open/close position |
makerFee | BigDecimal | Maker fee rate |
takerFee | BigDecimal | Take fee rate |
margin | BigDecimal | Margin used for position |
orderPrice | BigDecimal | Order price |
totalPiece | BigDecimal | Total contracts |
orderStatus | string | unFinish: unfilled, part: partially filled, Finish: fully filled, Cancel: canceled |
originalType | string | Original order type |
posType | string | Position type: plan/planTrigger/execute |
positionMargin | BigDecimal | Position margin |
positionModel | Integer | Position mode: 0-isolated, 1-cross |
quantity | BigDecimal | Holding contracts or amount |
quantityUnit | Integer | Amount unit: 0-USDT, 1-contacts, 2-coins |
status | string | Status: Open position/close position |
stopLossPrice | string | Stop loss price |
stopLossRate | string | Stop loss ratio |
stopProfitPrice | string | Take profit price |
stopProfitRate | string | Take profit ratio |
stopLossOrderPrice | string | Stop loss price |
stopProfitOrderPrice | string | Take profit price |
updatedDate | Date | Last update |
Response:
{ "code": 0, "data": [ { "baseSize": 1, "createdDate": 1719206268000, "currentPiece": 1000, "direction": "long", "fee": 0, "frozenFee": 24.34732, "id": 54635510840131166, "indexPrice": 62704.3, "instrument": "BTC", "leverage": 20, "liquidateBy": "manual", "makerFee": 0.0004, "margin": 3043.415, "orderPrice": 60868.3, "orderStatus": "unFinish", "originalType": "plan", "posType": "plan", "positionMargin": 3043.415, "positionModel": 1, "quantity": 1000, "quantityUnit": 1, "source": "web", "status": "open", "stopLossPrice": 55555, "stopLossRate": 1.7458348, "stopProfitPrice": 77777, "stopProfitRate": 5.5558312, "takerFee": 0.0006, "totalPiece": 1000, "updatedDate": 1719206268000, "userId": 600001274 } ], "msg": "" }
Check Order History (Last 7D)
Check Order History (Last 7D)
Request Limit
5 requests/s
HTTP Request
GET /v1/perpum/orders/history
curl "https://api.coinw.com/v1/perpum/orders/history"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | false | null | Symbol |
originType | string | false | null | Original order type: plan/planTrigger/execute |
page | int | false | 1 | Current page |
pageSize | int | false | 50 | Current page data count |
Responses
Param | Type | Description |
---|---|---|
userId | Long | User id |
baseSize | BigDecimal | Amount of base currency |
completeUsdt | BigDecimal | Filled amount (USDT) |
createdDate | Date | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | long: open long, short: open short |
entrustUsdt | BigDecimal | Order amount (USDT) |
havShortfall | boolean | Position breached or not |
indexPrice | BigDecimal | Index price/last price |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
liquidateBy | string | Open/close position |
margin | BigDecimal | Margin used for position |
openId | Long | Open position id |
orderId | Long | Order id |
orderPrice | BigDecimal | Order price |
orderStatus | string | unFinish: unfilled, part: partially filled, Finish: fully filled, Cancel: canceled |
originalType | string | Original order type |
posType | string | Position type: plan/planTrigger/execute |
positionModel | Integer | Position mode: 0-isolated, 1-cross |
quantity | BigDecimal | Holding contracts or amount |
quantityUnit | Integer | Amount unit: 0-USDT, 1-contacts, 2-coins |
status | string | Status: Open position/close position |
totalPiece | BigDecimal | Total contracts |
updatedDate | Date | Last update |
thirdOrderId | string | Client order ID |
Response:
{ "code": 0, "data": { "rows": [ { "avgPrice": "34405.09", "baseSize": "0", "completeUsdt": "34405.09", "createdDate": 1698811537000, "currentPiece": "1000", "direction": "long", "entrustUsdt": "34405.09", "havShortfall": false, "indexPrice": "34406", "instrument": "BTC", "leverage": "20", "liquidateBy": "manual", "margin": "104020.2512905500000003", "openId": 15292843354250245, "orderId": 869950880, "orderPrice": "2147483647", "orderStatus": "finish", "originalType": "execute", "posType": "execute", "positionModel": 1, "quantity": "1000", "quantityUnit": 1, "source": "web", "status": "open", "stepMarginVersion": 0, "totalPiece": "1000", "updatedDate": 1698811537000, "userId": 600003366, "thirdOrderId": "SPS_FUTURES_TG_COPY_TRADING_609283184018296197" } ], "total": 1 }, "msg": "" }
Check Order History (Last 3M)
Check Order History (Last 3M)
Request Limit
5 requests/2s
HTTP Request
GET /v1/perpum/orders/archive
curl "https://api.coinw.com/v1/perpum/orders/archive"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | false | null | Symbol |
originType | string | false | null | Original order type: plan/planTrigger/execute |
page | int | false | 1 | Current page |
pageSize | int | false | 50 | Current page data count |
Responses
Param | Type | Description |
---|---|---|
userId | Long | User id |
baseSize | BigDecimal | Amount of base currency |
completeUsdt | BigDecimal | Filled amount (USDT) |
createdDate | Date | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | long: open long, short: open short |
entrustUsdt | BigDecimal | Order amount (USDT) |
havShortfall | boolean | Position breached or not |
indexPrice | BigDecimal | Index price/last price |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
liquidateBy | string | Open/close position |
margin | BigDecimal | Margin used for position |
openId | Long | Open position id |
orderId | Long | Order id |
orderPrice | BigDecimal | Order price |
orderStatus | string | unFinish: unfilled, part: partially filled, Finish: fully filled, Cancel: canceled |
originalType | string | Original order type |
posType | string | Position type: plan/planTrigger/execute |
positionModel | Integer | Position mode: 0-isolated, 1-cross |
quantity | BigDecimal | Holding contracts or amount |
quantityUnit | Integer | Amount unit: 0-USDT, 1-contacts, 2-coins |
status | string | Status: Open position/close position |
totalPiece | BigDecimal | Total contracts |
updatedDate | Date | Last update |
thirdOrderId | string | Client order ID |
Response:
{ "code": 0, "data": { "rows": [ { "avgPrice": "34405.09", "baseSize": "0", "completeUsdt": "34405.09", "createdDate": 1698811537000, "currentPiece": "1000", "direction": "long", "entrustUsdt": "34405.09", "havShortfall": false, "indexPrice": "34406", "instrument": "BTC", "leverage": "20", "liquidateBy": "manual", "margin": "104020.2512905500000003", "openId": 15292843354250245, "orderId": 869950880, "orderPrice": "2147483647", "orderStatus": "finish", "originalType": "execute", "posType": "execute", "positionModel": 1, "quantity": "1000", "quantityUnit": 1, "source": "web", "status": "open", "stepMarginVersion": 0, "totalPiece": "1000", "updatedDate": 1698811537000, "userId": 600003366, "thirdOrderId": "SPS_FUTURES_TG_COPY_TRADING_609283184018296197" } ], "total": 1 }, "msg": "" }
Check Transaction Details (Last 3D)
Check Transaction Details (Last 3D)
Request Limit
5 requests/s
HTTP Request
GET /v1/perpum/orders/deals
curl "https://api.coinw.com/v1/perpum/orders/deals"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | false | null | Symbol |
originalType | String | false | null | Original order type: plan/planTrigger/execute |
positionModel | Integer | false | null | Position mode: 0-isolated, 1-cross |
page | int | false | 1 | Current page |
pageSize | int | false | 50 | Current page data count |
Responses
Param | Type | Description |
---|---|---|
closePrice | BigDecimal | Closing price |
userId | Long | User id |
closedPiece | BigDecimal | Closed position size |
createdDate | Date | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | long: open long, short: open short |
fee | BigDecimal | Fees |
feeRate | BigDecimal | Fee rate |
fundingSettle | BigDecimal | Settlement amount at funding rate |
indexPrice | BigDecimal | Index price/last price |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
liquidateBy | string | Open/close position |
margin | BigDecimal | Margin used for position |
netProfit | BigDecimal | Net profit |
openId | Long | Open position id |
openPrice | BigDecimal | Opening price |
orderId | Long | Order id |
orderPrice | BigDecimal | Order price |
orderStatus | string | finish: fully filled, cancel: cancelled, part: partially filled |
originalType | string | Original order type |
positionMargin | BigDecimal | Position margin |
positionModel | Integer | Position mode: 0-isolated, 1-cross |
quantity | BigDecimal | Holding contracts or amount |
quantityUnit | Integer | Amount unit: 0-USDT, 1-contacts, 2-coins |
settlementId | Long | Counterparty id |
status | string | open: open, close: closed, cancel: cancelled |
takerMaker | Integer | 1-taker, 2-maker |
totalPiece | BigDecimal | Total contracts |
updatedDate | Date | Last update |
thirdOrderId | string | Client order ID |
Response:
{ "code": 0, "data": { "rows": [ { "baseSize": 1, "closePrice": 0, "closedPiece": 0, "createdDate": 1698811537000, "currentPiece": 1000, "direction": "long", "fee": 20.643054, "feeRate": 0.0006, "fundingSettle": 0, "id": 15292843350669317, "indexPrice": 34406, "instrument": "BTC", "leverage": 20, "liquidateBy": "manual", "margin": 1720.2545, "netProfit": 0, "openId": 15292843354250245, "openPrice": 34405.09, "orderId": 43308285545895163, "orderPrice": 2147483647, "orderStatus": "finish", "originalType": "execute", "positionMargin": 1720.2545, "positionModel": 1, "processStatus": 1, "quantity": 1720.2545, "quantityUnit": 1, "settlementId": 600003487, "source": "web", "status": "open", "takerMaker": 1, "totalPiece": 1000, "updatedDate": 1698811537000, "userId": 600003366, "thirdOrderId": "SPS_FUTURES_TG_COPY_TRADING_609283184018296197" } ], "total": 1 }, "msg": "" }
Check Transaction Details (Last 3M)
Check Transaction Details (Last 3M)
Request Limit
5 requests/2s
HTTP Request
GET /v1/perpum/orders/deals/history
curl "https://api.coinw.com/v1/perpum/orders/deals/history"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | false | null | Symbol |
originalType | String | false | null | Original order type: plan/planTrigger/execute |
positionModel | Integer | false | null | Position mode: 0-isolated, 1-cross |
page | int | false | 1 | Current page |
pageSize | int | false | 50 | Current page data count |
Responses
Param | Type | Description |
---|---|---|
closePrice | BigDecimal | Closing price |
closedPiece | BigDecimal | Closed position size |
createdDate | Date | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | long: open long, short: open short |
fee | BigDecimal | Fees |
feeRate | BigDecimal | Fee rate |
fundingSettle | BigDecimal | Settlement amount at funding rate |
indexPrice | BigDecimal | Index price/last price |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
liquidateBy | string | Open/close position |
margin | BigDecimal | Margin used for position |
netProfit | BigDecimal | Net profit |
openId | Long | Open position id |
openPrice | BigDecimal | Opening price |
orderId | Long | Order id |
orderPrice | BigDecimal | Order price |
orderStatus | string | finish: fully filled, cancel: cancelled, part: partially filled |
originalType | string | Original order type |
positionMargin | BigDecimal | Position margin |
positionModel | Integer | Position mode: 0-isolated, 1-cross |
quantity | BigDecimal | Holding contracts or amount |
quantityUnit | Integer | Amount unit: 0-USDT, 1-contacts, 2-coins |
settlementId | Long | Counterparty id |
status | string | open: open, close: closed, cancel: cancelled |
takerMaker | Integer | 1-taker, 2-maker |
totalPiece | BigDecimal | Total contracts |
updatedDate | Date | Last update |
userId | Long | User id |
thirdOrderId | string | Client order ID |
Response:
{ "code": 0, "data": { "rows": [ { "baseSize": 1, "closePrice": 0, "closedPiece": 0, "createdDate": 1698811537000, "currentPiece": 1000, "direction": "long", "fee": 20.643054, "feeRate": 0.0006, "fundingSettle": 0, "indexPrice": 34406, "instrument": "BTC", "leverage": 20, "liquidateBy": "manual", "margin": 1720.2545, "netProfit": 0, "openId": 15292843354250245, "openPrice": 34405.09, "orderId": 43308285545895163, "orderPrice": 2147483647, "orderStatus": "finish", "originalType": "execute", "positionMargin": 1720.2545, "positionModel": 1, "processStatus": 1, "quantity": 1720.2545, "quantityUnit": 1, "settlementId": 600003487, "source": "web", "status": "open", "takerMaker": 1, "totalPiece": 1000, "updatedDate": 1698811537000, "userId": 600003366, "thirdOrderId": "SPS_FUTURES_TG_COPY_TRADING_609283184018296197" } ], "total": 1 }, "msg": "" }
Check Position Margin Ratio
Check Position Margin Ratio
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/positions/marginRate
curl "https://api.coinw.com/v1/perpum/positions/marginRate?positionId=43308284486163264"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
positionId | Long | true | null | Position id. Fill in the parameter when checking isolated margin. |
Responses
Param | Type | Description |
---|---|---|
data | BigDecimal | Margin ratio |
Response:
{ "code": 0, "data": { "value": 0.1 }, "msg": "" }
Check Take Profit & Stop Loss Info
Check Take Profit & Stop Loss Info
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/TPSL
curl "https://api.coinw.com/v1/perpum/TPSL"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
orderId | Long | false | null | Order id |
openId | Long | false | null | Position id |
planOrderId | Long | false | null | Conditional order ID |
stopFrom | Integer | true | null | Order type after take profit/stop loss is triggered. 1: Limit order, 2: Position, 3: Conditional order. |
instrument | string | false | null | Symbol |
Responses
Param | Type | Description |
---|---|---|
currentPiece | BigDecimal | Actual number of contracts placed for take profit/stop loss |
closePiece | BigDecimal | Number of contracts for take profit/stop loss (required for partial take profit/stop loss). |
direction | string | Side: Long/short |
createdDate | Date | Time of creation |
updatedDate | Date | Last update |
id | string | Order id |
indexPrice | BigDecimal | Trigger price for perpetual contract trigger order |
instrument | string | Symbol |
leverage | Integer | Leverage of position |
openId | long | Open position id |
priceType | Integer | Triggered type of price for take profit/stop loss. 1: Index price, 2: Last price, 3: Mark price. |
stopLossPrice | BigDecimal | Stop loss price |
stopLossRate | BigDecimal | Stop loss ratio |
stopProfitPrice | BigDecimal | Take profit price |
stopProfitRate | BigDecimal | Take profit ratio |
stopLossOrderPrice | string | Stop loss price |
stopProfitOrderPrice | string | Take profit price |
stopProfitType | string | Order type after conditional order of perpetual contract is triggered. plan: Limit order, execute: Market order. |
stopLossType | string | Order type after conditional order of perpetual contract is triggered. plan: Limit order, execute: Market order. |
triggerStatus | Integer | Trigger status of take profit/stop loss. 0: Not triggered, 1: Triggered, 2: Canceled. |
userId | long | User id |
Response:
{ "code": 0, "data": [ { "currentPiece": 0, "closePiece": 0, "createdDate": "2024-06-24T19:26:48", "currentPiece": 0, "direction": "long", "id": 54635510847765156, "indexPrice": 3311.61, "instrument": "ETH", "leverage": 20, "openId": 2435521222622111253, "priceType": 1, "stopLossPrice": 2000, "stopLossRate": 7.8637614, "stopLossType": "execute", "stopProfitPrice": 4000, "stopProfitRate": 4.2724774, "stopProfitType": "execute", "stopType": 1, "triggerStatus": 0, "updatedDate": "2024-06-24T19:26:48", "userId": 600001274 } ], "msg": "" }
Set Take Profit&Stop Loss
Set Take Profit&Stop Loss
Request Limit
5 requests/s
HTTP Request
POST /v1/perpum/TPSL
POST "https://api.coinw.com/v1/perpum/TPSL"
body:
{"id":123456789, "stopProfitPrice":0.2, "stopLossPrice":0.1, "stopProfitOrderPrice":0.3, "stopLossOrderPrice":0.05}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
id | Long | true | null | Order id |
instrument | string | false | null | Symbol |
stopLossOrderPrice | BigDecimal | false | null | Stop loss limit price |
stopProfitOrderPrice | BigDecimal | false | null | Take profit limit price |
stopLossPrice | BigDecimal | false | null | Stop loss price |
stopProfitPrice | BigDecimal | false | null | Take profit price |
stopLossRate | BigDecimal | false | null | Stop loss ratio |
stopProfitRate | BigDecimal | false | null | Take profit ratio |
Responses
Param | Type | Description |
---|---|---|
Response:
{ "code": 0, "msg": "成功" }
Add Partial Take Profit/Stop Loss
Add Partial Take Profit/Stop Loss
HTTP Request
POST /v1/perpum/addTpsl
POST "https://api.coinw.com/v1/perpum/addTpsl"
body:
{ "stopProfitPrice": 4400, "stopLossPrice": 2200, "priceType": 1, "id":2435521222622111253, "stopFrom": 2, "stopType": 1, "closePiece": 20 }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
id | Long | true | null | Order ID/Position ID/Conditional order ID |
instrument | string | false | null | Symbol |
stopLossOrderPrice | BigDecimal | false | null | Stop loss limit price |
stopProfitOrderPrice | BigDecimal | false | null | Take profit limit price |
stopLossPrice | BigDecimal | false | null | Stop loss price |
stopProfitPrice | BigDecimal | false | null | Take profit price |
stopLossRate | BigDecimal | false | null | Stop loss ratio |
stopProfitRate | BigDecimal | false | null | Take profit ratio |
priceType | Integer | false | 2 | Triggered type of price for take profit/stop loss. 1: Index price, 2: Last price, 3: Mark price. |
stopFrom | Integer | true | null | Order type after take profit/stop loss is triggered. 1: Limit order, 2: Position, 3: Conditional order. |
stopType | Integer | false | 1 | Type of take profit/stop loss. 1: Partial take profit/stop loss, 2: Entire position take profit/stop loss. |
closePiece | BigDecimal | false | null | Number of contracts for take profit/stop loss (required for partial take profit/stop loss). |
Responses
Param | Type | Description |
---|---|---|
Response:
{ "code": 0, "msg": "" }
Modify Partial Take Profit/Stop Loss
Modify Partial Take Profit/Stop Loss
HTTP Request
POST /v1/perpum/updateTpsl
POST "https://api.coinw.com/v1/perpum/updateTpsl"
body:
{ "stopProfitPrice": 70000, "stopLossPrice": 66000, "stopProfitOrderPrice": 68000, "stopLossOrderPrice": 58000, "stopFrom": 3, "id": 54635510847765222 }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
id | Long | true | null | Order ID/Position ID/Conditional order ID |
instrument | string | false | null | Symbol |
stopLossOrderPrice | BigDecimal | false | null | Stop loss limit price |
stopProfitOrderPrice | BigDecimal | false | null | Take profit limit price |
stopLossPrice | BigDecimal | false | null | Stop loss price |
stopProfitPrice | BigDecimal | false | null | Take profit price |
stopLossRate | BigDecimal | false | null | Stop loss ratio |
stopProfitRate | BigDecimal | false | null | Take profit ratio |
stopFrom | Integer | true | null | Order type after take profit/stop loss is triggered. 1: Limit order, 2: Position, 3: Conditional order. |
priceType | Integer | false | 2 | Triggered type of price for take profit/stop loss. 1: Index price, 2: Last price, 3: Mark price. |
stopType | Integer | false | 1 | Type of take profit/stop loss. 1: Partial take profit/stop loss, 2: Entire position take profit/stop loss. |
closePiece | BigDecimal | false | null | Number of contracts for take profit/stop loss (required for partial take profit/stop loss). |
Responses
Param | Type | Description |
---|---|---|
Response:
{ "code": 0, "msg": "" }
Check Trailing Take Profit & Stop Loss Info
Check Trailing Take Profit & Stop Loss Info
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/moveTPSL
curl "https://api.coinw.com/v1/perpum/moveTPSL"
Parameters
This endpoint does not require any parameters.
Responses
Param | Type | Description |
---|---|---|
baseSize | BigDecimal | Amount of base currency |
callbackRate | BigDecimal | Callback rate |
createdDate | Date | Time of creation |
currentPiece | BigDecimal | Current number of contract |
direction | string | long: open long, short: open short |
fee | BigDecimal | Fees |
instrument | string | Symbol |
leverage | BigDecimal | Leverage of position |
margin | BigDecimal | Margin used for position |
openId | Long | Open position id |
openPrice | BigDecimal | Opening price |
orderPrice | BigDecimal | Order price |
originalType | string | Original order type |
posType | string | Position type: plan/planTrigger/execute |
positionModel | Integer | Position mode: 0-isolated, 1-cross |
positionMargin | BigDecimal | Position margin |
quantity | BigDecimal | Holding contracts or amount |
quantityUnit | Integer | Amount unit: 0-USDT, 1-contacts, 2-coins |
status | string | Status: Open position/close position |
triggerPrice | BigDecimal | Trigger price for perpetual contract trigger order |
triggerType | string | Description |
updatedDate | Date | Last update |
Response:
{ "code": 0, "data": [ { "baseSize": 1.498, "callbackRate": 0.1, "createdDate": 1698735239000, "currentPiece": 1498, "direction": "long", "fee": 0, "finishStatus": 0, "id": "15282842783198213", "instrument": "BTC", "leverage": 20, "margin": 2554.60131499, "openId": "15204342474606597", "openPrice": 34106.8266355140186915, "orderPrice": 0, "originalType": "moveStopProfitLoss", "posType": "moveStopProfitLoss", "positionMargin": 2554.60131499, "positionModel": 1, "processStatus": 0, "quantity": 1498, "quantityUnit": 1, "source": "web", "status": "close", "triggerPrice": 34300, "triggerType": 0, "updatedDate": 1698735239000, "userId": 600003366, "version": 0 } ], "msg": "" }
Set Trailing Take Profit&Stop Loss
Set Trailing Take Profit&Stop Loss
Request Limit
5 requests/s
HTTP Request
POST /v1/perpum/moveTPSL
POST "https://api.coinw.com/v1/perpum/moveTPSL"
body:
{"openId":"15298194375859205", "callbackRate":0.1, "triggerPrice":"35800", "quantity":"500"}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
openId | Long | true | null | Position id |
callbackRate | BigDecimal | true | null | Callback rate |
triggerPrice | BigDecimal | false | null | Activation price |
quantity | BigDecimal | true | null | Position size (cont/USDT) |
quantityUnit | int | false | null | Size unit: 0-USDT, 1-contract |
Responses
Param | Type | Description |
---|
Response:
{ "code": 0, "msg": "" }
Check Futures Mega Coupon Info
Check Futures Mega Coupon Info
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/account/almightyGoldInfo
curl "https://api.coinw.com/v1/perpum/account/almightyGoldInfo"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
startTime | Long | false | null | Start time of validity period |
endTime | Long | false | null | End time of validity period |
type | Integer | false | 1,2 | 0-pending activation, 1-unused, 2-used, 3-expired, 4-failed to issue |
Responses
Param | Type | Description |
---|---|---|
id | Long | Mega coupon id |
assetsOut | Integer | Validity for out-transferred mega coupon: 1-expired, 2-active |
agRecordId | Integer | Mega coupon distribution spreadsheet id |
kyc | Integer | Identity verification requirement: 1-required, 2-not required |
currentAmount | BigDecimal | Remaining amount of mega coupon |
totalAmount | BigDecimal | Total amount of mega coupon |
type | Integer | 0-pending activation, 1-unused, 2-used, 3-expired, 4-failed to issue |
startTime | Date | Start time of validity period |
endTime | Date | End time of validity period |
remark | String | Remarks |
createdDate | Date | Time of creation |
updateDate | Date | Last update |
userId | Long | User id |
Response:
{ "code": 0, "data": [ { "agRecordId": 69, "assetsOut": 0, "createdDate": 1698650673000, "currentAmount": 1, "endTime": 1698909873000, "id": 70, "kyc": 0, "name": "万能金", "processStatus": 0, "startTime": 1698650673000, "totalAmount": 1, "type": 1, "updateDate": 1698650673000, "remark": '备注', "userId": 600003366 } ], "msg": "" }
Set Futures Mega Coupon Status
Set Futures Mega Coupon Status
Request Limit
5 requests/s
HTTP Request
POST /v1/perpum/account/almightyGoldInfo
POST "https://api.coinw.com/v1/perpum/account/almightyGoldInfo"
body:
{"status":"1"}
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
status | string | true | null | Status: 1-on, 2-off |
Responses
Param | Type | Description |
---|
Response:
{ "code": 0, "msg": "" }
Get Assets
Get Assets
Request Limit
10 requests/s
HTTP Request
GET /v1/perpum/account/getUserAssets
curl "https://api.coinw.com/v1/perpum/account/getUserAssets"
Parameters
Param | Type | Mandatory | Default | Description |
---|
Responses
Param | Type | Description |
---|---|---|
availableMargin | BigDecimal | Available margin (mega coupon included) |
userId | Long | User id |
almightyGold | BigDecimal | Available mega coupon |
availableUsdt | BigDecimal | Available USDT balance |
alMargin | BigDecimal | Holding assets |
alFreeze | BigDecimal | Frozen assets |
time | Long | Timestamp |
Response:
{ "code": 0, "data": [{ availableMargin=996660.6064387699998485, userId=600001274, almightyGold=0, availableUsdt=996660.6064387699998485, alMargin=10000, alFreeze=10000, time=1705785391000 }], "msg": "" }
Check All Tickers' Market Data
Check All Tickers' Market Data
Request Limit
5 requests/s
HTTP Request
GET /v1/perpumPublic/tickers
curl "https://api.coinw.com/v1/perpumPublic/tickers"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
Responses
Param | Type | Description |
---|---|---|
contract_id | Integer | Contract id |
name | string | Ticker symbol |
base_coin | string | Coin |
quote_coin | string | USDT |
price_coin | string | Coin |
max_leverage | int | Maximum leverage |
contract_size | BigDecimal | Minimum face value per contract |
last_price | BigDecimal | Last price |
high | BigDecimal | Highest price |
low | BigDecimal | Lowest price |
rise_fall_rate | BigDecimal | Change |
total_volume | BigDecimal | Trading amount |
fair_price | BigDecimal | Index price |
Response:
{ "code": 0, "data": [{ "fair_price": 16554.28, "max_leverage": 125, "total_volume": 0.0, "price_coin": "btc", "contract_id": 1, "base_coin": "btc", "high": 34739.22, "rise_fall_rate": 0.010114, "low": 34041.9, "name": "BTCUSDT", "contract_size": 0.001, "quote_coin": "usdt", "last_price": 34497.3 }], "msg": "" }
Check Kline Data
Check Kline Data
Request Limit
5 requests/s
HTTP Request
GET /v1/perpumPublic/klines
curl "https://api.coinw.com/v1/perpumPublic/klines?currencyCode=btc&granularity=3&limit=100"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
currencyCode | string | true | null | Symbol |
granularity | string | false | 1 | Type: 0(1min)/1(5min)/2(15min)/3(1hour)/4(4hour)/5(1day)/6(1week)/7(3min)/8(30min)/9(1month) |
limit | integer | false | 100 | Number of returned K line data (upper limit: 300) |
Responses
Param | Type | Description |
---|---|---|
long | Timeframe for K line | |
BigDecimal | Highest price | |
BigDecimal | Opening price | |
BigDecimal | Lowest price | |
BigDecimal | Closing price | |
BigDecimal | Transaction amount (coin amount) |
Response:
{ "code": 0, "data": [ [1698736500000, 34288.31, 34306.92, 34173.8, 34199.18, 69.0], [1698737400000, 34199.18, 34199.2, 34090.4, 34183.3, 290.63], [1698738300000, 34183.3, 34184.7, 34134.1, 34151.9, 60.42], [1698739200000, 34151.9, 34221.4, 34041.9, 34215.8, 233.91] ], "msg": "" }
Check Single Ticker's Market Data
Check Single Ticker's Market Data
Request Limit
5 requests/s
HTTP Request
GET /v1/perpumPublic/ticker
curl "https://api.coinw.com/v1/perpumPublic/ticker?instrument=BTC"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
instrument | string | true | null | Symbol |
Responses
Param | Type | Description |
---|---|---|
contract_id | Integer | Contract id |
name | string | Ticker symbol |
base_coin | string | Coin |
quote_coin | string | USDT |
price_coin | string | Coin |
max_leverage | int | Maximum leverage |
contract_size | BigDecimal | Minimum face value per contract |
last_price | BigDecimal | Last price |
high | BigDecimal | Highest price |
low | BigDecimal | Lowest price |
rise_fall_rate | BigDecimal | Change |
total_volume | BigDecimal | Trading amount |
fair_price | BigDecimal | Index price |
Response:
{ "code": 0, "data": [{ "fair_price": 16554.28, "max_leverage": 125, "total_volume": 0.0, "price_coin": "btc", "contract_id": 1, "base_coin": "btc", "high": 34739.22, "rise_fall_rate": 0.010114, "low": 34041.9, "name": "BTCUSDT", "contract_size": 0.001, "quote_coin": "usdt", "last_price": 34497.3 }], "msg": "" }
Check Public Transactions
Check Public Transactions
Request Limit
5 requests/2s
HTTP Request
GET /v1/perpumPublic/trades
curl "https://api.coinw.com/v1/perpumPublic/trades?base=BTC"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
base | string | true | null | Symbol |
Responses
Param | Type | Description |
---|---|---|
createdDate | long | Transaction timestamp |
piece | string | Number of contract |
direction | string | Side: long/short |
price | string | Filled price |
quantity | string | Coin amount |
id | long | Primary key |
Response:
{ "code": 0, "data": [{ "createdDate": 1698825519134, "direction": "short", "id": 15294675954284549, "piece": "8", "price": "34470", "quantity": "0.008" }, { "createdDate": 1698825517199, "direction": "short", "id": 15294675707344901, "piece": "9", "price": "34470.08", "quantity": "0.009" }], "msg": "" }
Get Depths
Get Depths
Request Limit
5 requests/2s
HTTP Request
GET /v1/perpumPublic/depth
curl "https://api.coinw.com/v1/perpumPublic/depth?base=LTC"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
base | string | true | null | Symbol |
Responses
Param | Type | Description |
---|---|---|
List | asks | Sell/short depth |
List | bids | Buy/long depth |
BigDecimal | m | Amount |
BigDecimal | p | Price |
Response:
{ "code": 0, "data": { "asks": [ { "m": 369.5, "p": 73.48 }, { "m": 891.2, "p": 73.54 }, ], "bids": [ { "m": 717.6, "p": 73.42 }, { "m": 414.5, "p": 73.39 }, ], "n": "ltc", "t": null }, "msg": "" }
Subscribe Market Data
Subscribe Market Data
Request Limit
3 requests/s per IP
Websocket Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "pairCode": "BTC", "type": "ticker_swap" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | String | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- pairCode | String | true | null | Symbol |
-- biz | String | true | futures | Channel |
-- type | String | true | ticker_swap | Market data |
Request Response:
{ "biz":"futures", "pairCode": "BTC", "data":{"result":true}, "channel":"subscribe", "type":"ticker_swap" }
Responses
Param | Type | Description |
---|---|---|
biz | string | Channel |
type | string | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
pairCode | String | Symbol |
biz | String | Channel |
type | String | ticker_swap (fixed value) |
data | ||
-- high | String | Highest price |
-- vol | String | Trading volume (coin) |
-- volUsdt | String | Trading volume (USDT) |
-- last | String | Last price |
-- low | String | Lowest price |
-- changeRate | String | Change |
-- type | String | Type |
-- currencyCode | String | Symbol |
-- open | String | Opening price |
Response:
{ "biz": "futures", "pairCode": "MATIC", "data": { "high": "0.7742", "vol": "0.0", "volUsdt": "0.00", "last": "0.7742", "low": "0.7742", "changeRate": "0.0", "type": "MARKET", "currencyCode": "matic", "open": "0.7742" }, "type": "ticker_swap" }
Subscribe Depth
Subscribe Depth
Request Limit
3 requests/s per IP
Depth Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "pairCode": "BTC", "type": "depth" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | string | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- pairCode | string | true | null | Symbol |
-- biz | string | true | futures | Channel |
-- type | string | true | depth | Depth level |
Request Response:
{ "biz":"futures", "pairCode": "BTC", "data":{"result":true}, "channel":"subscribe", "type":"depth" }
Responses
Param | Type | Description |
---|---|---|
biz | string | Channel |
type | string | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
biz | string | Channel |
pairCode | string | Symbol |
type | string | ticker_swap (fixed value) |
zip | string | Compressed or not |
data | ||
ask | List | Sell/short depth |
bids | List | Buy/long depth |
-- p | BigDecimal | Price |
-- m | BigDecimal | Amount |
-- n | String | Symbol |
-- r | String | Change |
Response:
{ "biz": "futures", "pairCode": "SKL", "data": { "asks": [ { "p": 0.02041, "m": 7954 }, { "p": 0.02062, "m": 1823 } ], "bids": [ { "p": 0.02037, "m": 8337 }, { "p": 0.02017, "m": 12917 } ], "n": "skl", "r":0.0001, }, "type": "depth" }
Subscribe Transaction Data
Subscribe Transaction Data
Request Limit
3 requests/s per IP
Transaction Data Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "pairCode": "BTC", "type": "fills" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | String | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- pairCode | String | true | null | Symbol |
-- biz | String | true | futures | Channel |
-- type | String | true | fills | Transaction data |
Request Response:
{ "biz":"futures", "pairCode": "BTC", "data":{"result":true}, "channel":"subscribe", "type":"fills" }
Responses
Param | Type | Description |
---|---|---|
biz | string | Channel |
type | string | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
pairCode | String | Symbol |
type | String | ticker_swap (fixed value) |
data | ||
-- createdDate | Date | Time of creation |
-- quantity | BigDecimal | Transaction amount (coin amount) |
-- piece | BigDecimal | Number of contract |
-- price | BigDecimal | Price |
-- id | Long | Order id |
-- direction | String | Opening direction: long-bullish, short-bearish |
Response:
{ "biz": "futures", "pairCode": "EOS", "data": [ { "createdDate": 1713172990620, "quantity": 6, "piece": 6, "price": 0.8058, "id": 17175227743582213, "direction": "short" } ], "type": "fills" }
Subscribe Klines
Subscribe Klines
Request Limit
3 requests/s per IP
Kline Data Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "pairCode": "BTC", "type": "candles_swap", "interval":"15" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | String | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- pairCode | String | true | null | Symbol |
-- biz | String | true | futures | Channel |
-- type | String | true | candles_swap | Kline |
-- interval | String | true | null | Type: 1S(1sec)/15S(15sec) 1(1min)/3(3min)/5(5min)/15(15min) 30(30min)/1H(1hour)/4H(4hour) 1D(1day)/1W(1week)/1M(1month) |
Request Response:
{ "biz":"futures", "pairCode": "BTC", "data":{"result":true}, "channel":"subscribe", "type":"candles_swap" }
Responses
Param | Type | Description |
---|---|---|
biz | string | Channel |
type | string | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
pairCode | String | Symbol |
type | String | ticker_swap (fixed value) |
data | List | |
-- createdDate | BigDecimal | Time of creation |
-- open | BigDecimal | Opening price |
-- high | BigDecimal | Highest price |
-- low | BigDecimal | Lowest price |
-- close | BigDecimal | Closing price |
-- volume | BigDecimal | Trading amount |
interval | String | Type: 1S(1sec)/15S(15sec) 1(1min)/3(3min)/5(5min)/15(15min) 30(30min)/1H(1hour)/4H(4hour) 1D(1day)/1W(1week)/1M(1month) |
Response:
{ "biz": "futures", "pairCode": "BTC", "data": [ "1714492800000", "60779.2", "77997.9", "56580.5", "67759.8", "913220.0140000001" ], "interval": "15", "type": "candles_swap" }
Subscribe Orders
Subscribe Orders
Request Limit
3 requests/s per IP
Websocket Order Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "type": "order" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | String | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- biz | String | true | futures | Channel |
-- type | String | true | order | ticker_swap (fixed value) |
Request Response:
{ "biz":"futures", "data":{"result":true}, "channel":"subscribe", "type":"order" }
Responses
Param | Type | Description |
---|---|---|
biz | string | Channel |
type | string | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
pairCode | String | Symbol |
type | String | ticker_swap (fixed value) |
data | ||
-- currentPiece | string | Current number of contract |
-- leverage | int | Leverage of position |
-- originalType | String | Original order type |
-- frozenFee | string | Fees frozen for order placing |
-- orderStatus | String | unFinish: unfilled, part: partially filled, Finish: fully filled, Cancel: canceled |
-- instrument | String | Symbol |
-- quantityUnit | string | Amount unit: 0-USDT, 1-contacts, 2-coins |
-- source | String | Source |
-- updatedDate | long | Last update |
-- positionModel | int | Position mode: 0-isolated, 1-cross |
-- posType | string | Position type: plan/planTrigger/execute |
-- baseSize | string | Order time/open/close/high/low/volume |
-- liquidateBy | string | Open/close position |
-- makerFee | string | Maker fee rate |
-- totalPiece | string | Total contracts |
-- orderPrice | string | Closing price |
-- id | string | Order ID |
-- direction | string | Opening direction: long-bullish, short-bearish |
-- margin | string | Margin used for position |
-- indexPrice | string | Last price |
-- quantity | string | Holding contracts or amount |
-- takerFee | string | Take fee rate |
-- userId | string | User id |
-- createdDate | long | Time of creation |
-- positionMargin | string | Maintenance margin |
-- status | string | open: open, close: closed, cancel: cancelled |
Response:
{ "biz": "futures", "pairCode": "ETH", "data": [ { "currentPiece": "500", "leverage": "20", "originalType": "execute", "frozenFee": "7.94787", "orderStatus": "unFinish", "instrument": "ETH", "quantityUnit": 1, "source": "api", "updatedDate": 1729571516533, "positionModel": 0, "posType": "execute", "baseSize": "5", "liquidateBy": "manual", "makerFee": "0.0001", "totalPiece": "500", "thirdOrderId": "cw11838562736557002753", "orderPrice": "0", "id": "54635513431661205", "direction": "long", "margin": "662.3225", "indexPrice": "2630.87", "quantity": "500", "takerFee": "0.0003", "userId": "600001274", "createdDate": 1729571516533, "positionMargin": "0", "status": "open" } ], "type": "order" }
Subscribe Positions
Subscribe Positions
Request Limit
3 requests/s per IP
Websocket Position Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "type": "position" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | String | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- biz | String | true | futures | Channel |
-- type | String | true | position | ticker_swap (fixed value) |
Request Response:
{ "biz":"futures", "data":{"result":true}, "channel":"subscribe", "type":"position" }
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
type | String | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
pairCode | String | Symbol |
type | String | ticker_swap (fixed value) |
data | ||
-- baseSize | string | Number of tokens |
-- closedPiece | string | Closed contracts |
-- closedQuantity | string | Closed size |
-- createdDate | long | Time of creation |
-- currentPiece | string | Current number of contract |
-- direction | String | long: open long, short: open short |
-- fee | string | Fees |
-- fundingSettle | string | Settlement amount at funding rate |
-- id | string | Position id |
-- indexPrice | string | Index trigger price |
-- instrument | String | Symbol |
-- isProfession | int | Professional order: 0-No, 1-Yes. |
-- leaderId | string | Trader ID |
-- leverage | int | Leverage of position |
-- margin | string | Margin used for position |
-- openPrice | string | Opening price |
-- orderPrice | string | Closing price |
-- originalType | String | Original order type |
-- parentId | string | Registered user (invitee) ID, where 0 indicates users who registered voluntarily and were not invited. |
-- partnerId | string | Partner ID |
-- posType | String | Position type: plan/planTrigger/execute |
-- positionMargin | string | Maintenance margin |
-- positionModel | int | Position mode: 0-isolated, 1-cross |
-- processStatus | int | Processing status: 0-Normal, 1-In process |
-- quantity | string | Holding contracts or amount |
-- quantityUnit | string | Amount unit: 0-USDT, 1-contacts, 2-coins |
-- remainCurrentPiece | string | Remaining contracts |
-- settlementId | string | Settler |
-- source | String | Source |
-- status | int | open: open, close: closed, cancel: cancelled |
-- totalPiece | string | Total contracts |
-- updatedDate | long | Last update |
-- userId | string | User id |
Response:
{ "biz": "futures", "pairCode": "ETH", "data": [ { "currentPiece": "0", "isProfession": 0, "leverage": "20", "originalType": "execute", "processStatus": 0, "fee": "7.91981448", "openPrice": "2648.83248", "instrument": "ETH", "quantityUnit": 1, "source": "api", "updatedDate": 1729570005979, "positionModel": 0, "posType": "execute", "leaderId": "600001274", "baseSize": "0", "closedQuantity": "662.20812", "totalPiece": "500", "orderPrice": "2147483647", "id": "2435521222622135723", "fundingSettle": "-1.3233775", "direction": "long", "margin": "0", "indexPrice": "2631.48", "quantity": "0", "userId": "600001274", "parentId": "0", "closedPiece": "500", "createdDate": 1729568827000, "partnerId": "0", "positionMargin": "0", "remainCurrentPiece": "0", "status": "open" } ], "type": "position" }
Subscribe Assets
Subscribe Assets
Request Limit
3 requests/s per IP
Websocket Assets Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "type": "assets" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | String | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- biz | String | true | futures | Channel |
-- type | String | true | assets | ticker_swap (fixed value) |
Request Response:
{ "biz":"futures", "data":{"result":true}, "channel":"subscribe", "type":"assets" }
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
type | String | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
pairCode | String | Symbol |
type | String | ticker_swap (fixed value) |
data | ||
-- margin | BigDecimal | Margin used for position |
-- profitUnreal | BigDecimal | Unrealized PnL of the account |
-- size | BigDecimal | Amount |
-- currency | String | Symbol |
-- type | int | Type: 1-PnL, 2: Transfer in, 3: Transfer out, 4: Funding fees, 5: Mega coupon, 6: Trading fees. |
-- userId | BigDecimal | User id |
-- availableMargin | BigDecimal | Available equity (available margin) |
-- hold | BigDecimal | Commission |
Response:
{ "biz": "futures", "pairCode": "USDT", "data": [ { "margin": 6178.3308, "profitUnreal": 0, "size": 1, "currency": "usdt", "type": 2, "userId": 600001274, "availableMargin": 996795.043, "hold": 0 } ], "type": "assets" }
Subscribe Mega Coupon
Subscribe Mega Coupon
Request Limit
3 requests/s per IP
Websocket Mega Coupon Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "type": "assets_ag" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | String | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- biz | String | true | futures | Channel |
-- type | String | true | assets_ag | ticker_swap (fixed value) |
Request Response:
{ "biz":"futures", "data":{"result":true}, "channel":"subscribe", "type":"assets_ag" }
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
type | String | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
pairCode | String | Symbol |
type | String | ticker_swap (fixed value) |
data | ||
-- agRecordId | long | Mega coupon id |
-- updateDate | long | Last update |
-- backAmount | BigDecimal | Expired mega coupon |
-- currentAmount | BigDecimal | Remaining amount of mega coupon |
-- remark | String | Remarks |
-- userId | long | User id |
-- totalAmount | BigDecimal | Total amount of mega coupon |
-- createdDate | long | Time of creation |
-- kyc | int | Identity verification requirement: 1-required, 2-not required |
-- assetsOut | BigDecimal | Validity for out-transferred mega coupon: 1-expired, 2-active |
-- startTime | long | Start time of validity period |
-- endTime | long | End time of validity period |
-- status | int | 0-pending activation, 1-unused, 2-used, 3-expired, 4-failed to issue |
Response:
{ "biz": "futures", "data": [ { "agRecordId": 475, "updateDate": 1713192123887, "backAmount": 0, "currentAmount": 11, "remark": "", "userId": 600001274, "totalAmount": 11, "createdDate": 1713192123887, "kyc": 1, "assetsOut": 1, "startTime": 1713192110000, "endTime": 1713278512000, "status": 1 } ], "type": "assets_ag" }
Subscribe Position Settings
Subscribe Position Settings
Request Limit
3 requests/s per IP
Websocket Position Setting Pushes
wss://ws.futurescw.com/perpum
Request:
{ "event": "sub", "params": { "biz": "futures", "type": "user_setting" } }
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
event | String | true | sub/unsub | Subscription/Cancel subscription |
params | Json | true | null | Parameters |
-- biz | String | true | futures | Channel |
-- type | String | true | user_setting | ticker_swap (fixed value) |
Request Response:
{ "biz":"futures", "data":{"result":true}, "channel":"subscribe", "type":"user_setting" }
Responses
Param | Type | Description |
---|---|---|
biz | string | Channel |
type | string | ticker_swap (fixed value) |
result | boolean | Result |
channel | String | Subscription/Cancel subscription |
Responses
Param | Type | Description |
---|---|---|
biz | String | Channel |
pairCode | String | Symbol |
type | String | ticker_swap (fixed value) |
data | ||
-- layout | int | 0: merge, 1: split |
-- positionModel | int | Position mode: 0-isolated, 1-cross |
-- userId | long | User id |
Response:
{ "biz": "futures", "data": [ { "layout": 1, "positionModel": 1, "userId": 600001359 } ], "type": "user_setting" }
Basic API
Get the basic information on the trading market of CoinW. The symbol parameters used by other API interfaces are obtained from here, so before using other APIs, please obtain the necessary information through this API.
API introduction
Welcome to CoinW API!
This is the official CoinW API document, and it will be continuously updated, please stay tuned for the latest updates.
You can switch to different API business in the top menu, and switch to different language by clicking the button in the top right.
On the right side of the document are examples for request parameters and response results.
Description
1. Get API authenticated API key and secret key
The API Key and Secret Key can be obtained from API creation. The API Key is for API access and the Secret Key, as a private key, is for request parameter signature. Attention! For your account security, do not disclose your keys to anyone.
2. Generate the string to be signed
All parameters submitted by the user, except sign, must participate in the signature. The string to be signed needs to be sorted according to the parameter name (all parameter names are arranged in abcd order according to their first letters firstly, and if the same first letter is encountered, then the second letter, and so on.) For example, For the following The parameters are signed string [] parameters = {"api_key = c821db84-6fbd-11e4-a9e3-c86000d26d7c", "symbol = btc_cny" type = 0 "price = 680" amount = 1.0 "}; The string to be signed is, amount = 1.0 & api_key = c821db84-6fbd-11e4-a9e3-c86000d26d7c & price = 680 & symbol = btc_cny & type = 0
3. MD5 Signature
When signing MD5, the secret key is required to participate in the signature. Add the secret key parameter to the signature string to generate the final signature string, for example, amount=1.0&api_key=c821db84-6fbd-11e4-a9e3-c86000d26d7c&price=680&symbol=btc_cny&type=0&secret_key=secretKey Note that "&secret_key=secretKey" is signature required parameter. A 32-bit MD5 algorithm is used to perform a signature operation on the final signature string to be signed to obtain a signature result string (the string is assigned to the parameter sign). All letters in the MD5 calculation result are capitalized.
Retrieve summary information for the trading pair
Retrieve summary information for each trading pair listed on the exchange
HTTP Request
GET /api/v1/public?command=returnTicker
curl "https://api.coinw.com/api/v1/public?command=returnTicker"
Parameters
This endpoint does not require any parameters.
Responses
Param | Type | Description |
---|---|---|
id | string | id |
last | string | Last Price |
lowestAsk | string | Lowest Ask Price |
highestBid | string | Highest Bid Price |
percentChange | string | Price Change Percentage |
isFrozen | string | Frozen or not |
high24hr | string | 24h High |
low24hr | string | 24h Low |
baseVolume | string | Base coin 24H trading volume |
Response:
{ "code":"200", "data":{ "EET_CNYT":{ "percentChange":"0", "high24hr":"0.0", "last":"0.008", "highestBid":"0.007", "id":39, "isFrozen":0 "baseVolume":"0.0", "lowestAsk":"0.008", "low24hr":"0.0" } }, "msg":"SUCCESS" }
Coin information
Return coin related info
HTTP Request
GET/api/v1/public?command=returnCurrencies
curl "https://api.coinw.com/api/v1/public?command=returnCurrencies"
Parameters
This endpoint does not require any parameters.
Responses
Param | Type | Description |
---|---|---|
chain | string | Chain |
maxQty | string | Max Withdrawal Amount |
minQty | string | Min Withdrawal Amount |
recharge | string | Whether deposit is allowed, 0 for no, 1 for yes |
symbol | string | Coin |
symbolId | string | Token symbol |
txFee | string | Fee |
withDraw | string | Whether withdraw is allowed, 0 for no, 1 for yes |
Response:
{ "code":"200", "data":{ "HC":{ "chain": "BSC", "maxQty":"1000000.0", "minQty":"10.0", "recharge":"1", "symbol":"HC", "symbolId":"6", "txFee":"0.0", "withDraw":"1" }, "LEEK":{ "chain": "BSC", "maxQty":"999999.0", "minQty":"1000.0", "recharge":"1", "symbol":"LEEK", "symbolId":"55", "txFee":"0.0", "withDraw":"1" },"XMR":{ "chain": "BSC", "maxQty":"1000.0", "minQty":"0.1", "recharge":"1", "symbol":"XMR", "symbolId":"88", "txFee":"0.0", "withDraw":"1" },"GLA":{ "chain": "BSC", "maxQty":"9.99999999E8", "minQty":"100.0", "recharge":"0", "symbol":"GLA", "symbolId":"39", "txFee":"0.0", "withDraw":"0" } }, "msg":"SUCCESS" }
Trading pair information
Retrieve relevant information for the trading pair
HTTP Request
GET /api/v1/public?command=returnSymbol
curl "https://api.coinw.com/api/v1/public?command=returnSymbol"
Parameters
This endpoint does not require any parameters.
Responses
Param | Example |
---|---|
currencyPair | "lat_USDT" |
currencyBase | "lat" |
currencyQuote | "USDT |
maxBuyCount | "99999999" |
minBuyCount | "0.001" |
pricePrecision | 4 |
countPrecision | 4 |
minBuyAmount | "10.0" |
maxBuyAmount | "99999999" |
minBuyPrice | "99999999" |
maxBuyPrice | "99999999" |
state | 1 |
Response:
{ "code": "200", "data": [ { "currencyBase": "BTC3L", "maxBuyCount": "99999999", "pricePrecision": 6, "minBuyPrice": "0.0000010", "currencyPair": "BTC3L_USDT", "minBuyAmount": "5.0", "maxBuyPrice": "99999999", "currencyQuote": "USDT", "countPrecision": 3, "minBuyCount": "0.001", "state": 1, "maxBuyAmount": "99999999" } ] }
Market API
Retrieve latest market data
Get depth
Retrieve the trading pair depth info
HTTP Request
GET /api/v1/public?command=returnOrderBook
curl "https://api.coinw.com/api/v1/public?command=returnOrderBook&symbol=BTC_CNYT&size=20"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
size | Int | false | 5 | Depth size (5,20) |
symbol | string | true | Trading pair like, BTC_CNYT |
Responses
Param | Type | Description |
---|---|---|
asks | string | Buyer Depth |
bids | string | Seller Depth |
Response:
{ "code":"200", "data":{ "asks":[ ["3.263","0.01"], ["7.90",0.01], ["8.00","20.55"], ["8.177","51.25"], ["8.287","202.05"] ], "bids":[ ["3.262","302.00"], ["3.261","233.10"], ["3.26","34.00"], ["3.259","416.90"], ["3.258","113.50"] ] }, "msg":"SUCCESS" }
Latest transaction for the trading pair
Retrieve the past 200 trades for the given trading pair
HTTP Request
GET /api/v1/public?command=returnTradeHistory
curl "https://api.coinw.com/api/v1/public?command=returnTradeHistory&symbol=CWT_CNYT&start=1579238517000&end=1581916917660"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
symbol | string | true | Trading pair like, BTC_CNYT | |
start | string | false | Start time:UNIX timestamp | |
end | string | false | End time:UNIX timestamp |
Responses
Param | Type | Description |
---|---|---|
id | string | Trading ID |
type | string | Buy/Sell Type |
price | string | Unit Price |
amount | string | Total Quantity |
total | string | Total Amount |
time | string | Trading time |
Response:
{ "code":"200", "data":[ { "amount":49.2, "total":160.5888, "price":3.264, "id":416253782, "time":"2020-01-09 10:10:15", "type":"buy" },{ "amount":63.4, "total":207.1278, "price":3.267, "id":416253778, "time":"2020-01-09 10:10:15", "type":"sell" } ], "msg":"SUCCESS" }
K-line data
Retrieve K-line data
HTTP Request
GET /api/v1/public?command=returnChartData
curl "https://api.coinw.com/api/v1/public?currencyPair=CWT_CNYT&command=returnChartData&period=1800&start=1580992380&end=1582288440"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
period | Int | True | Cycle, in seconds. e.g., 60, 180, 300, 900, 1800, 7200, 14400 | |
currencyPair | String | True | Trading pair like, BTC_CNYT | |
start | String | False | Start time:UNIX timestamp | |
end | String | False | End time:UNIX timestamp |
Responses
Param | Type | Description |
---|---|---|
date | string | Time |
high | string | High |
low | string | Low |
open | string | Open |
close | string | Close |
volume | string | Volume |
Response:
{ "code":"200", "data":[{ "date":1.5809922E12, "volume":0.0, "high":8.803, "low":8.803, "close":8.803, "open":8.803 },{ "date":1.580994E12, "volume":0.0, "high":8.803, "low":8.803, "close":8.803, "open":8.803 },{ "date":1.5822864E12, "volume":121503.276, "high":9.587, "low":9.169, "close":9.4949, "open":9.4274 },{ "date":1.5822882E12, "volume":137447.694, "high":9.575, "low":9.191, "close":9.4599, "open":9.4949 } ], "msg":"SUCCESS" }
Hot coins trading volume
Retrieve 24-Hour Trading Volume for Markets
HTTP Request
GET /api/v1/public?command=return24hVolume
curl "https://api.coinw.com/api/v1/public?command=return24hVolume"
Parameters
This endpoint does not require any parameters.
Responses
Response:
{ "code":"200", "data":{ "totalETH":"0", "USDT_CNYT":{ "USDT":"9507323.2456", "CNYT":"66883008.0578" }, "totalUSDT":"375022045.7914", "ETH_USDT":{ "ETH":"0", "USDT":"0" }, "totalBTC":"0", "CWT_CNYT":{ "CWT":"6003449.28", "CNYT":"55189103.6876" }, "BTC_CNYT":{ "BTC":"46550.1319", "CNYT":"2516207980.3979" }, "BTC_USDT":{ "BTC":"0", "USDT":"0" }, "ETH_CNYT":{ "ETH":"0", "CNYT":"0" } }, "msg":"SUCCESS" }
Public Market Data
Public Market Data
HTTP Request
GET /api/v1/public?command=returnTickerInfo
curl "https://api.coinw.com/api/v1/public?command=returnTickerInfo&symbol=CWT_CNYT"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
symbol | string | true | Trading pair like, BTC_CNYT |
Responses
Param | Type | Description |
---|---|---|
buy | bigdecimal | Bid Price |
changePrice | bigdecimal | Price change |
changeRate | bigdecimal | Price change percentage |
high | bigdecimal | 24H Highest Price |
last | bigdecimal | Last Price |
low | bigdecimal | 24H Lowest Price |
open | bigdecimal | Opening Price |
sell | bigdecimal | Ask Price |
symbol | string | Coin |
vol | bigdecimal | Amount |
volValue | bigdecimal | Turnover |
Response:
{ "code":"200", "data":{ "buy": "3.234", "changePrice": "-0.666", "changeRate": "-0.170769", "high": "4.000", "last": "3.234", "low": "3.234", "open": "3.900", "sell": "4.000", "symbol": "LTC-USDT", "vol": "81.360", "volValue": "306.280240" }, "msg":"SUCCESS" }
Trading API
For fast trading
Pending order list
Retrieve the list of unfilled orders for the specified trading pair
HTTP Request
POST /api/v1/private?command=returnOpenOrders
curl "https://api.coinw.com/api/v1/private?command=returnOpenOrders"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
currencyPair | string | true | Pair | |
startAt | long | false | Start time | |
endAt | long | false | End time |
Responses
Param | Type | Description |
---|---|---|
orderNumber | string | Order ID |
date | string | Transaction Time |
startingAmount | string | Total order amount |
total | string | Total order amount |
type | string | Order type |
prize | string | Limit price |
success_count | string | Total traded quantity |
success_amount | string | Total traded amount |
status | string | Status: 1-unfilled, 2-partially filled, 3-fully filled, 4-canceled |
Response:
{ "code":"200", "data":[ { "orderNumber":421547953, "date":1577419268000, "startingAmount":11, "total":11, "type":"buy", "prize":1, "success_count":0, "success_amount":0, "status":1 } ], "msg":"SUCCESS" }
Order details
Retrieve detailed information for the specified order
HTTP Request
POST /api/v1/private?command=returnOrderTrades
curl "https://api.coinw.com/api/v1/private?command=returnOrderTrades"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
orderNumber | string | true | Order ID |
Responses
Param | Type | Description |
---|---|---|
tradeID | string | Trading ID |
currencyPair | string | Pair |
type | string | Order type |
amount | string | Total trading amount |
success_amount | string | Filled amount |
total | string | Total order amount |
success_total | string | Filled quantity |
fee | string | Unit Price |
date | string | Transaction Time |
status | string | Status: 1-unfilled, 2-partially filled, 3-fully filled, 4-canceled |
Response:
{ "code":"200", "data":{ "tradeID":421547953, "currencyPair":"CWT_CNYT", "type":"buy", "amount":11, "success_amount":0, "total":11, "success_total":"0.00", "fee":1, "date":"2019-12-27 12:01:08", "status":1 }, "msg":"SUCCESS" }
Order status
Retrieve status information for the specified order
HTTP Request
POST /api/v1/private?command=returnOrderStatus
curl "https://api.coinw.com/api/v1/private?command=returnOrderStatus"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
orderNumber | string | true | Order ID |
Responses
Param | Type | Description |
---|---|---|
currencyPair | string | Pair |
type | string | Order type |
total | string | Total order amount |
startingAmount | string | Order amount |
status | string | Status: 1-unfilled, 2-partially filled, 3-fully filled, 4-canceled |
Response:
{ "code":"200", "data":{ "status":1, "currencyPair":"CWT_CNYT", "date":"2019-12-27 12:01:08", "total":11, "type":"buy", "startingAmount":11 }, "msg":"SUCCESS" }
Order history
Return the transaction history for the specified trading pair, up to a maximum of 1,000 records
HTTP Request
POST /api/v1/private?command=returnUTradeHistory
curl "https://api.coinw.com/api/v1/private?command=returnUTradeHistory"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
currencyPair | string | true | Pair | |
startAt | long | false | Start time | |
endAt | long | false | End time |
Responses
Param | Type | Description |
---|---|---|
tradeID | string | Trading ID |
type | string | Order type |
amount | string | Total trading amount |
success_amount | string | Filled amount |
total | string | Total order amount |
success_count | string | Filled quantity |
fee | string | Fee |
prize | string | Limit price |
date | string | Trading time |
status | string | Status: 1-unfilled, 2-partially filled, 3-fully filled, 4-canceled |
Response:
{ "code":"200", "data":[ { "tradeID":421547953, "date":1577419268000, "amount":11, "total":11, "fee":1, "type":"buy", "prize":1, "success_count":0, "success_amount":0, "status":1 },{ "tradeID":401267521, "date":1573463699000, "amount":111.1011, "total":33.43, "fee":3.323, "type":"buy", "prize":3.323, "success_count":33.43, "success_amount":111.1011, "status":3 },{ "tradeID":393755271, "date":1573036041000, "amount":138.7007, "total":39.18, "fee":3.54, "type":"buy", "prize":3.54, "success_count":39.18, "success_amount":138.7007, "status":3 } ], "msg":"SUCCESS" }
Trade history
Retrieve the transaction history for the specified trading pair, up to a maximum of 100 records
HTTP Request
POST /api/v1/private?command=getUserTrades
curl "https://api.coinw.com/api/v1/private?command=getUserTrades"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
symbol | string | false | Trading Pair Name | |
startAt | long | false | Start time | |
endAt | long | false | End time | |
limit | int | false | 20 | Number of queries 0 < limit <= 100 |
before | long | false | For pagination ( if any ) | |
after | long | false | For pagination ( if any ) |
Responses
Param | Type | Description |
---|---|---|
tradeId | long | Transaction ID |
orderId | long | Order ID |
price | string | Transaction price |
size | string | Transaction Quantity |
side | string | Transaction direction buy , sell |
orderType | string | Transaction Type |
time | long | Transaction time |
fee | double | Fee |
before | long | For pagination ( if any ) |
after | long | For pagination ( if any ) |
Response:
{ "code": "200", "data": { "before": 1125899907141206079, "after": 1125899907141206202, "list": [ { "fee": 0.14, "orderId": 4612803122241208330, "orderType": "LIMIT", "price": 7E+1, "side": "BUY", "size": 1, "time": 1628068267298, "tradeId": 1029953 } ] } } }
Order
Order
HTTP Request
POST /api/v1/private?command=doTrade
curl "https://api.coinw.com/api/v1/private?command=doTrade"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
symbol | string | true | Trading pair like, BTC_CNYT | |
type | string | true | Order type, 0-buy, 1-sell | |
amount | double | true | Order Amount | |
rate | double | true | Limit price | |
funds | string | false | Amount, market order is valid | |
isMarket | boolean | true | "true"/"false", limit orders can be omitted | |
out_trade_no | string | true | External transaction ID |
Responses
Param | Type | Description |
---|---|---|
orderNumber | string | Order ID |
Response:
{ "code":"200", "data":{ "orderNumber":422742231 }, "msg":"SUCCESS" }
Cancel order
Cancel
HTTP Request
POST /api/v1/private?command=cancelOrder
curl "https://api.coinw.com/api/v1/private?command=cancelOrder"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
orderNumber | string | true | Order ID |
Responses
Param | Type | Description |
---|---|---|
clientOrderId | string | Order ID |
Response:
{ "code":"200", "data":{ "clientOrderId":422744738 }, "msg":"SUCCESS" }
Cancel All
Cancel All
HTTP Request
POST /api/v1/private?command=cancelAllOrder
curl "https://api.coinw.com/api/v1/private?command=cancelAllOrder"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
currencyPair | string | False | Pair |
Responses
Param | Type | Description |
---|---|---|
orderNumbers | Array | List of order IDs |
Response:
{ "code":"200", "data":{ "orderNumbers":[421547953] }, "msg":"SUCCESS" }
Assets API
For fast crypto withdrawal
Available balance
Retrieve the available balance of the spot account
HTTP Request
POST /api/v1/private?command=returnBalances
curl "https://api.coinw.com/api/v1/private?command=returnBalances"
Parameters
This endpoint does not require any parameters.
Responses
Response:
{ "code":"200", "data":{ "MATIC":0, "TRIO":0, "CTXC":0, "BCHSV":0, "HT":0, "HX":0, "SDA":0, "CDT":0, "GDP":0, "IHT":0, "STX":0, "TNT":0, "BCD":0, "AE":0, "IOST":0.0014, "0X":0 }, "msg":"SUCCESS" }
All balances
Retrieve all balances of the spot account
HTTP Request
POST /api/v1/private?command=returnCompleteBalances
curl "https://api.coinw.com/api/v1/private?command=returnCompleteBalances"
Parameters
This endpoint does not require any parameters.
Responses
Param | Type | Description |
---|---|---|
available | string | Available balance |
onOrders | string | Frozen balance |
Response:
{ "code":"200", "data":{ "MATIC":{ "onOrders":0, "available":0 }, "TRIO":{ "onOrders":0, "available":0 }, "CTXC":{ "onOrders":0, "available":0 }, "BCHSV":{ "onOrders":0, "available":0 }, "HT":{ "onOrders":0, "available":0 } }, }, "msg":"SUCCESS" }
Deposit and withdrawal records
Retrieve deposit and withdrawal records
HTTP Request
POST /api/v1/private?command=returnDepositsWithdrawals
curl "https://api.coinw.com/api/v1/private?command=returnDepositsWithdrawa
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
symbol | string | true | Coin name | |
depositNumber | string | false | Unique code(ID) |
Responses
Param | Type | Description |
---|---|---|
amount | string | Amount |
chain | string | Chain |
side | int | 1: deposit, 2: withdrawal |
depositNumber | string | Unique code(ID) |
address | string | Deposit and withdrawal addresses |
txid | string | Transaction hash |
memo | string | Memo |
currency | string | Coin name |
time | long | Deposit & withdrawal time |
confirmations | string | Confirmation tree |
status | string | Status 1, pending withdrawal; 3, withdrawal successful; 4, user canceled |
dest | string | Withdrawal method on_chainWithdraw to external wallet address internal_transferwithdraw to CoinW users internally |
fromAddress | string | Withdrawal initiatoruid |
toAddress | string | Withdrawal recipient When dest is on_chain, enter the external wallet address of the recipient. When dest is internal_transfer, enter the UID, email address, or phone number of the recipient. |
Response:
{ "code":"200", "data":[ { "amount":31659.654543, "chain": "ERC20", "side": 1, "depositNumber":937963, "address":"123", "txid":"已提交autocoinone937963Mon Oct 08 20:19:25 CST 2018", "memo": null, "currency":"HC", "time": 1704858504000, "confirmations":0, "status":3 },{ "amount":398.8, "chain": "ERC20", "side": 1, "depositNumber":903010, "address":"123", "memo": null, "txid":"已提交autocoinone903010Fri Aug 31 18:26:16 CST 2018", "currency":"HC", "time": 1704858504000, "confirmations":0, "status":3 } ], "msg":"SUCCESS" }
Get Deposit Address
Get a deposit address for the crypto you intend to deposit.
HTTP Request
POST /api/v1/private?command=returnDepositAddresses
curl "https://api.coinw.com/api/v1/private?command=returnDepositAddresses
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
symbolId | string | true | Token symbol | |
chain | string | true | Chain |
Responses
Param | Type | Description |
---|---|---|
minRechargeAmount | string | Minimum deposit amount |
chainName | string | Chain |
address | string | Deposit and withdrawal addresses |
Response:
{ "code": "200", "data": [{ "minRechargeAmount": "0", "chainName": "TRC20", "address": "TUn6aaMxD5FQ91PSEZKs1pnKAsR7dVLisC" }], "msg": "SUCCESS", "success": true }
Withdraw
Withdraw
HTTP Request
POST /api/v1/private?command=doWithdraw
curl "https://api.coinw.com/api/v1/private?command=doWithdraw"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
memo | string | False | Memo | |
type | string | False | ordinary_withdraw | ordinary_withdraw: withdraw to external wallet address, internal_transfer: withdraw to CoinW users internally |
amount | string | true | Withdrawal amount | |
currency | string | true | Coin | |
address | string | true | Withdrawal Address When the type is ordinary_withdraw, enter the on-chain address. When the type is internal_transfer, enter UID, email or phone number based on the innerToType value. | |
chain | string | False | ERC20,TRC20,BSC,etc. | |
innerToType | integer | false | Type of internal withdrawal address. Required when type is set to internal_transfer. 1 represents UID, 2 represents mobile phone number, 3 represents email address. |
Responses
Param | Type | Description |
---|---|---|
depositNumber | string | Unique code(ID) |
Response:
{ "code": "200", "data": { "depositNumber": "23705" }, "msg": "SUCCESS" }
Cancel withdrawal
Cancel withdrawal
HTTP Request
POST /api/v1/private?command=cancelWithdraw
curl "https://api.coinw.com/api/v1/private?command=cancelWithdraw"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
id | string | true | Withdrawal application id |
Responses
Response:
{ "code": "200", "data":null, "msg": "SUCCESS" }
Transfer API
This endpoint is used for fund transfer between spot and funding accounts.
Transfer API
This endpoint is used for fund transfer between spot and funding accounts.
HTTP Request
POST /api/v1/private?command=spotWealthTransfer
curl "https://api.coinw.com/api/v1/private?command=spotWealthTransfer&accountType=WEALTH&targetAccountType=SPOT&bizType=WEALTH_TO_SPOT&coinCode=USDT&amount=11"
Parameters
Param | Type | Mandatory | Default | Description |
---|---|---|---|---|
accountType | string | true | Account from which the funds are transferred WEALTH: Funding account, SPOT: Spot account | |
targetAccountType | string | true | Account to which the funds are transferred WEALTH: Funding account, SPOT: Spot account | |
bizType | string | true | WEALTH_TO_SPOT: From funding account to spot account, SPOT_TO_WEALTH: From spot account to funding account. | |
coinCode | string | true | Ticker symbol of the token | |
amount | BigDecimal | true | Transfer amount |
Response:
{ "code": "200", "data": true, "failed": false, "msg": "SUCCESS", "success": true }
Real-time markets
Retrieve latest market data
Identity information required for WebSocket connection
https://api.coinw.com/pusher/public-token
Parameter (N/A)
Responses
Param | Type | Description |
---|---|---|
token | string | Identity information required for WebSocket connection |
endpoint | string | Address information required for WebSocket connection |
protocol | string | Protocol |
timestamp | long | Server Time |
expiredTime | long | Expiration time |
pingInterval | long | Heartbeat check period, in milliseconds |
Response:
{ "success": true, "code": 200, "message": "success", "retry": false, "data": { "token": "2ae60df9-c4d9-40c6-ad51-465ae7cca06f", "endpoint": "wss://ws.coinw.com", "protocol": "websocket", "timestamp": 1627379009291, "expiredTime": 1627379039291, "pingInterval": 10000 } }
Create Connection
This WebSocket connection needs to be developed using the Socket.io framework, and the specific development rules need to obtain corresponding dependent libraries according to the corresponding language. According to the token and endpoint in the pre information returned data, assemble it into the URL address required for the connection. The example is as follows,
wss://ws.coinw.com/socket.io/?token=87a34709-2c4a-4eab-8bf2-d477d4689dd0&EIO=3&transport=websocket
Public Market Push
Public Market Push
Parameters
Param | Value | Description |
---|---|---|
event | subscribe | Subscribe |
args | spot/market-api-ticker:${symbol} | {symbol} is the coin to be subscribed, for example, LTC-USDT |
Responses
Param | Type | Description |
---|---|---|
channel | string | Subscribed Channel |
subject | string | Subject |
buy | bigdecimal | Bid Price |
changePrice | bigdecimal | Price change |
changeRate | bigdecimal | Price change percentage |
high | bigdecimal | 24H Highest Price |
last | bigdecimal | Last Price |
low | bigdecimal | 24H Lowest Price |
open | bigdecimal | Opening Price |
sell | bigdecimal | Ask Price |
symbol | string | Coin |
vol | bigdecimal | Amount |
volValue | bigdecimal | Turnover |
data is a string, which needs to be deserialized into JSON
Response:
{ "channel": "spot/market-api-ticker:LTC-USDT", "subject": "spot/market-api-ticker", "data": "{\"buy\":\"3.234\",\"changePrice\":\"-0.666\",\"changeRate\":\"-0.170769\",\"high\":\"4.000\",\"last\":\"3.234\",\"low\":\"3.234\",\"open\":\"3.900\",\"sell\":\"4.000\",\"symbol\":\"LTC-USDT\",\"vol\":\"81.360\",\"volValue\":\"306.280240\"}" } { "buy": "3.234", "changePrice": "-0.666", "changeRate": "-0.170769", "high": "4.000", "last": "3.234", "low": "3.234", "open": "3.900", "sell": "4.000", "symbol": "LTC-USDT", "vol": "81.360", "volValue": "306.280240" }
K-line
K-line
Parameters
Param | Value | Description |
---|---|---|
event | subscribe | Subscribe |
args | spot/candle-${granularity}:${symbol} | ${granularity} is the granularity [1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 1w,1M],${symbol} is the desired coins to be subscribed, e.g.,LTC-USDT |
Responses
Param | Type | Description |
---|---|---|
channel | string | Subscribed Channel |
subject | string | Subject |
data array | ||
0 | string | Time (in milliseconds) |
1 | bigdecimal | Opening Price |
2 | bigdecimal | Closing Price |
3 | bigdecimal | Highest |
4 | bigdecimal | Lowest |
5 | bigdecimal | Volume |
6 | bigdecimal | Turnover |
data is a string, which needs to be deserialized into JSON
Response:
{ "channel": "spot/candle-15m:BTC-USDT", "subject": "spot/candle-15m", "data":"[\"1681875900000\",\"30214.56\",\"30182.48\",\"30214.56\",\"30182.48\",\"12.9646\",\"391493.29663\"]"}] } data: [ "1681875900000", "30214.56", "30182.48", "30214.56", "30182.48", "12.9646", "391493.29663" ]
Order book
Order book
Parameters
Param | Value | Description |
---|---|---|
event | subscribe | Subscribe |
args | spot/level2:${symbol} | {symbol} is the coin to be subscribed, for example, LTC-USDT |
Responses
Param | Type | Description |
---|---|---|
channel | string | Subscribed Channel |
subject | string | Subject |
data | ||
startSeq | string | Start serial number |
endSeq | string | End serial number |
Seller two-dimensional array | ||
0 | bigdecimal | Unit Price |
1 | bigdecimal | Quantity |
2 | string | Serial number |
Buyer two-dimensional array | ||
0 | bigdecimal | Unit Price |
1 | bigdecimal | Quantity |
2 | string | Serial number |
data is a string, which needs to be deserialized into JSON
Response:
{ "channel":"spot/level2:BTC-USDT", "subject":"spot/level2", "data":"{\"startSeq\":2130205870,\"endSeq\":2130205870,\"asks\":[[\"30344.39\",\"0.0701\",\"2130205870\"]],\"bids\":[]}" } data: { "startSeq": 2130205870, "endSeq": 2130205870, "asks": [ [ "30344.39", "0.0701", "2130205870" ] ], "bids": [ [ "30344.39", "0.0701", "2130205870" ] ] }
Transaction History
Transaction History
Parameters
Param | Value | Description |
---|---|---|
event | subscribe | Subscribe |
args | spot/match:${symbol} | {symbol} is the coin to be subscribed, for example, LTC-USDT |
Responses
Param | Type | Description |
---|---|---|
channel | string | Subscribed Channel |
subject | string | Subject |
data | ||
price | bigdecimal | Unit Price |
side | string | Direction(BUY, SELL) |
size | string | Quantity |
symbol | string | Trading pairs |
time | string | Time (in milliseconds) |
data is a string, which needs to be deserialized into JSON
Response:
{ "channel":"spot/match:BTC-USDT", "subject":"spot/match", "data":"[{\"price\":\"30077.88\",\"seq\":\"79895588\",\"side\":\"BUY\",\"size\":\"1.2488\",\"symbol\":\"78\",\"time\":\"1681891021015\"}]" } data: [ { "price": "30077.88", "seq": "79895588", "side": "BUY", "size": "1.2488", "symbol": "78", "time": "1681891021015" } ]
Assets & Orders
Get data of assets and orders.
Access URL
wss://ws.futurescw.com
Heartbeat Information
Heartbeat InformationRequest Example:
Client sends {"event":"ping"} server responds {"event":"pong"}
Suggested timing: 10 seconds. ping pong
Parameters
Param | Value | Description |
---|---|---|
event | ping | Heartbeat Information |
Log In
Log InRequest Example:
{"event":"login","params":{"api_key":"xxx","passphrase":"xxx"}}
Parameters
Param | Value | Description |
---|---|---|
event | login | Log In |
params | ||
api_key | xxx | apikey |
passphrase | xxx | passphrase |
Subscribe Orders
Subscribe Orders Request Example:
{"event":"sub","params":{"biz":"exchange","type":"order"}}
Parameters
Param | Value | Description |
---|---|---|
event | sub | Subscribe |
params | ||
biz | exchange | Trade |
type | order | Type |
Responses
Param | Type | Description |
---|---|---|
biz | string | Trade |
type | string | Type |
data | ||
type | string | Type |
time | datetime | Order placing time |
product_id | string | Product id |
order_id | string | Order id |
client_id | string | Client id |
size | string | Quantity |
remaining_size | string | Remaining quantity |
price | string | Order price |
side | string | Side: Buy/Sell |
order_type | string | Order type: LIMIT-limit order, MARKET-market order |
reason | string | Cause of error |
data is a string, which needs to be deserialized into JSON
Response:
{ "biz": "exchange", "data": [{ "type": "DONE", "time": 1697557265740, "product_id": "78", "order_id": 4616004900217272378, "client_id": "", "size": "0.001", "remaining_size": "0", "price": "20000", "side": "BUY", "order_type": "LIMIT", "reason": "FILLED" }], "type": "order" }
Subscribe Assets
Subscribe Assets Request Example:
{"event":"sub","params":{"biz":"exchange","type":"assets"}}
Parameters
Param | Value | Description |
---|---|---|
event | sub | Subscribe |
params | ||
biz | exchange | Trade |
type | assets | Type |
Responses
Param | Type | Description |
---|---|---|
biz | string | Trade |
type | string | Type |
data | ||
amount | string | Total amount |
available | string | Order id |
currency | string | Coin |
time | datetime | Order placing time |
type | string | Type |
ledger_id | string | Associated ledger id |
account | string | Account |
hold | string | Holding amount |
data is a string, which needs to be deserialized into JSON
Response:
{ "biz": "exchange", "data": [{ "amount": "9918727.34", "available": "9918336.0867", "currency": "USDT", "time": 1697557265783, "type": "change", "ledger_id": 1125899906948529084, "account": "spot", "hold": "391.254862" }], "type": "assets" }
Error code
API endpoint call error code description
Error code | Detailed description |
---|---|
200 | Success |
500 | Operation failed |
10001 | Network error |
10002 | API not found |
10003 | Parameter error |
10004 | No trading permission |
10005 | No withdraw permission |
10006 | api_key error |
10007 | Signature error |