Changelog

01-Feb-2024

  • Added endpoint subscription for “BBO (Best-bid-offer)” in Spot WebSocket

25-Jan-2024

  • Supported customized fee currency for withdrawal request endpoint
  • Added field of fee currency for withdrawal history endpoint

04-Jan-2024

20-Sep-2023

  • IMPORTANT NOTICE

Currently, CoinEx has completed the reconstruction of the wallet system - We have upgraded the deposit addresses for all assets, and generated new deposit addresses for all users!Please confirm your new address again before making any deposit! Please DO NOT use any old deposit addresses you may have saved - The old addresses will NO LONGER work and assets sent to them will be permanently lost. Please refer to the official announcement for progress: https://announcement.coinex.com/hc/articles/19187420867348

22-Aug-2023

  • The funding rate collection period and upper/lower data limit has been added in Futures market list.

03-Aug-2023

  • For spot maker rate adjustment of market makers, please refer to Link

15-Jun-2023

08-Jun-2023

  • Added endpoint for "Personal Transaction Info" in Spot and Futures Perpetual WebSocket

22-May-2023

16-Mar-2023

22-Feb-2023

  • Supported new function of Futures Pyramiding Auto-Settlement

15-Feb-2023

  • Added order currency fields in endpoints related to market orders, and supported submitting orders using specified cryptos

08-Feb-2023

30-Nov-2022

  • Added function of querying and canceling orders by client_id

08-Nov-2022

  • Added endpoint for “Market Price Subscription, Cancel Market Price Subscription” in Futures Perpetual WebSocket

22-Sep-2022

  • Added tx_id parameter to GET /balance/coin/deposit endpoint, supporting filtering query by TxID

21-Sep-2022

  • Supported subscription to the transaction data of all markets in the endpoint of “Latest Transaction Subscription” in Spot and Futures perpetual WebSocket

06-Sep-2022

26-Jul-2022

  • Added subscription for “BBO (Best-bid-offer)” in Futures Perpetual WebSocket

01-Jul-2022

16-Jun-2022

  • Updated rules for API rate limit

15-Jun-2022

  • Added endpoint for modifying normal orders
  • Added endpoint for modifying stop orders

30-May-2022

20-Apr-2022

  • Added API endpoint error code
  • Added request header X-Ratelimit-Limit and X-Ratelimit-Remaining

24-Mar-2022

  • Added start_time end_time parameter for GET /order/finished endpoint to support time rage query

23-Feb-2022

  • Added return parameter withdrawal_precision for /common/asset/config endpoint

11-Feb-2022

  • Added API endpoint error code

14-Jan-2022

27-Dec-2021

17-Dec-2021

  • Added endpoint in Edit Account Settings
    • Endpoint path: PUT /account/settings
    • Note: Added settings for CET deduction

14-Dec-2021

22-Nov-2021

  • 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 traders or professional agencies with a monthly trading volume of 1,000,000 USD in spot markets or 5,000,000 USD in futures markets are welcome to apply and become CoinEx Market Maker.

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" and User-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.

  1. IP Rate Limit Rule
  • Rate limit: 400/s
  1. 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 order
POST /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
  1. 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
  1. 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 and secret_key are case sensitive.

Signature Procedures

  1. Sort parameters alphabetically
  2. Add "&secret_key=your_secret_key" after the sorted string
  3. Use 32-bit MD5 encrypt and capitalize and put it in the request header authorization
  4. 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": {
        "started_at":1703833292,
        "ended_at":1703834254,
        "url": "",
        "protect_duration_start": 1703834254,
        "protect_duration_end": 1703834854
    },
    "message": "Success"
}
  • GET /common/maintain/info

  • Acquire site-wide maintenance information, applicable to the 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
    protect_duration_start Integer Protection period start time
    protect_duration_end Integer Protection period end time

Return example

{
    "code": 0,
    "data": [
        {
            "started_at": 1640707200,
            "ended_at": 1640793600,
            "scope": [
                "SPOT",
                "PERPETUAL"
            ],
            "protect_duration_start": 1640793600,
            "protect_duration_end": 1640794200
        }
    ],
    "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: Futures
    SPOT: Spot
    ALL_SITE: Overall maintenance
    protect_duration_start Integer Protection period start time
    protect_duration_end Integer Protection period end time

[

Exclusive MM Contact
Telegram @CoinExvipmanager
Email vip@coinex.com