Changelog
2023-05-22
2023-03-16
2023-02-22
- Supported new function of Futures Pyramiding Auto-Settlement
2023-02-15
- Added order currency fields in endpoints related to market orders, and supported submitting orders using specified cryptos
2023-02-08
- Added endpoint in Acquire Sub-Account
- Added endpoint in “General Asset Transfer in Sub-Accounts”
- Added endpoint in “Authorize Sub-Account”
- Added endpoint in “Acquire Sub-Account Authorizee List”
- Added endpoint in “Delete Sub-Account Authorization”
- Updated endpoint in “Spot Asset Transfer Between Main and Sub-Account”
POST /sub_account/transfer
: Sub-account calls are no longer allowed
- Updated endpoint in “Acquire Transfer Record Between Main and Sub-Account”
GET /sub_account/transfer/history
: Added request parameter start_time, end_time
2022-11-30
- Added function of querying and canceling orders by client_id
2022-11-08
- Added endpoint for “Market Price Subscription, Cancel Market Price Subscription” in Futures Perpetual WebSocket
2022-09-22
- Added
tx_id
parameter to GET /balance/coin/deposit endpoint, supporting filtering query by TxID
2022-09-21
- Supported subscription to the transaction data of all markets in the endpoint of “Latest Transaction Subscription” in Spot and Futures perpetual WebSocket
2022-09-06
- Added endpoint in “Position Adl History Query” for Futures perpetual contracts
2022-07-26
- Added subscription for “BBO (Best-bid-offer)” in Futures Perpetual WebSocket
2022-07-01
- Added endpoint in “Temporary Maintenance Notice Subscription”
2022-06-16
- Updated rules for API rate limit
2022-06-15
- Added endpoint for modifying normal orders
- Added endpoint for modifying stop orders
2022-05-30
- Updated the endpoint description in “Get Site-wide Maintenance Information”
- Updated the endpoint description in “Acquire Partial Maintenance Info”
2022-04-20
- Added Endpoint Error Code
- Added request header
X-Ratelimit-Limit
andX-Ratelimit-Remaining
2022-03-24
- Added
start_time
end_time
parameter for GET /order/finished endpoint to support time rage query
2022-02-23
- Added return parameter withdrawal_precision for /common/asset/config endpoint
2022-02-11
- Added Endpoint Error Code
2022-01-14
- Added endpoint in Create Sub-Account APIKEY
- Endpoint path:
POST /sub_account/auth/api
- Endpoint path:
- Added endpoint in Acquire Sub-Account APIKEY List
- Endpoint path:
GET /sub_account/auth/api
- Endpoint path:
- Added endpoint in Acquire Sub-Account APIKEY Detail
- Endpoint path:
GET /sub_account/auth/api/<int:user_auth_id>
- Endpoint path:
- Added endpoint in Edit Sub-Account APIKEY
- Endpoint path:
PUT /sub_account/auth/api/<int:user_auth_id>
- Endpoint path:
- Added endpoint in Delete Sub-Account APIKEY
- Endpoint path:
DELETE /sub_account/auth/api/<int:user_auth_id>
- Endpoint path:
2021-12-27
- Added endpoint in Temporary Maintenance Information Query
- Endpoint path:
GET /common/temp-maintain/info
- Endpoint path:
2021-12-17
- Added endpoint in Edit Account Settings
- Endpoint path:
PUT /account/settings
- Note: Added settings for CET deduction
- Endpoint path:
2021-12-14
- Added endpoint in Create Sub-Account
- Endpoint path:
POST /sub_account/register
- Endpoint path:
- Added endpoint in Freeze Sub-Account
- Endpoint path:
PUT /sub_account/frozen
- Endpoint path:
- Added endpoint in Unfreeze Sub-Account
- Endpoint path:
PUT /sub_account/unfrozen
- Endpoint path:
2021-11-22
- Refactored API documentation
About Market Makers
CoinEx Market Makers are professional traders and everyone is welcome to apply with any one of the mentioned conditions met:
Individuals or professional institutions who trade via API services and reach a monthly trading volume of 5,000,000 USD in spot/futures markets.
Enjoy the below privileges by becoming CoinEx Market Maker:
- Trading Benefits
- Special Fees
- Exclusive Withdrawal Quota
- Interest-free Credit
- API Service
- Fee Rebate
- Service Benefits
- Exclusive MM Manager
- 24/7 Customer Service
- Holiday Gifts
- Exclusive Events
CoinEx reserves the rights of final explanation of Market Maker application.
For more details, please refer to the page of CoinEx Market Maker >
Introduction
Welcome to CoinEx Developer Documentation.
This documentation outlines trading functions, market data and other application development endpoints.The services and functions provided by CoinEx will be updated in this documentation. Please pay attention to the change log.
Through the API documentation, you can query the explanation of the endpoint to help you understand and develop the corresponding functions more easily.
Basic Information
- Base URL:
https://api.coinex.com/v1
- All API request headers need to add
Content-Type: "application/json"
andUser-Agent
- APIs that require signature need to add
authorization
in the header - Please first check the HTTP status code of Response, and make sure that it indicates 200 before parsing Response
- All Requests and Responses use
json
. - Account and transaction-related API endpoints require signatures, while market-related API endpoints do not
Before signing, you need to go to CoinEx-Personal Center-API Key and create a new API key
- Access_id: API key ID
- Secret_key: The secret key used to sign the requested data
Access_id and Secret_key are of the same importance as your account password. For account and assets safety, please change your secret key regularly.Once you lose your secret key, please go to CoinEx to remove the secret key in time.
- Each API endpoint has its corresponding group, and each group has a corresponding request limit rate
The rate limit in each group is set according to its characteristics. As a matter of fact, the rate limit is the request margin of the group, where the request frequency of each endpoint in the group will deduct its group margin, until all the deductions are made. In this case, all endpoint requests in the group will be limited.
E.g. The group rate limit for cancelling Spot orders is 120r/2s. If the endpoint request limit of POST /order/limit placing limit orders is 40/2s, then the remaining margin for the rest of endpoints in the group (DELETE /order /pending, POST /order/market, etc.) will be 80r/2s.
- IP Rate Limit Rule
- Rate limit: 400/s
- Account Rate Limit Rule (Spot)
- The main and sub-accounts are separately rate-limited and do not affect each other.
Endpoint type | Limit | Endpoint path included |
---|---|---|
Order Place & Cancel | 60r/2s | POST /order/limit Place limit order POST /order/market Place market order POST /order/stop/limit Place stop limit order POST /order/stop/market Place stop limit order Order POST /order/ioc Place IOC (Immediate or Cancel) order DELETE /order/pending Cancel all orders DELETE /order/stop/pending/<int:order_id> Cancel unexecuted stop orderPOST /order/modify Modify order POST /order/stop/modify Modify stop order |
Order Batch Place & Cancel | 20r/2s | POST /order/limit/batch Place limit orders in batches DELETE /order/pending/batch Cancel orders in batches DELETE /order/stop/pending Cancel all unexecuted stop orders |
Spot Order Query | 100r/2s | GET /order/status Query order status GET /order/status/batch Query order status in batches GET /order/pending Query unexecuted orders GET /order/stop/pending Query unexecuted orders of stop orders |
Spot Order History Query | 20r/2s | GET /order/deals Query executed order details GET /order/user/deals Query user transaction history GET /order/finished Query order history GET /order/stop/finished Query stop order history |
Spot Account Change | 20r/2s | PUT /account/settings Change account settings POST /margin/loan Loan under Margin account POST /margin/flat Repayment under Margin account POST /margin/transfer Asset transfer from Spot to Margin PUT /sub_account/frozen Freeze sub-account PUT /sub_account/unfrozen Unfreeze sub-account PUT /sub_account/auth/api/<int:user_auth_id> Edit sub-account APIKEY POST /sub_account/transfer Spot asset transfer from main to sub-account POST /sub_account/register Create sub-account POST /sub_account/auth/api Create sub-account APIKEY DELETE /sub_account/auth/api/<int:user_auth_id> Delete sub-account APIKEY PUT /balance/deposit/address/<string:coin_type> Update deposit address POST /balance/coin/withdraw Submit withdrawal request DELETE /balance/coin/withdraw Cancel withdrawal request POST /contract/balance/transfer Asset transfer from Spot to Futures |
Spot Account Query | 20r/2s | GET /balance/info Acquire account info, applicable to Spot markets GET /account/market/fee Acquire trading fee rate GET /account/amm/balance Acquire AMM account info GET /account/investment/balance Acquire Financial account info GET /credit/info Acquire Credit account info GET /credit/balance Acquire Credit account balance GET /sub_account/auth/api Acquire sub-account APIKEY list GET /sub_account/auth/api/<int:user_auth_id> Acquire sub-account APIKEY detail GET /balance/deposit/address/<string:coin_type> Query deposit address |
Spot Account History Query | 20r/2s | GET /balance/coin/withdraw Acquire withdrawal history GET /balance/coin/deposit Acquire deposit history GET /account/balance/history Query user turnover GET /investment/transfer/history Spot - Financial account transfer history GET /margin/transfer/history Margin - Spot account transfer history GET /margin/loan/history Acquire loan history in Margin account GET /contract/transfer/history Spot - Futures account transfer history GET /sub_account/transfer/history Acquire asset transfer from main to sub-account |
- Account Rate Limit Rule (Futures)
- The main and sub-accounts are separately rate-limited and do not affect each other.
Endpoint type | Limit | Endpoint path included |
---|---|---|
Futures Order Place & Cancel | 40r/2s | POST:/perpetual/v1/order/put_limit Place limit order POST:/perpetual/v1/order/put_market Place market order POST:/perpetual/v1/order/put_stop_limit Place limit stop order POST:/perpetual/v1/order/put_stop_market Place market stop order POST:/perpetual/v1/order/cancel Cancel orders POST:/perpetual/v1/order/cancel_stop Cancel stop orders POST:/perpetual/v1/order/close_limit Limit close POST:/perpetual/v1/order/close_market Market close POST:/perpetual/v1/position/adjust_margin Adjust position margin POST:/perpetual/v1/position/stop_loss Set position TP POST:/perpetual/v1/position/take_profit Set position SL POST:/perpetual/v1/position/market_close Market close all POST:/perpetual/v1/order/modify Modify order POST:/perpetual/v1/order/modify_stop Modify stop order |
Futures Order Batch Cancel | 20r/2s | POST:/perpetual/v1/order/cancel_all Cancel all orders POST:/perpetual/v1/order/cancel_batch Cancel orders in batches POST:/perpetual/v1/order/cancel_stop_all Cancel all stop orders |
Futures Order Query | 100r/2s | GET:/perpetual/v1/order/pending Query pending orders GET:/perpetual/v1/order/stop_pending Query pending stop orders GET:/perpetual/v1/order/status Order status GET:/perpetual/v1/order/stop_status Stop order status |
Futures Order History Query | 20r/2s | GET:/perpetual/v1/order/finished Query finished orders GET:/perpetual/v1/order/stop_finished Query finished stop orders |
Futures Account Query | 20r/2s | GET:/perpetual/v1/asset/query Asset query GET:/perpetual/v1/position/funding Query user funding rate history GET:/perpetual/v1/position/pending User position |
- Error Codes and Methods
Error Code | Method |
---|---|
35 | Service unavailable, please try again later. |
213 | Rate limit triggered. Please adjust your strategy and reduce the request rate. |
3008 | Service busy, please try again later. |
【Return example】:
# POST Request
{
"access_id": "4DA36FFC61334695A66F8D29020EB589",
"market": "BTCBCH",
"type": "buy",
"price": "10",
"amount": "1.0",
"tonce": 1513746038205
}
# GET Request
access_id=4DA36FFC61334695A66F8D29020EB589
&market=BTCBCH
&type=buy
&price=680
&amount=1.0
&tonce=1513746038205
# Sorted GET/POST request string and add secret_key
access_id=4DA36FFC61334695A66F8D29020EB589
&amount=1.0
&market=BTCBCH
&price=680
&tonce=1513746038205
&type=buy
&secret_key=B51068CF10B34E7789C374AB932696A05E0A629BE7BFC62F
- Each endpoint has its authorization type, which determines what kind of authorization should be performed when accessing.
- The endpoint requiring signature will be specified in the description. If there is no special statement, it doesn’t require signature by default.
- If authorization is required, it should be passed
authorization
. access_id
andsecret_key
are case sensitive.
Signature Procedures
- Sort parameters alphabetically
- Add
"&secret_key=your_secret_key"
after the sorted string - Use 32-bit
MD5
encrypt and capitalize and put it in the request headerauthorization
- Click to view Demo for signature generation
-
Public Parameter
Parameter Name Description authorization Request header signature tonce Millisecond timestamp, the acceptable error range from server time is ±60s access_id API Key ID secret_key API Key account_id Used to distinguish different types of trading markets
-
Endpoint Error Code
Error Code Description 0 Succeeded 1 Error 2 Invalid argument 3 Internal error 23 IP Prohibited 24 AccessID does not exist 25 Signature error 34 AccessID expired 35 Service unavailable 36 Service timeout 40 Main account and sub-account do not match 49 The transfer to the sub-account was rejected 107 Insufficient balance 158 No permission to use this API 213 Requests submitted too frequently 227 The timestamp is wrong, the timestamp must be within ±60s of the server time 600 Order number does not exist 601 Other users’ orders 602 Below the minimum buying or selling limit 606 The order price deviates too much from the latest transaction price 651 Merge depth error 3008 Service busy, please try again later. -
HTTP Error Code
Error Code Description 200 Succeeded 404 API does not exist
Return example
{
"code": 0,
"data": {},
"message": "Success"
}
-
GET /common/maintain/info
-
Obtain site-wide maintenance information, which is applicable to scenarios where all functions of the site are out of service
-
Return parameter description
name type describe start_time Integer Maintenance start time end_time Integer Maintenance end time url String URL for maintenance announcement
Return example
{
"code": 0,
"data": [
{
"started_at": 1640707200,
"ended_at": 1640793600,
"scope": [
"SPOT",
"PERPETUAL"
]
}
],
"message": "Success"
}
-
GET /common/temp-maintain/info
-
Acquire partial maintenance information, applicable to the scenarios where some functions are out of service
-
Return parameter description
Name Type Description started_at Integer Maintenance start time ended_at Integer Maintenance end time scope List Maintenance scope:
PERPETUAL: Perpetual
SPOT: Spot