Hello, my friends. If you’re new to cryptocurrency trading or looking to streamline your trading strategies, the WEEX API is exactly what you need. The WEEX API is a powerful interface provided by WEEX Exchange, designed to help traders and developers interact programmatically with the exchange’s services. Whether you’re building automated trading bots, tracking market data, or managing your account efficiently, WEEX API simplifies the process, saving you time and effort.
This is the official WEEX API document, and it will be continuously updated. Please stay tuned for the latest updates. I’m sure you’re really in a right place to learn how to use WEEX Exchange’s API.

In my article, I’ll show you this: if you want to use the API to earn more, you must know that WEEX API gives you direct access to a wealth of real-time market data, account management tools, and trading capabilities. Instead of manually executing trades or checking market updates, you can automate these tasks. This can significantly enhance your trading efficiency and accuracy. For instance, if you’re a trader who needs to execute trades quickly when certain market conditions are met, automating this with the WEEX API ensures you never miss an opportunity.
Contents
- 1 Check Server Time
- 2 Get All Coin Pairs Information
- 3 Spot Market Data Endpoints
- 4 Get The Latest Ticker For All Symbols
- 5 Order Book
- 6 Spot Account Endpoints
- 7 Spot Trade Endpoints
- 8 Place Multiple Orders
- 9 Cancel Order
- 10 Get Order details
- 11 Get Traded Order Record
- 12 Common Error Codes
- 13 Spot Error Codes
- 14 Websocket Market Streams
- 15 Listen Key
- 16 Enhance Earnings with WEEX Affiliate Program
- 17 Personal Insight and Recommendations
- 18 Websocket Streams for Real-Time Updates
- 19 Final Thoughts
Check Server Time
Rate limit rule: 20 requests/2s
HTTP Request: Check server time
- GET /api/spot/v1/public/time
Response :
{
" code ": "00000" ,
"msg" : "success" ,
"requestTime" : 1622097118135 ,
"data" : 1622097118134
}
Coin Basic Information
Rate limit rule: 20 requests/2s
HTTP Request: get all coins information on the platform
- GET /api/spot/v1/public/currencies
Response :
{
"code" : "00000" ,
"msg" : "success" ,
"requestTime" : 1622097139437 ,
"data" : [
{
"coinId" : "1" ,
"coinName" : "BTC" ,
"transfer" : "true" ,
"chains" : [
{
"chain" : null ,
"needTag" : "false" ,
"withdrawAble" : "true" ,
"rechargeAble" : "true" ,
"withdrawFee" : "0.005" ,
"depositConfirm" : "1" ,
"withdrawConfirm" : "1" ,
"minDepositAmount" : "0.001" ,
"minWithdrawAmount" : "0.001" ,
"browserUrl" : "https://blockchair.com/bitcoin/testnet/transaction/"
}
]
} ,
{
"coinId" : "2" ,
"coinName" : "USDT" ,
"transfer" : "true" ,
"chains" : [
{
"chain" : "ERC20" ,
"needTag" : "false" ,
"withdrawAble" : "true" ,
"rechargeAble" : "true" ,
"withdrawFee" : "0.01" ,
"depositConfirm" : "12" ,
"withdrawConfirm" : "1" ,
"minDepositAmount" : "0.1" ,
"minWithdrawAmount" : "0.1" ,
"browserUrl" : "https://ropsten.etherscan.io/tx/"
}
]
}
]
}
Response Field
Field | Description |
---|---|
coinId | Currency ID |
coinName | Currency name |
transfer | Is it possible to transfer |
chains | |
> chain | Chain name |
> needTag | Is a tag needed |
> withdrawAble | Withdrawable or not |
> rechargeAble | Is it possible to deposit |
> withdrawFee | Withdrawal fee |
> depositConfirm | Deposit no. of confirmation block |
> withdrawConfirm | Withdrawal no. of confirmation block |
> minDepositAmount | Minimum Deposit Amount |
> minWithdrawAmount | Minimum withdrawal Amount |
> browserUrl | Blockchain browser URL |
Get All Coin Pairs Information
Rate limit rule: 20 requests/1s
HTTP Request: get basic configuration information of all trading pairs
- GET /api/spot/v1/public/products
Response :
{
" code ": "00000" ,
"msg" : "success" ,
"requestTime" : 1622097197283 ,
"data" :[
{
"symbol" : "BTCUSDT_SPBL" ,
"symbolName" : "BTCUSDT" ,
"baseCoin" : "BTC" ,
"quoteCoin" : "USDT" ,
"minTradeAmount" : "0.0001" ,
"maxTradeAmount" : "10000" ,
"takerFeeRate" : "0.001" ,
"makerFeeRate" : "0.001" ,
"priceScale" : "4" ,
"quantityScale" : "8" ,
"status" : "online"
},
{
"symbol" : "EOSUSDT_SPBL" ,
"symbolName" : "EOSUSDT" ,
"baseCoin" : "EOS" ,
"quoteCoin" : "USDT" ,
"minTradeAmount" : "1" ,
"maxTradeAmount" : "1" ,
"takerFeeRate" : "1" ,
"makerFeeRate" : "1" ,
"priceScale" : "1" ,
"quantityScale" : "1" ,
"status" : "online"
}
]
}
Response Field
Field | Description |
---|---|
symbol | Coin pair |
baseCoin | Base coin |
quoteCoin | Quote coin |
minTradeAmount | Minimum trade size |
maxTradeAmount | Maximum trade size |
takerFeeRate | Taker fee rate |
makerFeeRate | Maker fee rate |
priceScale | Pricing scale |
quantityScale | Quantity scale |
status | Status |
Get Coin Pairs Information By Symbol
Rate limit rule: 20 requests/1s
HTTP Request
- GET /api/spot/v1/public/product
Request parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Name of Currency pair |
Response :
{
" code ": "00000" ,
"msg" : "success" ,
"requestTime" : 1622097197283 ,
"data" :[
{
"symbol" : "BTCUSDT_SPBL" ,
"symbolName" : "BTCUSDT" ,
"baseCoin" : "BTC" ,
"quoteCoin" : "USDT" ,
"minTradeAmount" : "0.0001" ,
"maxTradeAmount" : "10000" ,
"takerFeeRate" : "0.001" ,
"makerFeeRate" : "0.001" ,
"priceScale" : "4" ,
"quantityScale" : "8" ,
"status" : "online"
}
]
}
Response Field
Field | Description |
---|---|
symbol | Currency pair |
baseCoin | Base Currency |
quoteCoin | Quote Currency |
minTradeAmount | Minimum trade size |
maxTradeAmount | Maximum trade size |
takerFeeRate | Taker fee rate |
makerFeeRate | Maker fee rate |
priceScale | Pricing scale |
quantityScale | Quantity scale |
status | Status |
Spot Market Data Endpoints
Get Ticker By Symbol
Rate limit rule: 20 requests/1s
HTTP Request
Request parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Currency pair |
Response :
{
" code ": "00000" ,
"data" :{
"symbol": "BTCUSDT" ,
"high24h" : "34413.1" ,
"low24h" : "34413.1" ,
"close" : "34413.1" ,
"quoteVol" : "0" ,
"baseVol" : "0" ,
"usdtVol" : "0" ,
"ts" : "1625125755277"
},
"msg" : "success" ,
"requestTime" : 1625125756372
}
Response Field
Field | Description |
---|---|
symbol | Currency pair |
high24h | 24h highest price |
close | Latest transaction price |
low24h | 24h lowest price |
quoteVol | Quote Currency volume |
baseVol | Base Currency volume |
usdtVol | USDT volume |
ts | System timestamp |
Get The Latest Ticker For All Symbols
Rate limit rule: 20 requests/1s
HTTP Request: Get the latest ticker for all coin pairs
- GET /api/spot/v1/market/tickers
Response:
{
" code ": "00000" ,
"data" :[
{
"symbol": "BTCUSDT" ,
"high24h" : "34413.1" ,
"low24h" : "34413.1" ,
"close" : "34413.1" ,
"quoteVol" : "0" ,
"baseVol" : "0" ,
"usdtVol" : "0" ,
"ts" : "1625125755277"
}
]
"msg" : "success" ,
"requestTime" : 1625125756372
}
Response Field
Field | Description |
---|---|
symbol | Currency pair |
high24h | 24h highest price |
close | Latest transaction price |
low24h | 24h lowest price |
ts | System timestamp |
baseVol | Base coin volume |
quoteVol | Quote coin volume |
usdtVol | USDT volume |
Recent Trades List
Rate limit rule: 20 requests/1s
HTTP Request
- GET /api/spot/v1/market/fills
Request parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Currency pair |
limit | String | No | Default 100 |
Response :
{
" code ": "00000" ,
"msg" : "success" ,
"requestTime" : 1622097283024 ,
"data" :[
{
"symbol" : "BFTUSDT_SPBL" ,
"tradeId" : "781698148534505473" ,
"side" : "buy" ,
"fillPrice" : "2.38735" ,
"fillQuantity" : "2470.6224" ,
"fillTime" : "1622097282536"
},
{
"symbol" : "BFTUSDT_SPBL" ,
"tradeId" : "781698140590493697" ,
"side" : "sell" ,
"fillPrice" : "2.38649" ,
"fillQuantity" : "3239.7976" ,
"fillTime" : "1622097280642"
}
]
}
Response Field
Field | Description |
---|---|
symbol | Currency pair |
tradeId | trade id |
side | Trade direction |
fillPrice | Transaction price |
fillQuantity | Transaction quantity |
fillTime | Transaction time |
Kline/Candlestick Data
Rate limit rule: 20 requests/1s
HTTP Request
- GET /api/spot/v1/market/candles
Request parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Currency pair |
period | String | Yes | Candlestick line time unit, granularity (refer to the following list for values) |
after | String | No | Time after |
before | String | No | Time before |
limit | String | No | Default 100 |
Description | Granularity |
---|---|
1min | 60 |
5min | 300 |
15min | 900 |
30min | 1800 |
1h | 3600 |
4h | 14400 |
12h | 43200 |
1d | 86400 |
7d | 604800 |
Response:
{
" code ": "00000" ,
"msg" : "success" ,
"requestTime" : 1622097356073 ,
"data" :[
{
"open" : "2.34517" ,
"high" : "2.34771" ,
"low" : "2.34214" ,
"close" : "2.34555" ,
"quoteVol" : "189631.101357091" ,
"baseVol" : "80862.6823" ,
"usdtVol" : "189631.101357091" ,
"ts" : "1622091360000"
},
{
"open" : "2.34391" ,
"high" : "2.34903" ,
"low" : "2.34391" ,
"close" : "2.34608" ,
"quoteVol" : "167725.002115681" ,
"baseVol" : "71479.3205" ,
"usdtVol" : "167725.002115681" ,
"ts" : "1622091420000"
}
]
}
Response Field
Field | Description |
---|---|
ts | System timestamp |
open | Opening price |
high | Highest price |
low | Lowest price |
close | Closing price |
baseVol | Base Currency volume |
quoteVol | Quote Currency volume |
usdtVol | USDT volume |
Order Book
Rate limit rule: 20 requests/1s
HTTP Request
- GET /api/spot/v1/market/depth
Request parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Currency pair |
type | String | Yes | Default: step0: do not merge, value: step0, step1, step2, step3, step4, step5 |
limit | String | Yes | Default 500 |
Response:
{
" code ": "00000" ,
"msg" : "success" ,
"requestTime" : 1622102974025 ,
"data" :{
"asks":[
[ "38084.5" ,
"0.0039"
],
[ "38085.7" ,
"0.0018"
],
[ "38086.7" ,
"0.0310"
],
[ "38088.2" ,
"0.5303"
]
], "bids" :[
[ "38073.7" ,
"0.4993000000000000"
],
[ "38073.4" ,
"0.4500"
],
[ "38073.3" ,
"0.1179"
],
[ "38071.5" ,
"0.2162"
]
], "timestamp" : "1622102974025"
}
}
Spot Account Endpoints
Get Assets
Rate limit rule: 10 requests/1s
HTTP Request
- GET /api/spot/v1/account/assets
Response:
{
" code ": "00000" ,
"message" : "success" ,
"data" :[
{
"coinId" : "10012" ,
"coinName" : "usdt" ,
"available" : "0" ,
"frozen" : "0" ,
"lock" : "0" ,
"uTime" : "1622697148"
}
]
}
Response Field
Field | Description |
---|---|
coinId | Currency id |
coinName | Currency name |
available | Available assets |
frozen | Frozen assets |
lock | Locked assets |
uTime | Updated time |
Get Bill Record
Rate limit rule: 10 requests/1s
HTTP Request
- POST /api/spot/v1/account/bills
Request parameter
Parameters | Type | Required | Description |
---|---|---|---|
coinId | Integer | No | Currency ID |
groupType | String | No | Transaction group type |
bizType | String | No | Business type |
after | String | No | Send in billId, the data before this billId |
before | String | No | Send in the billId, the data after this billId |
limit | Integer | No | default 100, Max. 500 |
Response:
{
" code ": "00000" ,
"message" : "success" ,
"data" :[{
"cTime" : "1622697148" ,
"coinId" : "22" ,
"coinName" : "usdt" ,
"groupType" : "deposit" ,
"bizType" : "transfer-in" ,
"quantity" : "1" ,
"balance" : "1" ,
"fees" : "0" ,
"billId" : "1291"
}]
}
Response Field
Field | Description |
---|---|
cTime | Created time |
coinId | Currency Id |
coinName | Currency name |
groupType | Transaction group type |
bizType | Business type |
quantity | Quantity |
balance | Assets before action |
fees | Transaction fees |
billId | id |
Get Transfer Record
Rate limit rule: 10 requests/1s
HTTP Request
- GET /api/spot/v1/account/transferRecords
Request parameter
Parameters | Type | Required | Description |
---|---|---|---|
coinId | Integer | No | Currency ID |
fromType | String | No | Account Type |
after | Long | No | after transfer balance |
before | Long | No | before transfer balance |
limit | Integer | No | default 100, Max. 500 |
Response:
{
" code ": "00000" ,
"data" :[
{
"coinName": "btc" ,
"status" : "SUCCESS" ,
"toType" : "USD_MIX" ,
"toSymbol" : "" ,
"fromType" : "CONTRACT" ,
"fromSymbol" : "BTC/USD" ,
"amount" : "1000.00000000" ,
"tradeTime" : "1631070374488"
}
],
"msg" : "success" ,
"requestTime" : 1631608142260
}
Response Field
Field | Description |
---|---|
coinName | Currency name |
status | Status |
toType | Transfer in account type |
toSymbol | Transfer to account Symbol |
fromType | Transfer out the account type |
fromSymbol | Transfer in account Symbol |
amount | Number of transfers |
tradeTime | Transfer time |
Spot Trade Endpoints
New Order
Rate limit rule: 10 requests/1s
HTTP Request new order
- POST /api/spot/v1/trade/orders
Request Parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol: /products |
side | String | Yes | Trade Direction |
orderType | String | Yes | Trade Type limit/market |
force | String | Yes | Order Type |
price | String | No | Limit Order Price |
quantity | String | Yes | Amount |
clientOrderId | String | No | Client Order ID |
Response:
{
" code ": "00000" ,
"msg" : "success" ,
"data" :{
"orderId": "1001" ,
"clientOrderId" : "hgXjh89AsxleMSw"
}
}
Response Field
Field | Description |
---|---|
orderId | order id |
clientOrderId | client order id |
Place Multiple Orders
Rate limit rule: 5 requests/1s
HTTP Request: Place Multiple Orders
- POST /api/spot/v1/trade/batch-orders
Request Parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol: /products |
orderList | List | Yes | List of Orders |
- orderList Field
Parameters | Type | Required | Description |
---|---|---|---|
side | String | Yes | Trade Direction |
orderType | String | Yes | Trade Type limit/market |
force | String | Yes | Order Type |
price | String | No | Limit Order Price |
quantity | String | Yes | Amoun |
clientOrderId | String | No | Client Order ID |
Response:
{
" code ": "00000" ,
"msg" : "success" ,
"data" :{
"resultList":[
{
"clientOrderId": "hgXjh89AsxleMSw" ,
"orderId" : "1001"
}
]
}
}
Cancel Order
Rate limit rule: 10 requests/1s
HTTP Request: Cancel order
- POST /api/spot/v1/trade/cancel-order
Request Parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol: /products |
orderId | String | Yes | Order id array |
Response:
{
" code ": "00000" ,
"message" : "success" ,
"data" : "1001"
}
Cancel Multiple Orders
Rate limit rule: 10 requests/1s
HTTP Request: Cancel multiple orders
- POST /api/spot/v1/trade/cancel-batch-orders
Request Parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol: /products |
orderIds | String[] | Yes | Order id array |
Response:
{
" code ": "00000" ,
"message" : "success" ,
"data" :[
"1001" ,
"1002"
]
}
Get Order details
Rate limit rule: 10 requests/1s
HTTP Request: get order details by order ID or client order ID
- POST /api/spot/v1/trade/orderInfo
Request Parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol: /products |
orderId | String | Yes | Order id |
clientOrderId | String | No | Custom order ID |
Response:
{
" code ": "00000" ,
"message" : "success" ,
"data" :[{
"accountId" : "10012" ,
"symbol" : "btcusdt_spbl" ,
"orderId" : "2222222" ,
"clientOrderId" : "xxxxxxx" ,
"price" : "34245.12" ,
"quantity" : "1" ,
"orderType" : "limit" ,
"side" : "buy" ,
"status" : "new" ,
"fillPrice" : "0" ,
"fillQuantity" : "0" ,
"fillTotalAmount" : "0" ,
"cTime" : "1622697148"
}]
}
Response Field
Field | Description |
---|---|
accountId | account id |
symbol | Currency pair name |
orderId | Order id |
clientOrderId | Custom id |
price | price |
quantity | Order quantity |
orderType | Order type |
side | Order direction |
status | status |
fillPrice | Transaction price |
fillQuantity | Transaction quantity |
fillTotalAmount | Total transaction volume |
cTime | Created time |
Get Pending Orders
Rate limit rule: 10 requests/1s
HTTP Request: Get unfilled and partially filled uncanceled orders
- POST /api/spot/v1/trade/open-orders
Request Parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol: /products |
Response:
{
" code ": "00000" ,
"message" : "success" ,
"data" :[{
"accountId" : "10012" ,
"symbol" : "btcusdt_spbl" ,
"orderId" : "2222222" ,
"clientOrderId" : "xxxxxxx" ,
"price" : "34829.12" ,
"quantity" : "1" ,
"orderType" : "limit" ,
"side" : "buy" ,
"status" : "new" ,
"fillPrice" : "0" ,
"fillQuantity" : "0" ,
"fillTotalAmount" : "0" ,
"cTime" : "1622697148"
}]
}
Response Field
Field | Description |
---|---|
accountId | Account ID |
symbol | Currency pair |
orderId | order id |
clientOrderId | Custom id |
price | Order price |
quantity | Order quantity |
orderType | Order type |
side | Order direction |
status | status |
fillPrice | Transaction price |
fillQuantity | Transaction quantity |
fillTotalAmount | Total transaction volume |
cTime | Created time |
Get Traded Order Record
Rate limit rule: 20 requests/1s
HTTP Request: Get all filled and canceled orders
- POST /api/spot/v1/trade/history
Request Parameter
Parameter name | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol: /products |
after | String | No | Use orderId, the data before this orderId desc |
before | String | No | Use orderId, the data after this orderId asc |
limit | Integer | No | The default is 100, max. is 500 |
Response:
{
" code ": "00000" ,
"message" : "success" ,
"data" :[{
"accountId" : "10012" ,
"symbol" : "btcusdt_spbl" ,
"orderId" : "2222222" ,
"clientOrderId" : "xxxxxxx" ,
"price" : "34982.12" ,
"quantity" : "1" ,
"orderType" : "limit" ,
"side" : "buy" ,
"status" : "new" ,
"fillPrice" : "34982.12" ,
"fillQuantity" : "1" ,
"fillTotalAmount" : "34982.12" ,
"cTime" : "1622697148"
}]
}
Response Field
Field | Description |
---|---|
accountId | Account ID |
symbol | Currency pair |
orderId | Order id |
clientOrderId | Custom ID |
price | Order price |
quantity | Order quantity |
orderType | Order type |
side | Order direction |
status | Order status |
fillPrice | Transaction price |
fillQuantity | Transaction quantity |
fillTotalAmount | Total transaction volume |
cTime | Created time |
Get Transaction Details
Rate limit rule: 20 requests/1s
HTTP Request: get transaction detail history
- POST /api/spot/v1/trade/fills
Request Parameter
Parameters | Type | Required | Description |
---|---|---|---|
symbol | String | Yes | Symbol: /products |
orderId | String | No | Order ID |
after | String | No | use in orderId, the data before this orderId desc |
before | String | No | use in the orderId, the data after this orderId asc |
limit | Integer | No | default 100, max. 500 |
Response:
{
" code ": "" ,
"message" : "" ,
"data" :[{
"accountId" : "1001" ,
"symbol" : "btcusdt_spbl" ,
"orderId" : "100021" ,
"fillId" : "102211" ,
"orderType" : "limit" ,
"side" : "buy" ,
"fillPrice" : "38293.12" ,
"fillQuantity" : "1" ,
"fillTotalAmount" : "38293.12" ,
"cTime" : "1622697148" ,
"feeCcy" : "btc" ,
"fees" : "0.0001"
}]
}
Response Field
Field | Description |
---|---|
accountId | Account ID |
symbol | Currency pair |
orderId | Order id |
fillId | Transaction ID |
orderType | Order type |
side | Order direction |
fillPrice | Transaction price |
fillQuantity | Transaction quantity |
fillTotalAmount | Total transaction volume |
cTime | Created time |
feeCcy | Coin for the transaction fee |
fees | Transaction fees |
Common Error Codes
Error Message | Error Code | http status code |
---|---|---|
The request header “ACCESS_KEY” cannot be empty | 40001 | 400 |
The request header “ACCESS_SIGN” cannot be empty | 40002 | 400 |
The request header “ACCESS_TIMESTAMP” cannot be empty | 40003 | 400 |
Invalid ACCESS_TIMESTAMP | 40005 | 400 |
Invalid ACCESS_KEY | 40006 | 400 |
Invalid Content-Type, please use “application/json” format | 40007 | 400 |
The requested timestamp expired | 40008 | 400 |
API verification failed | 40009 | 400 |
The request is too frequent | 429 | 429 |
The request header “ACCESS_PASSPHRASE” cannot be empty | 40011 | 400 |
apikey/passphrase is incorrect | 40012 | 400 |
The user has been frozen | 40013 | 400 |
Incorrect permissions | 40014 | 400 |
System error | 40015 | 400 |
The user must bind a mobile phone or Google Authenticator | 40016 | 400 |
Parameter verification failed | 40017 | 400 |
Illegal IP request | 40018 | 400 |
Spot Error Codes
Error Message | Error Code | http status code |
---|---|---|
Batch processing orders can only process up to 50 | 40912 | 400 |
OrderId or clientId must be passed in one | 40913 | 400 |
The contract configuration does not exist, Please check the parameters | 40102 | 400 |
Server upgrade, please try again later | 40200 | 400 |
Client_oid length is not greater than 40, and cannot be a Martian character | 40305 | 400 |
Wrong format | 40409 | 400 |
Only check the data of the last three months | 40704 | 400 |
Start time is greater than end time | 40707 | 400 |
The parameter is empty | 40724 | 400 |
Spot service returns an error | 40725 | 400 |
Websocket Market Streams
The base API endpoint is: https://api.WEEX.com
A User Data Stream listenKey is valid for 60 minutes after creation.
Doing a PUT on a listenKey will extend its validity for 60 minutes .
Doing a DELETE on a listenKey will close the stream and invalidate the listenKey.
Websocket baseurl: wss://wbs.WEEX.com/ws
User Data Streams are accessed at /ws?listenKey=listenKey
eg:wss://wbs.weex.com/ws?listenKey=pqia91ma19a5s61cv6a81va65sd099v8a65a1a5s61cv6a81va65sdf19v8a65a1
A single connection is only valid for 24 hours; expect to be disconnected at the 24-hour mark.
Each UID can apply for a maximum of 60 listen keys (excluding invalid listen keys).
Each listen key can support up to 5 websocket connections (which means each UID can apply for a maximum of 60 listen keys and 300 websocket links).
Listen Key
Create a ListenKey
Response:
{
"listenKey" : "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
}
Permission: SPOT_ACCOUNT_R
HTTP Method:POST /api/v3/userDataStream
Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent.
Request:
- NONE
Query All ListenKeys
Response:
{
"listenKey" : [
"c285bc363cfeac6646576b801a2ed1f9523310fcda9e927e509aaaaaaaaaaaaaa" ,
"87cb8da0fb150e36c232c2c060bc3848693312008caf3acae73bbbbbbbbbbbb" ,
"dc027517ebee2328b75268461a9df4d21addfac6ebebab8f5a6cccccccccccccc"
]
}
Permission: SPOT_ACCOUNT_R
HTTP Method:GET /api/v3/userDataStream
Retrieve all valid listen keys.
Request:
- NONE
Keep-alive a ListenKey
Response:
{
"listenKey" : "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
}
HTTP Method:PUT /api/v3/userDataStream
Keep alive a user data stream alive to prevent a timeout. User data streams will close after 60 minutes. It’s recommended to send a ping every 30 minutes.
Request:
Name | Type | Mandatory | Description |
---|---|---|---|
listenKey | STRING | YES |
Close a ListenKey
Response:
{
"listenKey" : "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1"
}
HTTP Method:DELETE /api/v3/userDataStream
Close out a user data stream.
Spot Account Update
The server will push an update of the account assets when the account balance changes.
Request:
{
"method" : "SUBSCRIPTION" ,
"params" : [
"spot@private.account.v3.api"
]
}
Response:
{
"c": "spot@private.account.v3.api" ,
"d" : {
" a ": "USDT" ,
"c" : 1678185928428 ,
"f" : "302.185113007893322435" ,
"fd" : "-4.990689704" ,
"l" : "4.990689704" ,
"ld" : "4.990689704" ,
"o" : "ENTRUST_PLACE"
},
"t": 1678185928435
}
Request:spot@private.account.v3.api
Response Fields:
Name | Type | Description |
---|---|---|
d | json | account updates |
> a | string | asset |
> c | long | change time |
> f | string | free balance |
> fd | string | free changed amount |
> l | string | frozen amount |
> ld | string | frozen changed amount |
> o | string | changed type |
t | long | eventTime |
Spot Account Deals
Request:
{
"method" : "SUBSCRIPTION" ,
"params" : [
"spot@private.deals.v3.api"
]
}
Response:
{
"c": "spot@private.deals.v3.api" ,
"d" : {
" p ": "1.804" ,
"v" : "0.31" ,
"a" : "0.55924" ,
"S" : 1 ,
"T" : 1678901086198 ,
"t" : "5bbb6ad8b4474570b155610e30d960cd" ,
"c" : "" ,
"i" : "2dd9655f9fa2438fa1709510d7c1afd9" ,
"m" : 0 ,
"st" : 0 ,
"n" : "0.000248206380027431" ,
"N" : "MX"
},
"s": "MXUSDT" ,
"t" : 1661938980285
}
Request:spot@private.deals.v3.api
Response Fields:
Name | Type | Description |
---|---|---|
d | json | dealsInfo |
> S | int | tradetype 1:buy 2:sell |
> T | long | tradeTime |
> c | string | clientOrderId |
> i | string | orderId |
> m | int | isMaker |
> p | string | price |
> st | byte | isSelfTrade |
> t | string | tradeId |
> v | string | quantity |
> a | string | deals amount |
> n | string | commission fee |
> N | string | commissionAsset |
s | string | symbol |
t | long | eventTime |
Spot Account Orders
Request:
{
"method" : "SUBSCRIPTION" ,
"params" : [
"spot@private.orders.v3.api"
]
}
Request:spot@private.orders.v3.api
1. Limit/Market Orders
Response:
{
"c": "spot@private.orders.v3.api" ,
"d" : {
" A ": 8.0 ,
"O" : 1661938138000 ,
"S" : 1 ,
"V" : 10 ,
"a" : 8 ,
"c" : "" ,
"i" : "e03a5c7441e44ed899466a7140b71391" ,
"m" : 0 ,
"o" : 1 ,
"p" : 0.8 ,
" s " : 1 ,
"v" : 10 ,
"ap" : 0 ,
"cv" : 0 ,
"ca" : 0
},
"s" : "MXUSDT" ,
"t" : 1661938138193
}
Response Fields:
Name | Type | Description |
---|---|---|
d | json | orderInfo |
> A | bigDecimal | remainAmount |
> O | long | createTime |
> S | int | tradetype 1:buy 2:sell |
> V | bigDecimal | remainQuantity |
> a | bigDecimal | amount |
> c | string | clientOrderId |
> i | string | orderId |
> m | int | isMaker |
> o | int | LIMIT_ORDER(1), POST_ONLY(2), IMMEDIATE_OR_CANCEL(3), FILL_OR_KILL(4), MARKET_ORDER(5); STOP_LIMIT(100) |
> p | bigDecimal | price |
> s | int | status 1: New order 2:Filled 3:Partially filled 4:Order canceled 5:Order filled partially, and then the rest of the order is canceled |
> v | bigDecimal | quantity |
> |
ap | bigDecimal | avgPrice |
| > cv | bigDecimal | cumulativeQuantity |
| > ca | bigDecimal | cumulativeAmount |
| t | long | eventTime |
| s | string | symbol |
2. Stop Limit Order
Response:
{
"c" : "spot@private.orders.v3.api" ,
"d" : {
"N" : "USDT" ,
"O" : 1661938853715 ,
"P" : 0 . 9 ,
"S" : 1 ,
"T" : 1 ,
"i" : "f6d82e5f41d745f59fe9d3cafffd80b5" ,
"o" : 100 ,
"p" : 1.01 ,
"s" : "NEW" ,
"v" : 6
}, "s" : "MXUSDT" ,
"t" : 1661938853727
}
Response Fields:
Name | Type | Description |
---|---|---|
d | json | orderInfo |
> N | string | commissionAsset |
> O | long | createTime |
> P | bigDecimal | triggerPrice |
> S | int | tradetype 1:buy 2:sell |
> T | int | 0: GE(price is higher than triggerPrice) 1: LE(price is lower than triggerPrice) |
> i | string | orderId |
> o | int | orderType LIMIT_ORDER(1), POST_ONLY(2), IMMEDIATE_OR_CANCEL(3), FILL_OR_KILL(4), MARKET_ORDER(5); STOP_LIMIT(100) |
> p | bigDecimal | price |
> s | string | state NEW, CANCELED, EXECUTED, FAILED |
> v | bigDecimal | quantity |
s | string | symbol |
t | long | eventTime |
Enhance Earnings with WEEX Affiliate Program
Beyond trading, WEEX also offers an attractive affiliate program. By referring new users, you can earn ongoing commissions from their trading fees. This is an excellent way to generate passive income, especially if you have a network of traders or followers interested in cryptocurrency markets. Visit the WEEX Affiliate Program to learn more and start earning today.
Personal Insight and Recommendations
As a trader myself, I find the WEEX API incredibly intuitive and robust. Its clear documentation and practical examples make it easy even for beginners to get started quickly. Whether you’re automating simple tasks or developing complex trading bots, the API offers everything you need. I highly recommend spending some time exploring the documentation and experimenting with different endpoints to fully leverage its capabilities.
Websocket Streams for Real-Time Updates
For traders who require instant updates, WEEX provides Websocket streams. By creating a listenKey through /api/v3/userDataStream
, you can subscribe to real-time account updates, order status changes, and transaction notifications. Remember, each listenKey is valid for 60 minutes and supports multiple websocket connections, ensuring you never miss critical updates.
Final Thoughts
The WEEX API is a powerful tool designed to enhance your trading experience significantly. By automating repetitive tasks, accessing real-time market data, and managing your account efficiently, you can focus more on strategy and less on manual operations. Dive into the WEEX API documentation today, and take your crypto trading to the next level.
For further details, always refer to the official WEEX API documentation and the introductory guide available here.
Source Reference:WEEX Blog