行情API

示例

// Request

// Response
{
    "code": 0,
    "data": [
        "LTCBCH",
        "ETHBCH",
        "ZECBCH",
        "DASHBCH"
    ],
    "message": "Ok"
}
  • GET /market/list
  • 獲取所有市場列表,適用於幣幣和槓桿市場
  • 是否需要簽名:否

示例

// Request

// Response
{
  "code": 0,
  "message": "Ok",
  "data":
  {
    "XRPBTC": 
    {
      "taker_fee_rate": "0.001",
      "pricing_name": "BTC",
      "trading_name": "XRP",
      "min_amount": "0.001",
      "name": "XRPBTC",
      "trading_decimal": 8,
      "maker_fee_rate": "0.001",
      "pricing_decimal": 8
    },
    "CETUSDC": 
    {
      "taker_fee_rate": "0.001",
      "pricing_name": "USDC",
      "trading_name": "CET",
      "min_amount": "0.001",
      "name": "CETUSDC",
      "trading_decimal": 8,
      "maker_fee_rate": "0.001",
      "pricing_decimal": 8
    }
  }
}
  • GET /market/info
  • 獲取所有市場詳細信息,適用於幣幣和槓桿市場
  • 是否需要簽名:否

  • 返回參數說明

    名稱 類型 描述
    name String 市場名稱
    taker_fee_rate String taker 費率
    maker_fee_rate String maker 費率
    min_amount String 最小交易量
    trading_name String 交易幣種
    trading_decimal Integer 交易幣種精度
    pricing_name String 定價幣種
    pricing_decimal Integer 定價幣種精度

示例

// Request
market=BTCUSDT

// Response
{
  "code": 0,
  "message": "Ok",
  "data":
    {
      "taker_fee_rate": "0.001",
      "pricing_name": "USDT",
      "trading_name": "BTC",
      "min_amount": "0.001",
      "name": "BTCUSDT",
      "trading_decimal": 8,
      "maker_fee_rate": "0.001",
      "pricing_decimal": 8
    }
}
  • GET /market/detail
  • 獲取單個市場詳細信息,適用於幣幣和槓桿市場
  • 是否需要簽名:否
  • 請求參數說明

    名稱 類型 是否必須 描述
    market String Yes 市場名稱
  • 返回參數說明

獲取所有市場信息接口

示例

// Request
market=ETHUSDT
&merge=0.01
&limit=10

// Response
{
  "code": 0,
  "data": {
    "last": "10.00",
    "time": 1539764050033,
    "asks": [
      [
        "10.00", 
        "0.9999"
      ]
    ],
    "bids": [
      [
        "10.00",
        "1.0000"
      ]
    ]
  },
  "message": "Ok"
}
  • GET /market/depth
  • 獲取單個市場深度,適用於幣幣和槓桿市場
  • 是否需要簽名:否
  • 最大深度50

  • 請求參數說明

    名稱 類型 是否必須 描述
    market String Yes 市場名稱
    merge String Yes ‘0’, ‘0.1’, ‘0.01’, ‘0.001’, ‘0.0001’, ‘0.00001’, ‘0.000001’, ‘0.0000001’, ‘0.00000001
    limit Interger No(Default20) 返回數量,range: 5/10/20/50
  • 返回參數說明

    名稱 類型 描述
    last String 最新成交價
    time Long 深度更新時間
    asks Array 賣方深度
    asks[0][0] String 下單價格
    asks[0][1] String 下單量
    bids Array 買方深度
    bids[0][0] String 下單價格
    bids[0][1] String 下單量

示例

// Request
market=ETHUSDT
&last_id=0
&limit=10

// Response
{
  "code": 0,
  "data": [
    {
      "amount": "0.0001", # Transaction amount 
      "date": 1494214689, # Transaction time(s) 
      "date_ms": 1494214689067, # Transaction time(ms)
      "id": 5, # Transaction No
      "price": "10.00", # Transaction price
      "type": "buy" # Transaction type: buy, sell
    }
  ],
  "message": "Ok"
}
  • GET /market/deals
  • 獲取單個市場最新交易數據,適用於幣幣和槓桿市場
  • 是否需要簽名:否
  • 最大返回1000條記錄

  • 請求參數說明

    名稱 類型 是否必須 描述
    market String Yes 市場名稱
    last_id Integer No 交易id,0代表從最新記錄獲取
    limit Integer No(default 100) 最大1000
  • 返回參數說明

    名稱 類型 描述
    id Integer 交易id
    date Integer 交易時間戳
    date_ms Integer 交易毫秒時間戳
    amount String 交易量
    price String 交易價
    type String buy;
    sell;

示例

// Request
market=ETHUSDT
&type=1day
&limit=10

// Response
{
    "code": 0,
    "data": [
        [
            1492358400,
            "10.0",
            "10.0",
            "10.0",
            "10.0",
            "10",
            "100",
        ]
    ],
  "message": "Ok"
}
  • GET /market/kline
  • 獲取單個市場k線數據,適用於幣幣和槓桿市場
  • 是否需要簽名:否
  • 最大返回1000條記錄

  • 請求參數說明

    名稱 類型 是否必須 描述
    market String Yes 市場名稱
    limit Integer No(default 100) 最大1000
    type String Yes 1min:1min;
    3min:3min;
    5min:5min;
    15min:15min;
    30min:30min;
    1hour:1hour;
    2hour:2hour;
    4hour:4hour;
    6hour:6hour;
    12hour:12hour;
    1day:1day;
    3day:3day;
    1week:1week;
  • 返回參數說明

    名稱 類型 描述
    data[0][0] Integer 時間戳
    data[0][1] String 開盤價
    data[0][2] String 收盤價
    data[0][3] String 最高價
    data[0][4] String 最低價
    data[0][5] String 交易量
    data[0][6] String 交易額

示例

// Request
market=ETHUSDT

// Response
{
    "code": 0,
    "data": {
        "date": 1513865441609, # server time when returning
        "ticker": {
            "buy": "10.00", # buy 1
            "buy_amount": "10.00", # buy 1 amount
            "open": "10", # highest price
            "high": "10", # highest price
            "last": "10.00", # latest price 
            "low": "10", # lowest price
            "sell": "10.00", # sell 1
            "sell_amount": "0.78", # sell 1 amount
            "vol": "110" # 24H volume
        }
    },
  "message": "Ok"
}
  • GET /market/ticker
  • 獲取單個市場統計數據,適用於幣幣和槓桿市場
  • 是否需要簽名:否
  • 請求參數說明

    名稱 類型 是否必須 描述
    market String Yes 市場名稱
  • 返回參數說明

    名稱 類型 描述
    date String 服務器時間
    last String 最新成交價
    buy String 買一價
    buy_amount String 買一量
    sell String 賣一價
    sell_amount String 賣一量
    open String 24小時開盤價
    high String 24小時最高價
    low String 24小時最低價
    vol String 24小時成交量

示例

// Request

// Response
{
    "code": 0,
    "data": {
        "date": 1513865441609,
        "ticker": {
            "BCHBTC": {
                "buy": "0.222",
                "buy_amount": "0.1",
                "open": "0.2322211",
                "high": "0.2322211",
                "last": "0.2322211",
                "low": "0.222",
                "sell": "0.3522211",
                "sell_amount": "0.11",
                "vol": "2.01430624"
            },
        }
    },
    "message": "Ok"
}
  • GET /market/ticker/all
  • 獲取所有市場統計數據,適用於幣幣和槓桿市場
  • 是否需要簽名:否
  • 返回參數說明

獲取單個市場統計接口

示例

// Request

// Response
{
    "code": 0,
    "data": {
        "USDT_to_USD": "1.00128491",
        "USDC_to_USD": "1",
        "BTC_to_USD": "60079.09716983",
        "BCH_to_USD": "600.770946",
        "ETH_to_USD": "4163.84190845",
        "CET_to_USD": "2.00256982"
    },
    "message": "Success"
}
  • GET /common/currency/rate
  • 獲取所有幣種對USD的匯率
  • 是否需要簽名:否
  • 返回參數:各個幣種對USD的匯率

示例

// Request
coin_type=CET

// Response
{
    "code": 0,
    "data": {
        "CET-CSC": {
            "asset": "CET",
            "chain": "CSC",
            "can_deposit": true,
            "can_withdraw": false,
            "deposit_least_amount": "1",
            "withdraw_least_amount": "1",
            "withdraw_tx_fee": "0.1"
        },
        "CET-ERC20": {
            "asset": "CET",
            "chain": "ERC20",
            "can_deposit": true,
            "can_withdraw": false,
            "deposit_least_amount": "14",
            "withdraw_least_amount": "14",
            "withdraw_tx_fee": "14"
        }
    },
    "message": "Success"
}
  • GET /common/asset/config
  • 獲取所有資產配置
  • 是否需要簽名:否
  • 請求參數說明

    名稱 類型 是否必須 描述
    coin_type String No 幣種名稱
  • 返回參數說明

    名稱 類型 描述
    can_deposit Bool 充值狀態
    can_withdraw Bool 提現狀態
    deposit_least_amount String 充值最小量
    withdraw_least_amount String 提現最小量
    withdraw_tx_fee String 提現費率
    withdrawal_precision String 提現精度
    asset String 幣種
    chain String 幣種所在的公鏈

示例

// Request

// Response
{
    "code": 0,
    "data": [
        "CETUSDT",
        "USDCUSDT",
        "ETHBTC",
        "ACMUSDT",
        "ARDRUSDT",
        "ARDRTUSD",
        "AYAUSDT",
        "AYAETH",
        "KUNBTC",
        "KUNBCH",
        "KUNETH",
        "KUNTUSD",
        "LFTBTC",
        "PAXUSDT",
        "SNXUSDT",
        "SNXBTC",
        "SNXBCH",
        "SNXETH",
        "SYSUSDT",
        "XRPUSDC",
        "XRPETH"
    ],
    "message": "Success"
}
  • GET /amm/market
  • 獲取AMM市場列表
  • 是否需要簽名:否
  • 返回參數

示例

// Request

// Response
{
    "code": 0,
    "data": {
        "CETBCH": 3,
        "BTCUSDC": 4,
        "XRPPAX": 7,
        "ETHUSDC": 9,
        "BCHUSDT": 10,
        "LTCUSDT": 11,
        "XRPUSDT": 12,
        "HCBTC": 13,
        "ETHUSDT": 1,
        "ETCUSDT": 15,
        "BTCUSDT": 2,
        "ETHBTC": 16,
        "HCUSDT": 17,
        "BSVUSDT": 19,
        "OMGUSDT": 20,
        "OMGUSDC": 22,
        "OMGTUSD": 23,
        "BANUSDT": 24,
        "BANUSDC": 25
    },
    "message": "Success"
}
  • GET /margin/market
  • 獲取槓桿市場列表
  • 是否需要簽名:否
  • 請求參數:無

賬戶API

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": {
        "BTC": {
            "available": "9080.84156954",
            "frozen": "1"
        },
        "USDT": {
            "available": "43724611.65252752",
            "frozen": "1897.84472856"
        },
        "CET": {
            "available": "6524.13695056",
            "frozen": "0"
        },
        "ETH": {
            "available": "10000",
            "frozen": "0"
        }
    },
    "message": "Success"
}
  • GET /balance/info
  • 是否需要簽名:是
  • 獲取賬戶信息,適用於現貨交易市場
  • 當幣種資產(可用+凍結)為0時,無幣種數據返回

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數說明

    名稱 描述
    frozen 凍結量
    available 可用量
    lock 鎖定量

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&sub_user_name=sub_user
&coin_type=BTC

// Response
{
    "code": 0,
    "data": {
        "sun": {
            "BTC": {
                "available": "99",
                "frozen": "0"
            }
        }
    },
    "message": "Success"
}
  • GET /sub_account/balance
  • 是否需要簽名:是
  • 獲取子賬號現貨餘額信息
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    sub_user_name String No 子賬號名
    coin_type String No 幣種名稱
  • 返回參數說明

    名稱 描述
    available 可用數量
    frozen 凍結數量

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": [
        {
            "market": "ETHBTC",
            "base_asset": "ETH",
            "quote_asset": "BTC",
            "base_amount": "944.24670636",
            "quote_amount": "65.46687196"
        }
    ],
    "message": "Success"
}
  • GET /account/amm/balance
  • 是否需要簽名:是
  • 獲取AMM賬戶信息
  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數說明

    名稱 描述
    market 市場
    base_asset 基準資產
    quote_asset 標價資產
    base_amount 基準資產數量
    quote_amount 標價資產數量

返回示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": [
        {
            "asset": "CET",
            "available": "0",
            "frozen": "0"
        },
        {
            "asset": "USDT",
            "available": "999900",
            "frozen": "0"
        }
    ],
    "message": "Success"
}
  • GET /account/investment/balance

  • 是否需要簽名:是

  • 獲取理財賬戶信息

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數說明

    名稱 描述
    asset 資產
    available 可用數量
    frozen 凍結數量

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": {
        "withdraw_rate": "1.4",
        "trade_rate": "2",
        "current_balance": "6506574.34065785",
        "unflat_balance": "6336010.61421221",
        "can_withdraw_balance": "6506574.34065785",
        "can_trade_balance": "6506574.34065785",
        "current_rate": "1.02691973"
    },
    "message": "Success"
}
  • GET /credit/info

  • 是否需要簽名:是

  • 獲取賬戶授信信息

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數說明

    名稱 描述
    withdraw_rate 可提現風險率
    trade_rate 可交易風險率
    current_balance 賬戶總資產市值
    unflat_balance 待還市值
    can_withdraw_balance 可提現金額市值
    can_trade_balance 可交易金額市值
    current_rate 風險率

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT

// Response
{
    "code": 0,
    "data": {
        "account_id": 2,
        "leverage": 10,
        "market_type": "BTCUSDT",
        "sell_asset_type": "BTC",
        "buy_asset_type": "USDT",
        "balance": {
            "sell_type": "2",
            "buy_type": "0"
        },
        "frozen": {
            "sell_type": "0",
            "buy_type": "0"
        },
        "loan": {
            "sell_type": "0",
            "buy_type": "0"
        },
        "interest": {
            "sell_type": "0",
            "buy_type": "0"
        },
        "can_transfer": {
            "sell_type": "2",
            "buy_type": "0"
        },
        "warn_rate": "",
        "liquidation_price": ""
    },
    "message": "Success"
}
  • GET /margin/account
  • 是否需要簽名:是
  • 獲取市場槓桿賬戶

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String Yes 市場
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回結果:

    名稱 類型 描述
    account_id Integer 槓桿賬戶ID
    leverage Integer 最大槓桿倍數
    market_type String 市場名稱
    sell_asset_type String 交易幣種
    buy_asset_type String 定價幣種
    balance Object 資產
    frozen Object 凍結的金額
    loan Object 借出的金額
    interest Object 利息
    can_transfer Object 可劃轉的金額
    warn_rate String 風險率
    liquidation_price String 爆倉價
    sell_type String 交易幣種數量
    buy_type String 定價幣種數量

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT

// Response
{
    "code": 0,
    "data": {
        "market": "BTCUSDT",
        "leverage": 10,
        "day_rate": "0.0009",
        "BTC": {
            "min_amount": "0.001",
            "max_amount": "100"
        },
        "USDT": {
            "min_amount": "1",
            "max_amount": "2000000"
        }
    },
    "message": "Success"
}
  • GET /margin/config
  • 是否需要簽名:是
  • 查詢單一槓桿交易的設置信息,包括最高借貸金額,利息率。

  • 請求參數:

    名稱 類型 是否必須 描述
    market String No 市場名稱
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回結果:

    名稱 類型 描述
    max_amount String 最高貸款額
    min_amount String 最高貸款額
    leverage Integer 最大槓桿倍數
    day_rate String 每日利率
    market String 市場

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": [
        {
            "asset": "USDT",
            "unflat_amount": "98.99999998",
            "interest_amount": "259.29744279"
        }
    ],
    "message": "Success"
}
  • GET /credit/balance

  • 是否需要簽名:是

  • 獲取賬戶授信餘額

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數說明

    名稱 描述
    asset 授信資產
    unflat_amount 未平倉餘額
    intrest_amount 利息總額

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&coin_type=ETH
&status=finish
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "has_next": false,
        "curr_page": 1,
        "count": 1,
        "data": [
            {
                "coin_deposit_id": 14270229,
                "create_time": 1637212022,
                "amount": "200",
                "amount_display": "200",
                "diff_amount": "0",
                "min_amount": "0",
                "actual_amount": "200",
                "actual_amount_display": "200",
                "confirmations": 0,
                "tx_id": "",
                "tx_id_display": "XXXXXXXXXX",
                "coin_address": "XXXXXXXXXX",
                "coin_address_display": "XXXXXXXXXX",
                "add_explorer": "",
                "coin_type": "USDT",
                "smart_contract_name": null,
                "transfer_method": "local",
                "status": "finish",
                "status_display": "finish",
                "remark": "",
                "explorer": ""
            }
        ],
        "total": 1,
        "total_page": 1
    },
    "message": "Success"
}
  • GET /balance/coin/deposit
  • 是否需要簽名:是
  • 獲取充值記錄

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    coin_type String No 幣種名稱
    tx_id String No 交易id
    page Interger Yes 頁碼,從1開始
    Limit Interger Yes 每頁數量,最大100
    Status String No 狀態
    processing:處理中
    confirming:確認中
    cancel:取消
    finish:完成
    too_small:充值金額過小
    to_hot:轉熱錢包
  • 返回參數說明

    名稱 描述
    actual_amount 實際充值量
    actual_amount_display 實際顯示充值量
    add_explorer 充值轉出地址
    amount 充值量
    amount_display 顯示充值量
    coin_address 充值轉入地址
    coin_address_display 顯示充值轉入地址
    coin_deposit_id 充值id
    coin_type 幣種名稱
    confirmations 確認數
    create_time 創建時間戳
    explorer 交易的瀏覽器地址
    remark 備註
    status 狀態
    status_display 顯示狀態
    transfer_method 交易方法
    tx_id 交易id
    tx_id_display 顯示交易id
    min_amount 最小充值額
    smart_contract_name 智能合約名稱

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&asset=USDT
&business=trade
&account_id=0
&start_time=1636451914
&end_time=1681724907
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "data": [
            {
                "time": 1636602204,
                "account": 0,
                "business": "trade",
                "business_id": 35437896,
                "asset": "BTC",
                "change": "0.12995834",
                "balance": "8748.45520473"
            },
            {
                "time": 1636451914,
                "account": 0,
                "business": "trade",
                "business_id": 35437896,
                "asset": "USDT",
                "change": "-6.70000000",
                "balance": "42608970.78871773"
            }
        ],
        "curr_page": 1,
        "has_next": true,
        "count": 10
    },
    "message": "Success"
}
  • GET /account/balance/history
  • 是否需要簽名:是
  • 查詢用戶流水
  • 請求參數說明
名稱 類型 是否必須 描述
asset String No 資產
account_id Integer No 現貨賬戶ID: 0,
槓桿賬戶ID: 見獲取市場槓桿賬戶
start_time Integer No 查詢開始時間
end_time Integer No 查詢結束時間
page Integer Yes 頁數
limit Integer Yes 每頁條數
business String No 業務類型
trade:交易
withdraw:提現
deposit:充值
maker_cash_back:現貨返現
access_id String Yes access_id
tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數說明
名稱 描述
business_id 業務ID
time 創建時間
account 賬戶ID
asset 幣種
change 資產變動額
balance 操作後的餘額
business 業務類型
trade:交易
withdraw:提現
deposit:充值
maker_cash_back:現貨返現

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&business_type=SPOT

// Response
{
    "code": 0,
    "data": {
        "taker": "0.0018",
        "maker": "0.0018"
    },
    "message": "Success"
}
  • GET /account/market/fee

  • 是否需要簽名:是

  • 獲取交易費率

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    market String Yes 市場
    business_type String No 交易類型
    SPOT:現貨(默認)
    PERPETUAL:合約
  • 返回參數說明

    名稱 描述
    taker taker費率
    maker maker費率

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "transfer_account": "sub1",
    "transfer_side": "out",
    "coin_type": "USDT",
    "amount": "1"
}

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

  • POST /sub_account/transfer
  • 是否需要簽名:是
  • 現貨主賬號-子賬號資產劃轉
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    transfer_account String Yes 子賬號名
    transfer_side String Yes “in”表示轉入主賬號, “out”表示主賬號轉出
    coin_type String Yes 幣種名稱
    amount String Yes 轉賬數量

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "from_account": "0",
    "to_account": "1",
    "coin_type": "USDT",
    "amount": "1"
}

// Response
{
    "code": 0,
    "data": null,
    "message": "Success"
}
  • POST /margin/transfer
  • 是否需要簽名:是
  • 現貨-槓桿賬戶資產劃轉

  • 請求參數:

    名稱 類型 是否必須 描述
    from_account Integer Yes 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    to_account Integer Yes 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    coin_type String Yes 幣種名稱
    amount String Yes 轉賬數量
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    access_id String Yes access_id

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "transfer_side": "in",
    "coin_type": "USDT",
    "amount": "1"
}

// Response
{
    "code": 0,
    "data": null,
    "message": "Success"
}
  • POST /contract/balance/transfer

  • 是否需要簽名:是

  • 現貨-合約資產劃轉

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    coin_type String Yes 幣種名稱
    transfer_side String Yes 操作方向
    in:現貨轉入合約賬戶
    out:合約轉入現貨賬戶
    amount String Yes 劃轉數量
  • 返回參數

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "smart_contract_name": "CSC",
    "coin_type": "USDT",
    "coin_address": "0x3886be3128DEF4dEC006116acaf21750c0138Ad6",
    "actual_amount": "1"
}

// Response
{
    "code": 0,
    "data": {
        "actual_amount": "1.00000000",
        "amount": "1.00000000",
        "coin_address": "1KAv3pazbTk2JnQ5xTo6fpKK7p1it2RzD4",
        "coin_type": "BCH",
        "coin_withdraw_id": 206,
        "confirmations": 0,
        "create_time": 1524228297,
        "status": "audit",
        "tx_fee": "0",
        "fee_asset": "BCH",
        "fee_amount": "0",
        "tx_id": ""
    },
    "message": "Ok"
}
  • POST /balance/coin/withdraw
  • 是否需要簽名:是
  • 申請提現

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    coin_type String Yes 幣種名稱
    smart_contract_name String No 多協議支持的幣種需要提供,比如USDT可選ERC20,Omni,TRC20
    coin_address String Yes 授權的提現地址,若提現XMR或XMC,需要用”:” 將”address” 和”payment_id” 結合成”xxx:yyy” 的形式,若提現XRP,需要用”:” 將”address” 和”tag” 結合成”xxx:yyy” 的形式,站內轉賬可以填手機號或郵箱
    transfer_method String No 1.onchain – 鏈上轉賬2.local – 站內轉賬
    actual_amount String Yes 提現實際數量,實際指的是扣掉手續費之後實際到賬的數量,費率地址: https://www.coinex.com/fees
    fee_asset String No 提現手續費幣種,預設是提現幣種。支持CET、USDT、USDC、BTC、ETH
  • 返回參數說明

    名稱 描述
    coin_withdraw_id 提現id
    create_time 創建時間戳
    amount 提現數量
    actual_amount 實際提現數量
    tx_id 交易id
    coin_address 提現地址
    fee_asset 提現手續費幣種
    fee_amount 提現手續費數目
    confirmations 確認數
    coin_type 幣種名稱
    status 提現狀態

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&coin_withdraw_id=37503

// Response
{
    "code": 0,
    "data": {},
    "message": "Ok"
}
  • DELETE /balance/coin/withdraw
  • 是否需要簽名:是
  • 取消提現

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    coin_withdraw_id Integer Yes 提現記錄id

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "coin_type": "USDT",
    "market": "ETHUSDT",
    "amount": "50",
    "renew": "1"
}

// Response
{
    "code": 0,
    "data": {
        "loan_id": 1670
    },
    "message": "Success"
}
  • POST /margin/loan
  • 是否需要簽名:是
  • 在槓桿賬戶下貸款
  • 特殊頻率限制:5r/5s

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    market String Yes 市場名稱
    coin_type String Yes 幣種名稱
    amount String Yes 借出量
    renew Integer No 是否自動續期
    0:否<br>1 :是
  • 返回結果:

    名稱 類型 描述
    loan_id Integer 借幣記錄id

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETCUSDT",
    "coin_type": "USDT",
    "amount": "50"
}

// Response
{
    "code": 0,
    "data": null,
    "message": "Success"
}
  • POST /margin/flat
  • 是否需要簽名:是
  • 在槓桿賬戶下償還代幣

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    market String Yes 市場名稱
    coin_type String Yes 幣種名稱
    amount String Yes 還幣數量
    loan_id Integer No 借幣記錄id,當前市場剩餘還幣量還清時不填

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "smart_contract_name": "TRC20"
}

// Response
{
    "code": 0,
    "data": {
        "coin_address": "0x40aa234bcdc528ce411a6020da1a3c07124039d4",
        "is_bitcoin_cash": false
    },
    "message": "Success"
}
  • PUT /balance/deposit/address/<string:coin_type>

  • 是否需要簽名:是

  • 更新充值地址

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    smart_contract_name Integer No 如果某個幣存在多個鏈,需要指定。

    現階段多鏈幣種為USDT, smart_contract_name可選為Omni, ERC20, TRC20

    BTC, smart_contract_name可選為CoinExChain, BTC

    BCH, smart_contract_name可選為CoinExChain, BCH

    USDH, smart_contract_name可選為CoinExChain, SLP

    CET, smart_contract_name可選為CoinExChain, ERC20

  • 返回參數說明

名稱 描述
coin_address 充值地址
is_bitcoin_cash 是否比特幣現金(BCH)

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&smart_contract_name=TRC20

// Response
{
    "code": 0,
    "data": {
        "coin_address": "0x40aa234bcdc528ce411a6020da1a3c07124039d4",
        "is_bitcoin_cash": false
    },
    "message": "Success"
}
  • GET /balance/deposit/address/<string:coin_type>
  • 是否需要簽名:是
  • 查詢充值地址

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    smart_contract_name Integer No 如果某個幣存在多個鏈,需要指定。

    現階段多鏈幣種為USDT, smart_contract_name可選為Omni, ERC20, TRC20

    BTC, smart_contract_name可選為CoinExChain, BTC

    BCH, smart_contract_name可選為CoinExChain, BCH

    USDH, smart_contract_name可選為CoinExChain, SLP

    CET, smart_contract_name可選為CoinExChain, ERC20

  • 返回參數說明
名稱 描述
coin_address 充值地址
is_bitcoin_cash 是否比特幣現金(BCH)

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&asset=USDT
&op_type=out
&start_time=1636451914
&end_time=1681724907
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "records": [
            {
                "id": 5063,
                "created_at": 1636330200,
                "updated_at": 1636330200,
                "success_at": 1636330200,
                "report_date": 1636329600,
                "user_id": 305,
                "investment_account_id": 2,
                "asset": "BTC",
                "amount": "0.00001052",
                "opt_type": "INTEREST",
                "day_rate": "0",
                "status": "SUCCESS"
            }
        ],
        "total": 495
    },
    "message": "Success"
}
  • GET /investment/transfer/history
  • 現貨-理財賬戶轉賬記錄
  • 請求參數說明
名稱 類型 是否必須 描述
asset String No 資產
op_type String No 操作
IN:現貨轉入理財賬戶
OUT:理財轉入現貨賬戶
INTEREST:利息
start_time Integer No 查詢開始時間
end_time Integer No 查詢結束時間
page Integer Yes 頁數
limit Integer Yes 每頁條數
  • 返回參數說明
名稱 描述
id 轉賬ID
create_at 創建時間
update_at 更新時間
success_at 轉賬成功時間
asset 操作的資產
amount 數量
opt_type 操作
IN:現貨轉入理財賬戶
OUT:理財轉入現貨賬戶
INTEREST:利息
day_rate 日收益率
status 狀態

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&sub_user_name=sub1
&coin_type=USDT
&start_time=1636451914
&end_time=1681724907
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "curr_page": 1,
        "has_next": false,
        "per_page": 10,
        "total_page": 1,
        "count": 4,
        "data": [
            {
                "time": 1636443179,
                "transfer_from": "sun",
                "transfer_to": "",
                "coin_type": "BTC",
                "amount": "1",
                "status": "success"
            }
        ],
        "total": 4
    },
    "message": "Success"
}
  • GET /sub_account/transfer/history

  • 是否需要簽名:是

  • 獲取主賬號-子賬號劃轉記錄

  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    sub_user_name String No 子賬號名
    coin_type String No 幣種名稱
    start_time Integer No 查詢開始時間(時間戳)
    end_time Integer No 查詢結束時間(時間戳)
    page Integer Yes 頁數
    limit Integer Yes 每頁條數(最大500條)
  • 返回參數說明

    名稱 描述
    time 轉賬時間
    transfer_from 轉賬發起方
    transfer_to 轉賬接收方(轉賬發起方和接收方默認只給出一個)
    from_account_type 轉出賬戶
    PERPETUAL: 合約賬戶
    SPOT: 現貨賬戶
    to_account_type 轉入賬戶
    PERPETUAL: 合約賬戶
    SPOT: 現貨賬戶
    coin_type 幣種名稱
    amount 轉賬數量
    status 轉帳狀態

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&status=finish
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "page": 1,
        "limit": 10,
        "total": 9,
        "data": [
            {
                "loan_id": 1666,
                "create_time": 1635736743,
                "market_type": "BTCUSDT",
                "coin_type": "BTC",
                "day_rate": "0.0008",
                "loan_amount": "99.99",
                "unflat_amount": "0",
                "expire_time": 1636600743,
                "is_renew": true,
                "status": "finish"
            },
            {
                "loan_id": 1665,
                "create_time": 1635736729,
                "market_type": "BTCUSDT",
                "coin_type": "BTC",
                "day_rate": "0",
                "loan_amount": "0.01",
                "unflat_amount": "0",
                "expire_time": 1636600729,
                "is_renew": true,
                "status": "finish"
            }
        ]
    },
    "message": "Success"
}
  • GET /margin/loan/history
  • 是否需要簽名:是
  • 獲取槓桿賬戶借幣記錄

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    market String No 市場名稱
    status String No 狀態
    page Integer Yes 頁碼,從1 開始
    limit Integer Yes 每頁條數,最大100
  • 返回結果:

    名稱 類型 描述
    loan_id Integer 借幣記錄ID
    create_time Integer 創建時間戳
    market_type String 市場名稱
    coin_type String 幣種名稱
    loan_amount String 借入金額
    unflat_amount String 需要償還的金額和利息
    expire_time Integer 過期時間
    is_renew Integer 是否自動續期,0: 關閉; 1: 開啟;
    day_rate String 每日利率
    status String pass: 借幣中;
    burst: 爆倉;
    arrears: 欠款中;
    finish: 已還幣;

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&asset=USDT
&transfer_type=transfer_in
&start_time=1636451914
&end_time=1681724907
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "records": [
            {
                "amount": "12",
                "asset": "USDT",
                "transfer_type": "transfer_out",
                "created_at": 1637287786
            },
            {
                "amount": "1",
                "asset": "BTC",
                "transfer_type": "transfer_in",
                "created_at": 1637287666
            },
            {
                "amount": "10002",
                "asset": "USDT",
                "transfer_type": "transfer_in",
                "created_at": 1637287619
            }
        ],
        "total": 3
    },
    "message": "Success"
}
  • GET /contract/transfer/history
  • 現貨-合約賬戶劃轉記錄
  • 請求參數說明
名稱 類型 是否必須 描述
asset String No 資產
transfer_type String No 操作
transfer_in:現貨轉入合約賬戶
transfer_out:合約轉入現貨賬戶
start_time Integer No 查詢開始時間
end_time Integer No 查詢結束時間
page Integer Yes 頁數
limit Integer Yes 每頁條數
access_id String Yes access_id
tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數說明
名稱 描述
create_at 創建時間
asset 操作的資產
amount 數量
transfer_type 操作
transfer_in:現貨轉入合約賬戶
transfer_out:合約轉入現貨賬戶

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&asset=USDT
&transfer_type=in
&start_time=1636451914
&end_time=1681724907
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "records": [
            {
                "id": 2612,
                "updated_at": 1635846838,
                "user_id": 1527,
                "from_account_id": 0,
                "to_account_id": 2,
                "asset": "BTC",
                "amount": "1",
                "balance": "2",
                "transfer_type": "IN",
                "status": "SUCCESS",
                "created_at": 1635846838
            }
        ],
        "total": 6
    },
    "message": "Success"
}
  • GET /margin/transfer/history
  • 是否需要簽名:是
  • 槓桿-現貨賬戶劃轉記錄

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    asset String No 資產類型
    market String No 市場名稱
    transfer_type String No 劃轉方向
    page Integer Yes 頁碼,從1 開始
    limit Integer Yes 每頁條數,最大1000
    start_time Integer No 查詢起始時間
    end_time Integer No 查詢結束時間
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回結果:

    名稱 類型 描述
    id Integer 記錄ID
    updated_at Integer 更新時間
    user_id Integer 用戶id
    from_account_id Integer 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    to_account_id Integer 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    asset String 資產
    amount String 劃轉數量
    balance String 賬戶餘額
    transfer_type String 劃轉方向,IN為轉入槓桿賬戶,OUT為轉出槓桿賬戶
    status String 操作狀態
    created_at Integer 創建時間

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&coin_withdraw_id=37503
&coin_type=USDT
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": [
        {
            "actual_amount": "1.00000000",
            "amount": "1.00000000",
            "coin_address": "1KAv3pazbTk2JnQ5xTo6fpKK7p1it2RzD4",
            "coin_type": "BCH",
            "coin_withdraw_id": 206,
            "confirmations": 0,
            "create_time": 1524228297,
            "status": "audit",
            "tx_fee": "0",
            "fee_asset": "BCH",
            "fee_amount": "0",
            "tx_id": ""
        },
        {
            "actual_amount": "0.10000000",
            "amount": "0.10000000",
            "coin_address": "15sr1VdyXQ6sVLqeJUJ1uPzLpmQtgUeBSB",
            "coin_type": "BCH",
            "coin_withdraw_id": 203,
            "confirmations": 11,
            "create_time": 1515806440,
            "status": "finish",
            "tx_fee": "0",
            "fee_asset": "BCH",
            "fee_amount": "0",
            "tx_id": "896371d0e23d64d1cac65a0b7c9e9093d835affb572fec89dd4547277fbdd2f6"
        },
        {
            "actual_amount": "0.01000000",
            "amount": "0.01000000",
            "coin_address": "1GVVx5UBddLKrckTprNi4VhHSymeQ8tsLF",
            "coin_type": "BCH",
            "coin_withdraw_id": 68,
            "confirmations": 6,
            "create_time": 1514978728,
            "status": "finish",
            "tx_fee": "0",
            "fee_asset": "BCH",
            "fee_amount": "0",
            "tx_id": "f08802fea6745c07e420b92356cf3bcdaa78a00c4a062ef0b9e2de06a3f4d718"
        },
        {
            "actual_amount": "0.00100000",
            "amount": "0.00100000",
            "coin_address": "1GVVx5UBddLKrckTprNi4VhHSymeQ8tsLF",
            "coin_type": "BCH",
            "coin_withdraw_id": 27,
            "confirmations": 0,
            "create_time": 1513933541,
            "status": "cancel",
            "fee_asset": "BCH",
            "fee_amount": "0",
            "tx_fee": "0",
            "tx_id": ""
        }
    ],
    "message": "Ok"
}
  • GET /balance/coin/withdraw
  • 是否需要簽名:是
  • 獲取提現歷史記錄

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    coin_type String No 幣種名稱
    coin_withdraw_id Integer No 提現記錄id
    page Interger Yes 頁碼,從1開始
    limit Interger Yes 每頁數量,最大100
  • 返回參數說明

    名稱 描述
    coin_withdraw_id 提現記錄id
    create_time 創建時間戳
    amount 提現數量
    actual_amount 實際提現數量
    tx_id 交易id
    coin_address 提出地址
    fee_asset 提現手續費幣種
    fee_amount 提現手續費數目
    confirmations 確認數
    coin_type 幣種名稱
    status audit;
    pass;
    processing;
    confirming;
    not_pass;
    cancel;
    finish;
    fail;

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "sub_user_name": "sub2",
    "permissions": [
        "AMM",
        "MARGIN"
    ]
}

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

  • POST /sub_account/register
  • 是否需要簽名:是
  • 創建子賬號(可創建的數量最多為20個)
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    sub_user_name String Yes 子賬號名
    permissions List No 權限列表,不傳表示全部權限
    PERPETUAL: 合約交易權限
    MARGIN: 槓桿交易權限
    AMM: AMM功能
    API: API管理權限

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "sub_user_name": "sub2"
}

// Response
{
    "code": 0,
    "message": "Success",
    "data": {}
}
  • PUT /sub_account/unfrozen
  • 是否需要簽名:是
  • 取消禁用子賬號
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    sub_user_name String Yes 子賬號名

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "sub_user_name": "sub2"
}

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

  • PUT /sub_account/frozen
  • 是否需要簽名:是
  • 禁用子賬號
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    sub_user_name String Yes 子賬號名

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "cet_discount": "True"
}

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

  • PUT /v1/account/settings
  • 是否需要簽名:是
  • 修改賬戶設置

  • 請求參數說明

    名稱 類型 是否必須 描述
    cet_discount Bool No 是否開啟CET抵扣

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "sub_user_name": "sub1",
    "allow_trade": "True",
    "allowed_ips": [
        "1.1.1.1",
        "1.1.1.2"
    ],
    "remark": "test"
}

// Response
{
    "code": 0,
    "data": {
        "user_auth_id": 554,
        "create_time": 1642145331,
        "remark": "2233",
        "access_id": "xxxxxxx",
        "allowed_ips": [
            "1.1.1.1"
        ],
        "allow_withdraw": false,
        "allow_trade": true,
        "is_expires": false,
        "expired_time": 0,
        "secret_key": "xxxxxx"
    },
    "message": "Success"
}
  • POST /sub_account/auth/api

  • 是否需要簽名:是

  • 創建子賬號APIKEY

  • 備註:此API只能由主賬號調用,最多可以為每個子賬號創建50個APIKEY,需要對應子賬號有API管理的權限

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    allow_trade Bool Yes 是否有交易權限,true: 是;false:否
    allowed_ips List Yes 綁定的IP地址(最多可以綁定50個)
    remark String No API備註
    sub_user_name String Yes 子賬號的用戶名
  • 返回參數

    名稱 描述
    user_auth_id APIKEY的唯一ID
    create_time 創建時間
    remark API備註
    access_id access_id
    allowed_ips 綁定的IP地址
    allow_withdraw 是否開通提現權限
    allow_trade 是否開通交易權限
    is_expires APIKEY是否過期(如綁定了IP地址,則默認為永不過期;
    如未綁定IP地址,則此APIKEY的有效期為三個月)
    expired_time 過期時間:
    0: 永久有效
    secret_key secret_key

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&sub_user_name=sub1
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "has_next": false,
        "curr_page": 1,
        "count": 7,
        "data": [
            {
                "user_auth_id": 554,
                "create_time": 1642145331,
                "remark": "2233",
                "access_id": "5EDFCD524C7046B6AD9D10A2510A5BC9",
                "allowed_ips": [
                    "1.1.1.1"
                ],
                "allow_withdraw": false,
                "allow_trade": true,
                "is_expires": false,
                "expired_time": 0
            }
        ],
        "total": 7,
        "total_page": 1
    },
    "message": "Success"
}
  • GET /sub_account/auth/api

  • 是否需要簽名:是

  • 獲取子賬號APIKEY列表

  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    page Integer Yes 頁數
    limit Integer Yes 每頁條數
    sub_user_name String Yes 子賬號的用戶名
  • 返回參數

    名稱 描述
    user_auth_id APIKEY的唯一ID
    create_time 創建時間
    remark API備註
    access_id access_id
    allowed_ips 綁定的IP地址
    allow_withdraw 是否開通提現權限
    allow_trade 是否開通交易權限
    is_expires APIKEY是否過期(如綁定了IP地址,則默認為永不過期;
    如未綁定IP地址,則此APIKEY的有效期為三個月)
    expired_time 過期時間:
    0: 永久有效

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": {
        "user_auth_id": 554,
        "create_time": 1642145331,
        "remark": "2233",
        "access_id": "5EDFCD524C7046B6AD9D10A2510A5BC9",
        "allowed_ips": [
            "1.1.1.1"
        ],
        "allow_withdraw": false,
        "allow_trade": true,
        "is_expires": false,
        "expired_time": 0,
        "secret_key": "xxxx"
    },
    "message": "Success"
}
  • GET /sub_account/auth/api/<int:user_auth_id>

  • 是否需要簽名:是

  • 獲取子賬號APIKEY詳情

  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數

    名稱 描述
    user_auth_id APIKEY的唯一ID
    create_time 創建時間
    remark API備註
    access_id access_id
    allowed_ips 綁定的IP地址
    allow_withdraw 是否開通提現權限
    allow_trade 是否開通交易權限
    is_expires APIKEY是否過期(如綁定了IP地址,則默認為永不過期;
    如未綁定IP地址,則此APIKEY的有效期為三個月)
    expired_time 過期時間:
    0: 永久有效
    secret_key secret_key

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "sub_user_name": "sub1",
    "allow_trade": "True",
    "allowed_ips": [
        "1.1.1.1",
        "1.1.1.2"
    ],
    "remark": "test"
}

// Response
{
    "code": 0,
    "data": {
        "user_auth_id": 554,
        "create_time": 1642145331,
        "remark": "API5",
        "access_id": "5EDFCD524C7046B6AD9D10A2510A5BC9",
        "allowed_ips": [],
        "allow_withdraw": false,
        "allow_trade": true,
        "is_expires": false,
        "expired_time": 1649924698,
        "secret_key": "xxx"
    },
    "message": "Success"
}
  • PUT /sub_account/auth/api/<int:user_auth_id>

  • 是否需要簽名:是

  • 編輯子賬號APIKEY

  • 備註:此API只能由主賬號調用,需要對應子賬號有API管理的權限

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    allow_trade Bool Yes 是否有交易權限,true: 是;false:否
    allowed_ips List Yes 綁定的IP地址(最多可以綁定50個)
    remark String No API備註
    sub_user_name String Yes 子賬號的用戶名
  • 返回參數

    名稱 描述
    user_auth_id APIKEY的唯一ID
    create_time 創建時間
    remark API備註
    access_id access_id
    allowed_ips 綁定的IP地址
    allow_withdraw 是否開通提現權限
    allow_trade 是否開通交易權限
    is_expires APIKEY是否過期(如綁定了IP地址,則默認為永不過期;
    如未綁定IP地址,則此APIKEY的有效期為三個月)
    expired_time 過期時間:
    0: 永久有效
    secret_key secret_key

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": {},
    "message": "Success"
}
  • DELETE /sub_account/auth/api/<int:user_auth_id>

  • 是否需要簽名:是

  • 刪除子賬號APIKEY

  • 備註:此API只能由主賬號調用

  • 請求參數

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回參數

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&sub_user_name=sub1
&frozen=true
&page=1
&limit=100

// Response
{
  "code": 0,
  "data": {
    "curr_page": 1,
    "has_next": false,
    "per_page": 10,
    "total_page": 1,
    "count": 1,
    "data": [
      {
        "user_name": "test_sub",
        "permissions": [
          "PERPETUAL",
          "MARGIN",
          "AMM",
          "API"
        ],
        "frozen": false,
        "managed": false,
        "balance_usd": "0.8"
      }
    ],
    "total": 1
  },
  "message": "Success"
}
  • GET /sub_account/list

  • 是否需要簽名:是
  • 獲取子賬號列表
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    page Integer Yes 頁數
    limit Integer Yes 每頁條數
    sub_user_name String No 子賬號的用戶名
    frozen Bool No 是否禁用
  • 返回參數

    名稱 描述
    user_name 子賬號的用戶名
    frozen 是否禁用
    managed 是否授權
    balance_usd 資產市值
    permissions 權限列表
    PERPETUAL: 合約交易權限
    MARGIN: 槓桿交易權限
    AMM: AMM功能
    API: API管理權限

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "from_user_name": "sub1",
    "to_user_name": "sub2",
    "from_account_type": "SPOT",
    "to_account_type": "SPOT",
    "asset": "USDT",
    "amount": "1"
}

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

  • POST /sub_account/universal-transfer

  • 是否需要簽名:是
  • 子賬號通用資產劃轉
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    from_user_name String No 轉出子賬號名
    to_user_name String No 轉入子賬號名
    from_account_type String Yes 轉出賬戶
    PERPETUAL: 合約賬戶
    SPOT: 現貨賬戶
    to_account_type String Yes 轉入賬戶
    PERPETUAL: 合約賬戶
    SPOT: 現貨賬戶
    asset String Yes 幣種名稱
    amount String Yes 轉賬數量
  • 請求參數from_user_name 和to_user_name 至少提供一個
  • 子賬號和子賬號的劃轉,只允許是子賬號現貨賬戶 劃轉到子賬號現貨賬戶
  • 如果from_user_name 未傳,默認是主賬號轉出
  • 如果to_user_name 未傳,默認是轉入主賬號

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "email": "test@coinex.com",
    "remark": "test",
    "sub_user_name": "sub2"
}

// Response

{
  "code": 0,
  "data": {
    "email": "test@gmail.com",
    "id": 54,
    "remark": "123,",
    "sub_user_name": "test_sub]"
  },
  "message": "Success"
}

  • POST /sub_account/authorize

  • 是否需要簽名:是
  • 授權子賬號
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    sub_user_name String Yes 子賬號名
    email String Yes 被授權人郵箱
    remark String No 備註,不超過50個字符
  • 返回參數

    名稱 描述
    id 授權的唯一ID
    sub_user_name 子賬號的用戶名
    email 被授權人郵箱
    remark 備註

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&sub_user_name=sub2
&page=1
&limit=100

// Response
{
  "code": 0,
  "data": {
    "count": 1,
    "curr_page": 1,
    "data": [
      {
        "email": "test@gmail.com",
        "id": 54,
        "remark": "test_remark",
        "sub_user_name": "test_sub"
      }
    ],
    "has_next": false,
    "total": 1,
    "total_page": 1
  },
  "message": "Success"
}

  • GET /sub_account/authorize

  • 是否需要簽名:是
  • 獲取授權子賬號列表
  • 備註:此API只能由主賬號調用

  • 請求參數說明

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    page Integer Yes 頁數
    limit Integer Yes 每頁條數
    sub_user_name String Yes 子賬號的用戶名
  • 返回參數

    名稱 描述
    id 授權的唯一ID
    sub_user_name 子賬號的用戶名
    email 被授權人郵箱
    remark 備註

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": {},
    "message": "Success"
}
  • DELETE /sub_account/authorize/<int:id>

  • 是否需要簽名:是
  • 刪除子賬號授權
  • 備註:此API只能由主賬號調用

  • 請求參數

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s

交易API

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETHUSDT",
    "type": "buy",
    "price": "1100",
    "amount": "1",
    "account_id": 0,
    "client_id": "client1",
    "source_id": "source1",
    "hide": true,
    "option": "NORMAL"
}

// Response
{
    "code": 0,
    "data": {
        "id": 35435972,
        "create_time": 1636019392,
        "finished_time": null,
        "amount": "0.01000000",
        "price": "56000",
        "deal_amount": "0.01",
        "deal_money": "560.0000000000000000",
        "deal_fee": "0",
        "stock_fee": "0",
        "money_fee": "0",
        "asset_fee": "0.313600000000000000000000",
        "fee_asset": "CET",
        "fee_discount": "0.70",
        "avg_price": "56000",
        "market": "BTCUSDT",
        "left": "0.00000000",
        "maker_fee_rate": "0.0016",
        "taker_fee_rate": "0.0016",
        "order_type": "limit",
        "type": "buy",
        "status": "done",
        "client_id": "abcd222",
        "source_id": "1234"
    },
    "message": "Success"
}
  • POST /order/limit
  • 是否需要簽名:是
  • 下限價單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes 密鑰ID
    market String Yes 市場名稱
    type String Yes 操作
    sell: 賣單;
    buy: 買單;
    amount String Yes 下單量, 最小下單量由市場決定
    price String Yes 訂單價格, 精確到小數點後8位
    source_id String No 用戶定義編號並返回
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    client_id String No client_id是訂單的自定義ID。目前它僅支持大寫和小寫字母,數字,連字符和下劃線,並且應小於32個字節.
    hide Bool No 是否隱藏委託
    true:隱藏
    false:不隱藏
    option String No 下單策略(默認為NORMAL)
    普通: NORMAL,
    立即成交或取消: IOC,
    全部成交或取消: FOK,
    只做maker: MAKER_ONLY
  • 返回結果:

    名稱 類型 描述
    amount String 下單量
    avg_price String 平均成交價格
    create_time Interger 下單時間
    deal_amount String 成交數
    deal_money String 成交量
    finished_time Interger 完成時間
    id Interger 訂單號
    maker_fee_rate String maker費率
    market String 市場名稱
    order_type String limit:限價單;
    market:市價單;
    price String 下單價格
    status String not_deal: 未成交;
    part_deal: 部分成交;
    done: 完全成交;
    taker_fee_rate String taker費率
    type String sell: 賣單;
    buy: 買單;
    client_id String client_id: 用戶自定義訂單ID
    stock_fee String 收取的基準幣種手續費
    money_fee String 收取的標價幣種手續費
    asset_fee String 收取的抵扣手續費的幣種的手續費
    fee_asset String 用於抵扣手續費的幣種(目前只有CET)
    fee_discount String 費率折扣
    left String 訂單剩餘未成交的數量
    source_id String 用戶自定義的source_id

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETHUSDT",
    "account_id": 0,
    "batch_orders": "[{\"type\":\"buy\",\"amount\":\"1\",\"price\":\"1100\"}]"
}

// Response
{
    "code": 0,
    "data": [
        {
            "code": 0,
            "data": {
                "id": 35435969,
                "create_time": 1636018159,
                "finished_time": null,
                "amount": "0.01000000",
                "price": "56000",
                "deal_amount": "0.01",
                "deal_money": "560.0000000000000000",
                "deal_fee": "0.896000000000000000000000",
                "stock_fee": "0",
                "money_fee": "0.896000000000000000000000",
                "asset_fee": "0",
                "fee_asset": null,
                "fee_discount": "1",
                "avg_price": "56000",
                "market": "BTCUSDT",
                "left": "0.00000000",
                "maker_fee_rate": "0.0016",
                "taker_fee_rate": "0.0016",
                "order_type": "limit",
                "type": "buy",
                "status": "done",
                "client_id": "",
                "source_id": "1236"
            },
            "message": "OK"
        } 
    ],
    "message": "Success"
}
  • POST /order/limit/batch
  • 是否需要簽名:是
  • 批量下限價單,在同一市場下多個限價單,數量最高為100單

  • 請求參數:
名稱 類型 是否必須 描述
access_id String Yes access_id
batch_orders String(json) Yes 多訂單json格式字符串
market String Yes 市場名稱
tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
account_id Integer no 現貨賬戶ID: 0,
槓桿賬戶ID: 見獲取市場槓桿賬戶
  • batch_orders參數說明
名稱 類型 是否必須 描述   type String Yes sell: 賣單;
buy: 買單;
  amount String Yes 下單量, 最小下單量由市場決定   price String Yes 訂單價格。8位小數精度   source_id String no 用戶定義id
  • 返回結果:

限價下單接口

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETHUSDT",
    "type": "buy",
    "amount": "1",
    "asset": "ETH",
    "account_id": 0,
    "client_id": "client1"
}

// Response
{
    "code": 0,
    "data": {
        "id": 35435973,
        "create_time": 1636020409,
        "finished_time": null,
        "amount": "1.00000000",
        "amount_asset": "BTC",
        "price": "0",
        "deal_amount": "1",
        "deal_money": "54334.4024000000000000",
        "deal_fee": "0",
        "stock_fee": "0",
        "money_fee": "0",
        "asset_fee": "30.427265344000000000000000",
        "fee_asset": "CET",
        "fee_discount": "0.70",
        "avg_price": "54334.4024",
        "market": "BTCUSDT",
        "left": "0.00000000",
        "maker_fee_rate": "0",
        "taker_fee_rate": "0.0016",
        "order_type": "market",
        "type": "sell",
        "status": "done",
        "client_id": "",
        "source_id": "1234"
    },
    "message": "Success"
}
  • POST /order/market
  • 是否需要簽名:是
  • 下市價訂單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String Yes 市場名稱
    type String Yes sell: 賣單;
    buy:買單;
    amount String Yes 下單量, 最小下單量由市場決定
    asset String No 下單幣種,賣單默認為交易幣種,買單默認為定價幣種
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    client_id String No client_id是訂單的自定義ID。目前它僅支持大寫和小寫字母,數字,連字符和下劃線,並且應小於32個字節.
  • 返回結果:

限價下單接口

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETHUSDT",
    "type": "buy",
    "price": "1100",
    "amount": "1",
    "account_id": 0,
    "client_id": "client1",
    "source_id": "source1"
}

// Response
{
    "code": 0,
    "data": {
        "id": 35436205,
        "create_time": 1636080705,
        "finished_time": null,
        "amount": "0.30000000",
        "price": "56000",
        "deal_amount": "0.24721428",
        "deal_money": "13843.9996800000000000",
        "deal_fee": "0",
        "stock_fee": "0",
        "money_fee": "0",
        "asset_fee": "8.721719798400000000000000",
        "fee_asset": "CET",
        "fee_discount": "0.70",
        "avg_price": "56000",
        "market": "BTCUSDT",
        "left": "0.05278572",
        "maker_fee_rate": "0.0018",
        "taker_fee_rate": "0.0018",
        "order_type": "limit",
        "type": "buy",
        "status": "cancel",
        "client_id": "abcd222",
        "source_id": "1234"
    },
    "message": "Success"
}
  • POST /order/ioc
  • 是否需要簽名:是
  • 立即成交或不能成交時取消下單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String Yes 市場名稱
    type String Yes sell: 賣單;
    buy: 買單;
    amount String Yes 下單量, 最小下單量由市場決定
    price String Yes 下單價格,由市場決定
    source_id String No 用戶定義id
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    client_id String No client_id是訂單的自定義ID。目前它僅支持大寫和小寫字母,數字,連字符和下劃線,並且應小於32個字節.
  • 返回結果:

限價下單接口

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETHUSDT",
    "type": "buy",
    "price": "1100",
    "stop_price": "1000",
    "amount": "1",
    "account_id": 0,
    "client_id": "client1",
    "source_id": "source1",
    "hide": true,
    "option": "NORMAL"
}

// Response
{
    "code": 0,
    "data": {
        "status": "success"
    },
    "message": "Success"
}
  • POST /order/stop/limit
  • 是否需要簽名:是
  • 下計劃限價單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes 密鑰ID
    market String Yes 市場名稱
    type String Yes 操作
    sell: 賣單;
    buy: 買單;
    amount String Yes 下單量, 最小下單量由市場決定
    price String Yes 下單價格, 精確到小數點後8位
    source_id String No 用戶定義編號並返回
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    client_id String No client_id是訂單的自定義ID。目前它僅支持大寫和小寫字母,數字,連字符和下劃線,並且應小於32個字節.
    hide Bool No 是否隱藏委託
    true:隱藏
    false:不隱藏
    option String No 下單策略(默認為NORMAL)
    普通: NORMAL,
    立即成交或取消: IOC,
    全部成交或取消: FOK,
    只做maker: MAKER_ONLY
    stop_price String Yes 觸發價格, 精確到小數點後8位
  • 返回結果:

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETHUSDT",
    "type": "buy",
    "amount": "1",
    "asset": "ETH",
    "stop_price": "1000",
    "account_id": 0,
    "client_id": "client1",
    "source_id": "source1",
    "hide": true,
    "option": "NORMAL"
}

// Response
{
    "code": 0,
    "data": null,
    "message": "Success"
}
  • POST /order/stop/market
  • 是否需要簽名:是
  • 下計劃限價單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes 密鑰ID
    market String Yes 市場名稱
    type String Yes 操作
    sell: 賣單;
    buy: 買單;
    amount String Yes 下單量, 最小下單量由市場決定
    asset String No 下單幣種,默認為交易幣種
    source_id String No 用戶定義編號並返回
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    client_id String No client_id是訂單的自定義ID。目前它僅支持大寫和小寫字母,數字,連字符和下劃線,並且應小於32個字節.
    hide Bool No 是否隱藏委託
    true:隱藏
    false:不隱藏
    option String No 下單策略(默認為NORMAL)
    普通: NORMAL,
    立即成交或取消: IOC,
    全部成交或取消: FOK,
    只做maker: MAKER_ONLY
    stop_price String Yes 觸發價格, 精確到小數點後8位
  • 返回結果:

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&id=420291

// Response
{
    "code": 0,
    "data": {
        "id": 35436205,
        "account_id": 0,
        "create_time": 1636080705,
        "finished_time": 1636080705,
        "amount": "0.3",
        "amount_asset": "BTC",
        "price": "56000",
        "deal_amount": "0.24721428",
        "deal_money": "13843.99968",
        "deal_fee": "0",
        "stock_fee": "0",
        "money_fee": "0",
        "asset_fee": "8.7217197984",
        "fee_asset": "CET",
        "fee_discount": "0.7",
        "avg_price": "56000",
        "market": "BTCUSDT",
        "left": "0",
        "maker_fee_rate": "0.0018",
        "taker_fee_rate": "0.0018",
        "order_type": "limit",
        "type": "buy",
        "status": "cancel",
        "client_id": "abcd222"
    },
    "message": "Success"
}
  • GET /order/status
  • 是否需要簽名:是
  • 查詢訂單狀態

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    id Interger Yes 訂單號
    market String Yes 市場名稱
    tonce Interger Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回結果:

    名稱 類型 描述
    id Integer 訂單號
    market String 市場名稱
    order_type String limit:限價單;
    market:市價單;
    price String 訂單價格
    type String sell: 賣單;
    buy: 買單;
    create_time Integer 下單時間戳
    finished_time Integer 訂單完成時間戳
    status String not_deal: 未成交(訂單仍在掛單中);
    part_deal: 部分成交(訂單仍在掛單中);
    done: 完全成交(訂單已完成);
    cancel:訂單取消(訂單已完成);
    為了保證服務器性能,所有取消的訂單均不會保存
    amount String 訂單量
    deal_amount String 成交量
    left String 訂單剩餘未成交的數量
    avg_price String 平均價格
    deal_money String 成交額
    maker_fee_rate String maker費率
    taker_fee_rate String taker費率
    deal_fee String 交易費
    stock_fee String 收取的基準幣種手續費
    money_fee String 收取的標價幣種手續費
    asset_fee String 收取的抵扣手續費的幣種的數量
    fee_asset String 用於抵扣手續費的幣種
    fee_discount String 費率折扣

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&batch_ids=420291,420292

// Response
{
  "code": 0,
  "data": [
    {
      "code": 0,
      "data": {
        "id": 35435975,
        "account_id": 0,
        "create_time": 1636020972,
        "finished_time": 1636020972,
        "amount": "1000",
        "amount_asset": "BTC",
        "price": "0",
        "deal_amount": "811.88590061",
        "deal_money": "43814713.2324293",
        "deal_fee": "60763.149707616",
        "stock_fee": "0",
        "money_fee": "60763.149707616",
        "asset_fee": "3269.137012494808",
        "fee_asset": "CET",
        "fee_discount": "0.7",
        "avg_price": "53966.58963963985619139301",
        "market": "BTCUSDT",
        "left": "0",
        "maker_fee_rate": "0",
        "taker_fee_rate": "0.0016",
        "order_type": "market",
        "type": "sell",
        "status": "done",
        "client_id": ""
      },
      "message": ""
    }
  ],
  "message": "Success"
}
  • GET /order/status/batch
  • 是否需要簽名:是
  • 查詢訂單狀態

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    batch_ids String Yes 英文”,”分隔的訂單id 列表: “1,2,3”
    market String Yes 市場名稱
    tonce Interger Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回結果:

查詢訂單狀態接口

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&id=462672
&account_id=0
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "data": [
            {
                "id": 462672,
                "order_id": null,
                "create_time": 1636020972,
                "role": "taker",
                "price": "45010",
                "amount": "0.21728593",
                "fee": "5.476822237208",
                "fee_asset": "CET",
                "deal_money": "9780.0397093"
            }
        ],
        "curr_page": 1,
        "has_next": false,
        "count": 6
    },
    "message": "Success"
}
  • GET /order/deals
  • 是否需要簽名:是
  • 查詢已完成訂單明細

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    id Interger Yes 訂單號
    page Interger Yes 頁碼,從1開始
    limit Interger Yes 每頁數量,最大100
    tonce Interger Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer no 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
  • 返回結果:

    名稱 類型 描述
    amount String 成交數量
    create_time Interger 下單時間戳
    deal_money String 成交額
    fee String 交易手續費(以fee_asset轉換成USD計價)
    fee_asset String 支付手續費所用的資產
    id Interger 執行id
    price String 單價
    role String 訂單類型taker/maker
    type String sell:賣單;
    buy:買單

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "data": [
            {
                "account_id": 0,
                "order_id": 35436626,
                "create_time": 1636104319,
                "amount": "0.01",
                "price": "59000",
                "stop_price": "55999",
                "fee_asset": "CET",
                "fee_discount": "0.7",
                "market": "BTCUSDT",
                "order_type": "limit",
                "type": "buy",
                "status": "active"
            }
        ],
        "curr_page": 1,
        "has_next": false,
        "count": 7
    },
    "message": "Success"
}
  • GET /order/stop/finished
  • 是否需要簽名:是
  • 查詢歷史計劃訂單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String No 市場名稱
    page Integer Yes 頁碼,從1開始
    limit Integer Yes 每頁條數,最大100
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer no 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
  • 返回結果:

    名稱 類型 描述
    amount String 訂單量
    stop_price String 觸發價格
    create_time Integer 下單時間戳
    account_id Integer 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    status String not_deal: 未成交(訂單仍在掛單中);
    part_deal: 部分成交(訂單仍在掛單中);
    done: 完全成交(訂單已完成);
    cancel:訂單取消(訂單已完成);
    為了保證服務器性能,所有取消的訂單均不會保存
    order_id Integer 訂單號
    market String 市場名稱
    order_type String limit:限價單;
    market:市價單;
    price String 訂單價格
    type String sell: 賣單;
    buy: 買單;
    fee_asset String 用於抵扣手續費的幣種
    fee_discount String 費率折扣

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0
&type=buy
&client_id=client1
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "data": [
            {
                "id": 35436199,
                "account_id": 0,
                "create_time": 1636079744,
                "finished_time": null,
                "amount": "1.00000000",
                "amount_asset": "BTC",
                "price": "51000",
                "deal_amount": "0",
                "deal_money": "0",
                "deal_fee": "0",
                "stock_fee": "0",
                "money_fee": "0",
                "asset_fee": "0",
                "fee_asset": "CET",
                "fee_discount": "0.7000",
                "avg_price": "0.00",
                "market": "BTCUSDT",
                "left": "1.00000000",
                "maker_fee_rate": "0.0018",
                "taker_fee_rate": "0.0018",
                "order_type": "limit",
                "type": "buy",
                "status": "not_deal",
                "client_id": "abcd222"
            }
        ],
        "curr_page": 1,
        "has_next": false,
        "count": 4,
        "total": 4
    },
    "message": "Success"
}
  • GET /order/pending
  • 是否需要簽名:是
  • 查詢未成交的訂單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String No 市場名稱
    page Integer Yes 頁碼,從1開始
    limit Integer Yes 每頁條數,最大100
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    type String No sell: 賣單;
    buy: 買單;
    client_id String No client_id是訂單的自定義ID。可批量查詢使用同一client_id的訂單。
  • 返回結果:
名稱 類型 描述
id Integer 訂單號
market String 市場名稱
order_type String limit:限價單;
market:市價單;
price String 訂單價格
type String sell: 賣單;
buy: 買單;
create_time Integer 下單時間戳
finished_time Integer 訂單完成時間戳
status String not_deal: 未成交(訂單仍在掛單中);
part_deal: 部分成交(訂單仍在掛單中);
done: 完全成交(訂單已完成);
cancel:訂單取消(訂單已完成);
為了保證服務器性能,所有取消的訂單均不會保存
amount String 訂單量
deal_amount String 成交量
left String 訂單剩餘未成交的數量
avg_price String 平均價格
deal_money String 成交額
maker_fee_rate String maker費率
taker_fee_rate String taker費率
deal_fee String 交易費
stock_fee String 收取的基準幣種手續費
money_fee String 收取的標價幣種手續費
asset_fee String 收取的抵扣手續費的幣種的數量
fee_asset String 用於抵扣手續費的幣種
fee_discount String 費率折扣
client_id String 用戶定義的訂單id

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0
&type=buy
&client_id=client1
&stop_order_id=423842
&start_time=1636451914
&end_time=1681724907
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "data": [

            {
                "id": 35435967,
                "account_id": 0,
                "create_time": 1636011309,
                "finished_time": 1636011309,
                "amount": "0.01",
                "amount_asset": "BTC",
                "price": "56000",
                "deal_amount": "0.01",
                "deal_money": "560",
                "deal_fee": "0.896",
                "stock_fee": "0",
                "money_fee": "0.896",
                "asset_fee": "0",
                "fee_asset": "",
                "fee_discount": "1",
                "avg_price": "56000",
                "market": "BTCUSDT",
                "left": "0",
                "maker_fee_rate": "0.0016",
                "taker_fee_rate": "0.0016",
                "order_type": "limit",
                "type": "buy",
                "status": "done",
                "client_id": "abcd222"
            }
        ],
        "curr_page": 1,
        "has_next": false,
        "count": 8
    },
    "message": "Success"
}
  • GET /order/finished
  • 是否需要簽名:是
  • 查詢歷史訂單

  • 請求參數:
名稱 類型 是否必須 描述
access_id String Yes access_id
market String No 市場名稱
start_time Integer Yes 查詢開始時間
end_time Integer Yes 查詢結束時間
page Integer Yes 頁碼,從1開始
limit Integer Yes 每頁條數,最大100
tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
account_id Integer No 現貨賬戶ID: 0,
槓桿賬戶ID: 見獲取市場槓桿賬戶
type String No sell: 賣單;
buy: 買單;
client_id String No 用戶定義的id
stop_order_id Integer No 計劃委託訂單id
  • 返回結果:

查詢未完成的訂單接口

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0
&type=buy
&client_id=client1
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "data": [
            {
                "account_id": 0,
                "order_id": 35436627,
                "create_time": 1636104345,
                "amount": "0.01000000",
                "price": "59000",
                "stop_price": "54999",
                "taker_fee": "0.0018",
                "maker_fee": "0.0018",
                "state": 1,
                "fee_asset": "CET",
                "fee_discount": "0.7000",
                "market": "BTCUSDT",
                "order_type": "limit",
                "type": "buy",
                "client_id": "abcd222"
            }
        ],
        "curr_page": 1,
        "has_next": false,
        "count": 1,
        "total": 1
    },
    "message": "Success"
}
  • GET /order/stop/pending
  • 是否需要簽名:是
  • 查詢未成交的計劃訂單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String No 市場名稱
    page Integer Yes 頁碼,從1開始
    limit Integer Yes 每頁條數,最大100
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    type String No 操作
    sell: 賣單;
    buy: 買單;
    client_id String No client_id是訂單的自定義ID。可批量查詢使用同一client_id的訂單。
  • 返回結果:

    名稱 類型 描述
    amount String 訂單量
    stop_price String 觸發價格
    create_time Integer 下單時間戳
    account_id Integer 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    state Integer 計劃單觸發價與當前市場價的關係
    1:低於當前市場價
    2:高於當前市場價
    order_id Integer 訂單號
    maker_fee String maker費率
    market String 市場名稱
    order_type String limit:限價單;
    market:市價單;
    price String 訂單價格
    taker_fee String taker費率
    type String sell: 賣單;
    buy: 買單;
    client_id String 用戶定義的訂單id
    fee_asset String 用於抵扣手續費的幣種
    fee_discount String 費率折扣

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0
&type=buy
&start_time=1636451914
&end_time=1681724907
&page=1
&limit=100

// Response
{
    "code": 0,
    "data": {
        "data": [
            {
                "id": 462666,
                "order_id": 35435973,
                "account_id": 0,
                "create_time": 1636020409,
                "type": "sell",
                "role": "taker",
                "price": "54000",
                "amount": "0.6655976",
                "fee": "20.127671424",
                "fee_asset": "CET",
                "market": "BTCUSDT",
                "deal_money": "35942.2704"
            }
        ],
        "curr_page": 1,
        "has_next": false,
        "count": 2
    },
    "message": "Success"
}
  • GET /order/user/deals
  • 是否需要簽名:是
  • 查詢用戶成交記錄

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String No 市場名稱
    page Interger Yes 頁碼,從1開始
    limit Interger Yes 每頁數量,最大100
    tonce Interger Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    type String No sell: 賣單;
    buy: 買單;
    start_time Integer No 開始時間
    end_time Integer No 結束時間
  • 返回結果:

查詢已完成訂單明細接口

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&id=462672
&market=ETHUSDT
&account_id=0
&type=buy

// Response
{
    "code": 0,
    "data": {
        "id": 35436612,
        "account_id": 2,
        "create_time": 1636098643,
        "finished_time": null,
        "amount": "1.00000000",
        "price": "62443",
        "deal_amount": "0",
        "deal_money": "0",
        "deal_fee": "0",
        "stock_fee": "0",
        "money_fee": "0",
        "asset_fee": "0",
        "fee_asset": "CET",
        "fee_discount": "0.70",
        "avg_price": "0.00",
        "market": "BTCUSDT",
        "left": "1.00000000",
        "maker_fee_rate": "0.0018",
        "taker_fee_rate": "0.0018",
        "order_type": "limit",
        "type": "sell",
        "status": "not_deal",
        "client_id": ""
    },
    "message": "Success"
}
  • DELETE /order/pending
  • 是否需要簽名:是
  • 取消訂單
  • 限速規則: 200次/10s

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    id Integer No 訂單id
    market String Yes 市場名稱
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer No 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    type String No sell: 賣單;
    buy: 買單;
  • 返回結果:

    名稱 類型 描述
    id Integer 訂單號
    market String 市場名稱
    order_type String limit:限價單;
    market:市價單;
    price String 訂單價格
    type String sell: 賣單;
    buy: 買單;
    create_time Integer 下單時間戳
    finished_time Integer 訂單完成時間戳
    status String not_deal: 未成交(訂單仍在掛單中);
    part_deal: 部分成交(訂單仍在掛單中);
    done: 完全成交(訂單已完成);
    cancel:訂單取消(訂單已完成);
    為了保證服務器性能,所有取消的訂單均不會保存
    amount String 訂單量
    deal_amount String 成交量
    left String 訂單剩餘未成交的數量
    avg_price String 平均價格
    deal_money String 成交額
    maker_fee_rate String maker費率
    taker_fee_rate String taker費率
    deal_fee String 交易費
    stock_fee String 收取的基準幣種手續費
    money_fee String 收取的標價幣種手續費
    asset_fee String 收取的抵扣手續費的幣種的數量
    fee_asset String 用於抵扣手續費的幣種
    fee_discount String 費率折扣
    Source_id String 用戶自定義的source_id

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&batch_ids=462672,462673
&market=ETHUSDT
&account_id=0

// Response
{
    "code": 0,
    "data": null,
    "message": "Success"
}
  • DELETE /order/pending/batch
  • 是否需要簽名:是
  • 批量取消訂單,單次最大100

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    batch_ids String Yes 英文”,”分隔的訂單id 列表: “1,2,3”
    market String Yes 市場名稱
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer no 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
  • 返回結果:

取消訂單接口

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0

// Response
{
  "code": 0,
  "data": {
  },
  "message": "Ok"
}
  • DELETE /order/pending
  • 是否需要簽名:是
  • 取消所有訂單

  • 請求參數:

    name type required description
    access_id String Yes access_id
    market String Yes 市場名稱
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer no 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0
&type=buy

// Response
{
    "code": 0,
    "data": null,
    "message": "Success"
}
  • Delete /order/stop/pending/<int:order_id>
  • 是否需要簽名:是
  • 取消未成交的計劃訂單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String Yes 市場名稱
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer no 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    type String No sell: 賣單;
    buy: 買單;
  • 返回結果:

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0

// Response
{
    "code": 0,
    "data": null,
    "message": "Success"
}
  • Delete /order/stop/pending
  • 是否需要簽名:是
  • 取消所有未成交的計劃訂單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String Yes 市場名稱
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
    account_id Integer no 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
  • 返回結果:

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": {
        "spot": {
            "ALL": {
                "taker": "0",
                "maker": "0"
            }
        },
        "perpetual": {
            "ALL": {
                "taker": "0.00025",
                "maker": "-0.00025"
            }
        }
    },
    "message": "Success"
}
  • GET /order/user/trade/fee

  • 獲取用戶交易費率

  • 是否需要簽名:是

  • 請求參數: 無

  • 返回參數說明

    名稱 類型 描述
    spot object 現貨交易費率
    perpetual object 合約交易費率
    taker String taker費率
    maker String maker費率
  • 備註: API創建後,需要等待10分鐘才能獲取到真實交易費率

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205

// Response
{
    "code": 0,
    "data": {
        "CETUSDT": {
            "maker_fee_rate": "0.003",
            "taker_fee_rate": "0.003",
            "depths": [
                "0.1",
                "0.01",
                "0.001",
                "0.0001",
                "0.00001",
                "0.000001",
                "0.0000001",
                "0.00000001"
            ],
            "is_amm_market": true
        },
        "CETUSDC": {
            "maker_fee_rate": "0.001",
            "taker_fee_rate": "0.001",
            "depths": [
                "0.0001",
                "0.00001",
                "0.000001",
                "0.0000001",
                "0.00000001"
            ],
            "is_amm_market": false
        }

    },
    "message": "Success"
}
  • GET /order/market/trade/info

  • 獲取市場交易信息

  • 是否需要簽名:否

  • 請求參數: 無

  • 返回參數說明

    名稱 類型 描述
    maker_fee_rate String maker交易費率
    taker_fee_rate String taker交易費率
    depth List 深度列表
    is_amm_market bool 是否可以自動做市

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETHUSDT",
    "id": 462672,
    "price": "1100",
    "amount": "1"
}

// Response
{
    "code": 0,
    "data": {
        "id": 35436205,
        "create_time": 1636080705,
        "finished_time": null,
        "amount": "0.30000000",
        "price": "56000",
        "deal_amount": "0.24721428",
        "deal_money": "13843.9996800000000000",
        "deal_fee": "0",
        "stock_fee": "0",
        "money_fee": "0",
        "asset_fee": "8.721719798400000000000000",
        "fee_asset": "CET",
        "fee_discount": "0.70",
        "avg_price": "56000",
        "market": "BTCUSDT",
        "left": "0.05278572",
        "maker_fee_rate": "0.0018",
        "taker_fee_rate": "0.0018",
        "order_type": "limit",
        "type": "buy",
        "status": "cancel",
        "client_id": "abcd222",
        "source_id": "1234"
    },
    "message": "Success"
}
  • POST /order/modify
  • 是否需要簽名:是
  • 修改普通委託單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    market String Yes 市場名稱
    id Interger Yes 訂單號
    amount String No 下單量, 最小下單量由市場決定
    price String No 下單價格,由市場決定
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回結果:

限價下單接口

示例

// Request
{
    "access_id": "4DA36FFC61334695A66F8D29020EB589",
    "tonce": 1513746038205,
    "market": "ETHUSDT",
    "id": 462672,
    "price": "1100",
    "stop_price": "1000",
    "amount": "1"
}

// Response
{
    "code": 0,
    "data": {
        "status": "success"
    },
    "message": "Success"
}
  • POST /order/stop/modify
  • 是否需要簽名:是
  • 修改計劃委託單

  • 請求參數:

    名稱 類型 是否必須 描述
    access_id String Yes 密鑰ID
    market String Yes 市場名稱
    id Interger Yes 訂單號
    amount String No 下單量, 最小下單量由市場決定
    price String No 下單價格, 精確到小數點後8位
    stop_price String No 觸發價格, 精確到小數點後8位
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s
  • 返回結果:

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0
&client_id=client1

// Response
{
  "code": 0,
  "data": [
    {
      "code": 0,
      "order": {
        "id": 35435975,
        "account_id": 0,
        "create_time": 1636020972,
        "finished_time": 1636020972,
        "amount": "1000",
        "price": "0",
        "deal_amount": "811.88590061",
        "deal_money": "43814713.2324293",
        "deal_fee": "60763.149707616",
        "stock_fee": "0",
        "money_fee": "60763.149707616",
        "asset_fee": "3269.137012494808",
        "fee_asset": "CET",
        "fee_discount": "0.7",
        "avg_price": "53966.58963963985619139301",
        "market": "BTCUSDT",
        "left": "0",
        "maker_fee_rate": "0",
        "taker_fee_rate": "0.0016",
        "order_type": "market",
        "type": "sell",
        "status": "done",
        "client_id": ""
      },
      "message": ""
    }
  ],
  "message": "Ok"
}
  • DELETE /order/pending/by_client_id
  • 是否需要簽名:是
  • 通過client_id撤銷訂單

  • 請求參數:

    name type required description
    access_id String Yes access_id
    market String no 市場名稱
    client_id String Yes client_id是訂單的自定義ID。可批量撤銷使用同一client_id的訂單。
    account_id Integer no 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s

示例

// Request
access_id=4DA36FFC61334695A66F8D29020EB589
&tonce=1513746038205
&market=ETHUSDT
&account_id=0
&client_id=client1

// Response
{
  "code": 0,
  "data": [
    {
      "code": 0,
      "order": {
        "id": 35435975,
        "account_id": 0,
        "create_time": 1636020972,
        "finished_time": 1636020972,
        "amount": "1000",
        "price": "0",
        "deal_amount": "811.88590061",
        "deal_money": "43814713.2324293",
        "deal_fee": "60763.149707616",
        "stock_fee": "0",
        "money_fee": "60763.149707616",
        "asset_fee": "3269.137012494808",
        "fee_asset": "CET",
        "fee_discount": "0.7",
        "avg_price": "53966.58963963985619139301",
        "market": "BTCUSDT",
        "left": "0",
        "maker_fee_rate": "0",
        "taker_fee_rate": "0.0016",
        "order_type": "market",
        "type": "sell",
        "status": "done",
        "client_id": ""
      },
      "message": ""
    }
  ],
  "message": "Ok"
}
  • DELETE /order/stop/pending/by_client_id
  • 是否需要簽名:是
  • 通過client_id撤銷計劃委託單

  • 請求參數:

    name type required description
    access_id String Yes access_id
    market String no 市場名稱
    client_id String Yes client_id是訂單的自定義ID。可批量撤銷使用同一client_id的訂單。
    account_id Integer no 現貨賬戶ID: 0,
    槓桿賬戶ID: 見獲取市場槓桿賬戶
    tonce Integer Yes 毫秒時間戳,與服務器時間可接受誤差範圍為±60s

WebSocket

websocket地址是wss://socket.coinex.com/

在一個連接中如果對同一個數據重複訂閱,前一個訂閱會被取消

  • 壓縮請求

在嘗試連接時,需要配置通過Deflate 算法進行壓縮,參考標準為RFC7692,開發人員大部分使用的 工具庫都支持了這一特性,只需要稍加配置即可開啟。

右側示例為Python 的websockets 的代碼實現:

import websockets

websockets.connect(..., compression='deflate')
  • 請求參數說明:
    • method: 方法, String.
    • params: 參數, Array.
    • id: 請求id, Integer

請求示例:

{
  "id": 4,
  "method": "state.subscribe",
  "params": []
}
  • 返回結果

    • result: Json對象, 空為失敗.
    • error: Json對象, 空為成功, 非空為失敗.
      • code: 錯誤碼
      • message: 錯誤信息
    • id: 請求id, Integer.

返回示例

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

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

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

  • 推送

    • method: 方法, String
    • params: 參數, Array
    • id: Null

推送示例:

{
  "id": null,
  "method": "state.update",
  "params": []
}
  • 錯誤碼描述
錯誤碼 錯誤信息 描述
1 invalid argument 無效參數
2 internal error 內部錯誤
3 service unavailable 服務不可用
4 method not found 未找到方法
5 service timeout 服務超時
6 require auth 需要授權
7 too quick 訪問頻率過快

示例:

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

// Response
{
  "error": null,
  "result": {
    "status": "success"
  },
  "id": 15
}
  • 方法: “server.sign”
  • 請求參數說明:

    名稱 類型 是否必須 描述
    access_id String Yes access_id
    sign_data String Yes 對字符串”access_id={access_id}&tonce={tonce}&secret_key={secret_key}” 使用32位MD5算法進行加密,將加密結果轉換為大寫
    timestamp Interger Yes 時間戳, 毫秒, 跟服務器時間戳相差不能大於1分鐘
  • 返還參數說明:

    名稱 類型 描述
    status String 請求結果, 當鑑權成功時返回值為”success”, 鑑權失敗信息存在於error字段中

示例:

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

// Response
{
  "error": null,
  "result": "pong",
  "id": 11
}
  • 方法: “server.ping”
  • 返還參數說明:

    名稱 類型 描述
    result String “pong”

示例:

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

// Response
{
  "error": null,
  "result": 1493285895,
  "id": 11
}
  • 方法: “server.time”
  • 返還參數說明:

    名稱 類型 描述
    timestamp Integer 時間戳,單位:秒

示例:

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

// Response
{
  "error": null, 
  "result": [
    [
      1639982280,
      "46324.37",
      "46345.71",
      "46356.11",
      "46324.37",
      "0.20288204",
      "9402.0920386072"
    ]
  ],
  "id": 5
}
  • 方法: “kline.query”
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱
    params[1] Integer Yes start_time, 開始時間
    params[2] Integer Yes end_time, 結束時間
    params[3] Integer Yes period, 週期, 1min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 12hour, 1day, 3day, 1week
  • 返還參數說明:

    名稱 類型 描述
    result[0][0] Integer 時間戳
    result[0][1] String 開盤價
    result[0][2] String 收盤價
    result[0][3] String 最高價
    result[0][4] String 最低價
    result[0][5] String 數量
    result[0][6] String 交易額

示例:

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

// Response
{
  "error": null, 
  "result": {
    "open": "47598.70",
    "last": "46318.55",
    "high": "48262.66",
    "low": "46111.11",
    "deal": "26883503.6092410415",
    "volume": "572.07705108",
    "sell_total": "11.74193255",
    "buy_total": "6.76222116",
    "period": 86400
  },
  "id": 15
}
  • 方法: “state.query”
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱
    params[1] Integer Yes period, 週期, 例如. 86400為過去24小時
  • 返還參數說明

    名稱 類型 描述
    open String 開盤價
    last String 最新價
    high String 最高價
    low String 最低價
    deal String 總交易額
    volume String 總交易量
    sell_total String 賣單數量
    buy_total String 買單數量
    period Integer 週期

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “state.subscribe”
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱, 空為訂閱所有市場
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "state.update", 
  "params": [{
    "BTCUSD": {
      "open": "47598.70",
      "last": "46318.55",
      "high": "48262.66",
      "low": "46111.11",
      "deal": "26883503.6092410415",
      "volume": "572.07705108",
      "sell_total": "11.74193255",
      "buy_total": "6.76222116",
      "period": 86400
    },
  }], 
  "id": 15
}
  • 方法: “state.update”
  • 推送參數說明:

    名稱 類型 描述
    open String 開盤價
    last String 最新價
    high String 最高價
    low String 最低價
    deal String 總交易額
    volume String 總交易量
    sell_total String 賣單數量
    buy_total String 買單數量
    period Integer 週期

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “state.unsubscribe”
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

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

// Response
{
  "error": null, 
  "result": [
    {
      "type": "sell",
      "time": 1496458040.059284,
      "price": "46444.74",
      "id": 29433,
      "amount": "0.00120000"
    }
  ],
  "id": 16
}
  • 方法: “deals.query”
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱
    params[1] Integer Yes limit, 獲取記錄數
    params[2] Integer Yes last_id, 上次返回結果的最大ID
  • 返還參數說明:

    名稱 類型 描述
    type String 類型, “sell”: 賣, “buy”: 買
    time Float 時間戳
    price String 價格
    id Integer 編號
    amount String 數量

示例:

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

// Response
{
  "error": null, 
  "result": [
    {
      "type": "sell",
      "time": 1496458040.059284,
      "price": "46444.74",
      "id": 29433,
      "amount": "0.00120000"
    }
  ],
  "id": 16
}
  • 方法: “deals.query_user”
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] Integer Yes account, 賬戶
    現貨賬戶: 0
    槓桿賬戶: 見獲取市場槓桿賬戶
    用於查詢所有帳戶: -1
    用於查詢帳戶>0的交易: -2
    params[1] String Yes market, 市場名稱
    params[2] Integer Yes side, 買賣方向, 0: 所有, 1: 賣, 2: 買
    params[3] Integer Yes start_time, 開始時間, 0: 不限制
    params[4] Integer Yes end_time, 結束時間, 0: 不限制
    params[5] Integer Yes offset, 偏移量,即從哪條開始獲取
    params[6] Integer Yes limit, 獲取記錄數
  • 返還參數說明:

    名稱 類型 描述
    type String 類型, “sell”: 賣, “buy”: 買
    time Float 時間戳
    price String 價格
    id Integer 編號
    amount String 數量

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “deals.subscribe”
  • 請求參數說明:
名稱 類型 是否必須 描述
params Array\<String\> No 市場列表, 空為訂閱所有市場
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "deals.update", 
  "params": [
    "BTCUSD",
    [
      {
        "type": "sell",
        "time": 1496458040.059284,
        "price": "46444.74",
        "id": 29433,
        "amount": "0.00120000"
      }
    ]
  ], 
  "id": null
}
  • 方法: “deals.update”
  • 推送參數說明:

    名稱 類型 描述
    params[0] String market, 市場
    type String 類型, “sell”: 賣, “buy”: 買
    time float 時間戳
    price String 價格
    id Integer 編號
    amount String 數量

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “deals.unsubscribe”
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

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

// Response
{
  "error": null, 
  "result": {
    "asks": [
      [
        "46350.52",
        "1.07871851"
      ],
      ...
    ],
    "bids": [
      [
        "46349.61",
        "0.04000000"
      ],
      ...
    ],
    "last": "46349.93",
    "time": 1639987469166,
    "checksum": 1533284725
  },
  "id": 15
}
  • 方法: “depth.query”
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱
    params[1] Integer Yes limit, 獲取記錄數, [5, 10, 20, 50]中的其中一個
    params[2] Integer Yes interval, 合併深度精度, [“10”, “1”, “0”, “0.1”, “0.01”]的其中一個
  • 返還參數說明:

    名稱 類型 描述
    last String 最新價
    time Integer 時間戳
    checksum Integer 校驗和是全深度數據的有符號的32位整數,用於驗證深度數據的準確性。
    1. 構造校驗和字符串:bid1_price:bid1_amount:bid2_price:bid2_amount:ask1_price:ask1_amout:…(如果沒有出價,則校驗和字符串是ask1_price:ask1_amount:ask2_price:ask2_amount:…)
    2. 將校驗和字符串使用crc32算法編碼
    asks[0][0] String 賣一價
    asks[0][1] String 賣一量
    bids[0][0] String 買一價
    bids[0][1] String 買一量

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “depth.subscribe”
  • 說明: 調用該命令,會取消之前的所有市場深度訂閱
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱
    params[1] Integer Yes limit, 獲取記錄數, [5, 10, 20, 50]中的其中一個
    params[2] Integer Yes interval, 合併深度精度, [“10”, “1”, “0”, “0.1”, “0.01”]的其中一個
    params[3] Bool No diff, true: 增量訂閱, false: 全量訂閱, 默認為true
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “depth.subscribe_multi”
  • 說明: 調用該命令,會取消之前的所有市場深度訂閱
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0][0] String Yes market, 市場名稱
    params[0][1] Integer Yes limit, 獲取記錄數, [5, 10, 20, 50]中的其中一個
    params[0][2] Integer Yes interval, 合併深度精度, [“10”, “1”, “0”, “0.1”, “0.01”]的其中一個
    params[0][3] Bool No diff, true: 增量訂閱, false: 全量訂閱, 默認為true
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "depth.update", 
  "params": [
    false,
    {
      "asks": [
        ["46350.52", "1.07871851"],
        ...
      ],
      "bids": [
        ["46349.61", "0.04000000"],
        ...
      ],
      "last": "46349.93",
      "time": 1639987469166,
      "checksum": 1533284725
    },
    "BTCUSDT"
  ], 
  "id": null
}
  • 方法: “depth.update”
  • 說明:
    • params[0]參數表明此次推送是增量推送或是全量推送。
    • 增量推送:每次僅推送上個推送時點到當前時點更新的深度數據。每200毫秒推送一次,若無深度更新,則不推送。
    • 全量推送:每次推送完整的深度數據。每200毫秒推送一次,若無深度更新,則不推送。
    • 如果訂閱了多個市場,通過params[2]參數來區分不同市場的推送消息。
    • 市場深度每隔1分鐘會推送一次全量數據。
  • 推送參數說明:

    名稱 類型 描述
    params[0] Bool true: 全量結果,false: 最新增量
    last String 最新價
    time Integer 時間戳
    checksum Integer 校驗和是全深度數據的有符號的32位整數,用於驗證深度數據的準確性。
    1.校驗和只能根據全量結果計算,如果是增量訂閱,需要先計算出全量結果
    2.構造校驗和字符串:bid1_price:bid1_amount:bid2_price:bid2_amount:ask1_price:ask1_amout:…(如果沒有出價,則校驗和字符串是ask1_price:ask1_amount:ask2_price:ask2_amount:…)
    3. 將校驗和字符串使用crc32算法編碼
    asks[n][0] String 價格
    asks[n][1] String 數量,為0時刪除該深度,非0時替換
    bids[n][0] String 價格
    bids[n][1] String 數量,為0時刪除該深度,非0時替換
    params[2] String market, 市場名稱

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “depth.unsubscribe”
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “depth.unsubscribe_multi”
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

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

// Response
{
  "error": null, 
  "result": {
    "records": [{
      "asset_fee": "0",
      "account": 1,
      "money_fee": "0",
      "stock_fee": "0",
      "ctime": 1558680350.41878,
      "maker_fee": "0.0001",
      "price": "0.01900000",
      "deal_stock": "0",
      "fee_discount": "0.9000",
      "side": 1,
      "source": "api",
      "amount": "1.00000000",
      "user": 553,
      "mtime": 1558680350.41878,
      "fee_asset": "CET",
      "deal_money": "0",
      "left": "1.00000000",
      "type": 1,
      "id": 303,
      "market": "BTCUSDT",
      "taker_fee": "0.0001",
      "client_id": "test_123",
      "stop_id": 0
    }], 
    "total": 1,
    "limit": 100,
    "offset": 0
  },
  "id": 15
}
  • 方法: “order.query”
  • 說明: 該接口只查詢賬戶為0的訂單
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱
    params[1] Integer Yes side, 0: 所有, 1: 賣, 2: 買
    params[2] Integer Yes offset, 偏移量,即從哪條開始獲取
    params[3] Integer Yes limit, 獲取記錄數
  • 返還參數說明:

    名稱 類型 描述
    total Integer 返回的訂單結果數
    limit Integer 獲取記錄數
    offset Integer 偏移量
    asset_fee String 抵扣手續費的幣種數量
    account Integer 賬戶, 現貨賬戶: 0
    money_fee String 收取的標價幣種手續費
    stock_fee String 收取的基準幣種手續費
    ctime Float 創建時間
    maker_fee String maker費率
    price String 價格
    deal_stock String 已成交價值
    fee_discount String 費率折扣
    source String 來源
    side Integer 1: 賣單, 2: 買單
    amount String 下單量, 最小下單量由市場決定
    user Integer 用戶id
    mtime Float 更新時間
    fee_asset String 抵扣手續費的幣種
    deal_money String 成交量
    left String 剩餘未成交量
    type Integer 1: 限價單, 2: 市價單
    id Integer 訂單id
    market String 市場名稱
    taker_fee String taker費率
    client_id String 客戶端自定義的id
    stop_id Integer 計劃單id

示例:

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

// Response
{
  "error": null, 
  "result": {
    "limit":10,
    "offset":0,
    "total":1,
    "records":[
      {
        "id":259,
        "type":2,
        "side":2,
        "user":1415,
        "account":0,
        "option":68,
        "state":1,
        "ctime":1640483195.167732,
        "mtime":1640483195.167732,
        "market":"BTCUSDT",
        "source":"http_api_test",
        "client_id":"",
        "stop_price":"54999.00000000",
        "price":"0",
        "amount":"100000.00000000",
        "taker_fee":"0.0010",
        "maker_fee":"0.0010",
        "fee_discount":"1",
        "fee_asset":null
      }
    ]
  },
  "id": 15
}
  • 方法: “order.query_stop”
  • 說明: 該接口只查詢賬戶為0的訂單
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱
    params[1] Integer Yes side, 0: 所有, 1: 賣, 2: 買
    params[2] Integer Yes offset, 偏移量,即從哪條開始獲取
    params[3] Integer Yes limit, 獲取記錄數
  • 返還參數說明:

    名稱 類型 描述
    total Integer 返回的訂單結果數
    limit Integer 獲取記錄數
    offset Integer 偏移量
    account Integer 賬戶, 現貨賬戶: 0
    money_fee String 收取的標價幣種手續費
    state Integer 計劃單觸發價與當前市場價的關係
    1:低於當前市場價
    2:高於當前市場價
    ctime Float 創建時間
    maker_fee String maker費率
    price String 價格
    fee_discount String 費率折扣
    source String 來源
    side Integer 1: 賣單, 2: 買單
    amount String 下單量, 最小下單量由市場決定
    user Integer 用戶id
    mtime Float 更新時間
    type Integer 1: 限價單, 2: 市價單
    id Integer 訂單id
    market String 市場名稱
    stop_price String 觸發價格
    taker_fee String taker費率
    client_id String 客戶端自定義的id

示例:

// Request
{
  "method": "order.account_query",
  "params": [
    12,
    "BTCUSDT",
    0,
    0,
    10
  ],
  "id": 15
}

// Response
{
  "error": null, 
  "result": {
    "records": [{
      "asset_fee": "0",
      "account": 1,
      "money_fee": "0",
      "stock_fee": "0",
      "ctime": 1558680350.41878,
      "maker_fee": "0.0001",
      "price": "0.01900000",
      "deal_stock": "0",
      "fee_discount": "0.9000",
      "side": 1,
      "source": "api",
      "amount": "1.00000000",
      "user": 553,
      "mtime": 1558680350.41878,
      "fee_asset": "CET",
      "deal_money": "0",
      "left": "1.00000000",
      "type": 1,
      "id": 303,
      "market": "BTCUSDT",
      "taker_fee": "0.0001",
      "client_id": "test_123",
      "stop_id": 0
    }], 
    "total": 1,
    "limit": 100,
    "offset": 0
  },
  "id": 15
}
  • 方法: “order.account_query”
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] Integer Yes account, 賬戶
    現貨賬戶: 0
    槓桿賬戶: 見獲取市場槓桿賬戶
    用於查詢所有帳戶: -1
    用於查詢帳戶>0的交易: -2
    params[1] String Yes market, 市場名稱
    params[2] Integer Yes side, 0: 所有, 1: 賣, 2: 買
    params[3] Integer Yes offset, 偏移量,即從哪條開始獲取
    params[4] Integer Yes limit, 獲取記錄數
  • 返還參數說明:

    名稱 類型 描述
    total Integer 返回的訂單結果數
    limit Integer 獲取記錄數
    offset Integer 偏移量
    asset_fee String 抵扣手續費的幣種數量
    account Integer 賬戶, 現貨賬戶: 0, 槓桿賬戶: 見獲取市場槓桿賬戶
    money_fee String 收取的標價幣種手續費
    stock_fee String 收取的基準幣種手續費
    ctime Float 創建時間
    maker_fee String maker費率
    price String 價格
    deal_stock String 已成交價值
    fee_discount String 費率折扣
    source String 來源
    side Integer 1: 賣單, 2: 買單
    amount String 下單量, 最小下單量由市場決定
    user Integer 用戶id
    mtime Float 更新時間
    fee_asset String 抵扣手續費的幣種
    deal_money String 成交量
    left String 剩餘未成交量
    type Integer 1: 限價單, 2: 市價單
    id Integer 訂單id
    market String 市場名稱
    taker_fee String taker費率
    client_id String 客戶端自定義的id
    stop_id Integer 計劃單id

示例:

// Request
{
  "method": "order.account_query_stop",
  "params": [
    12,
    "BTCUSDT",
    0,
    0,
    10
  ],
  "id": 15
}

// Response
{
  "error": null, 
  "result": {
    "limit":10,
    "offset":0,
    "total":1,
    "records":[
      {
        "id":259,
        "type":2,
        "side":2,
        "user":1415,
        "account":0,
        "option":68,
        "state":1,
        "ctime":1640483195.167732,
        "mtime":1640483195.167732,
        "market":"BTCUSDT",
        "source":"http_api_test",
        "client_id":"",
        "stop_price":"54999.00000000",
        "price":"0",
        "amount":"100000.00000000",
        "taker_fee":"0.0010",
        "maker_fee":"0.0010",
        "fee_discount":"1",
        "fee_asset":null
      }
    ]
  },
  "id": 15
}
  • 方法: “order.account_query_stop”
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] Integer Yes account, 賬戶
    現貨賬戶: 0
    槓桿賬戶: 見獲取市場槓桿賬戶
    用於查詢所有帳戶: -1
    用於查詢帳戶>0的交易: -2
    params[1] String Yes market, 市場名稱
    params[2] Integer Yes side, 0: 所有, 1: 賣, 2: 買
    params[3] Integer Yes offset, 偏移量,即從哪條開始獲取
    params[4] Integer Yes limit, 獲取記錄數
  • 返還參數說明:

    名稱 類型 描述
    total Integer 返回的訂單結果數
    limit Integer 獲取記錄數
    offset Integer 偏移量
    account Integer 賬戶, 現貨賬戶: 0
    money_fee String 收取的標價幣種手續費
    ctime Float 創建時間
    maker_fee String maker費率
    state Integer 計劃單觸發價與當前市場價的關係
    1:低於當前市場價
    2:高於當前市場價
    price String 價格
    fee_discount String 費率折扣
    source String 來源
    side Integer 1: 賣單, 2: 買單
    amount String 下單量, 最小下單量由市場決定
    user Integer 用戶id
    mtime Float 更新時間
    type Integer 1: 限價單, 2: 市價單
    id Integer 訂單id
    market String 市場名稱
    stop_price String 觸發價格
    taker_fee String taker費率
    client_id String 客戶端自定義的id

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “order.subscribe”
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:
名稱 類型 是否必須 描述
params Array\<String\> Yes market list, 市場列表
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "order.update", 
  "params": [
    3,
    {
      "asset_fee": "0",
      "account": 1,
      "money_fee": "0",
      "stock_fee": "0",
      "ctime": 1558680350.41878,
      "maker_fee": "0.0001",
      "price": "0.01900000",
      "deal_stock": "0",
      "fee_discount": "0.9000",
      "side": 1,
      "source": "api",
      "amount": "1.00000000",
      "user": 553,
      "mtime": 1558680350.41878,
      "fee_asset": "CET",
      "deal_money": "0",
      "left": "1.00000000",
      "type": 1,
      "id": 303,
      "market": "BTCUSDT",
      "taker_fee": "0.0001",
      "client_id": "test_123",
      "stop_id": 0
    }
  ], 
  "id": null
}
  • 方法: “order.udpate”
  • 鑑權: 需要, 參考server.sign
  • 推送參數說明:

    名稱 類型 描述
    params[0] Integer event, 事件類型, 1: PUT, 2: UPDATE, 3: FINISH
    asset_fee String 抵扣手續費的幣種數量
    account Integer 賬戶, 現貨賬戶: 0, 槓桿賬戶: 見獲取市場槓桿賬戶
    money_fee String 收取的標價幣種手續費
    stock_fee String 收取的基準幣種手續費
    ctime Float 創建時間
    maker_fee String maker費率
    price String 價格
    deal_stock String 已成交價值
    fee_discount String 費率折扣
    source String 來源
    side Integer 1: 賣單, 2: 買單
    amount String 下單量, 最小下單量由市場決定
    user Integer 用戶id
    mtime Float 更新時間
    fee_asset String 抵扣手續費的幣種
    deal_money String 成交量
    left String 剩餘未成交量
    type Integer 1: 限價單, 2: 市價單
    id Integer 訂單id
    market String 市場名稱
    taker_fee String taker費率
    client_id String 客戶端自定義的id
    stop_id Integer 計劃單id

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “order.unsubscribe”
  • 鑑權: 需要, 參考server.sign
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

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

// Response
{
  "error": null, 
  "result": {
    "BTC": {
      "available": "5",
      "frozen": "1",
    },
    "ETH": {
      "available": "5",
      "frozen": "1",
    }
  },
  "id": 15
}
  • 方法: “asset.query”
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:
名稱 類型 是否必須 描述
params Array\<String\> Yes asset list, 資產列表
  • 返還參數說明:

    名稱 類型 描述
    available String 可用的金額
    frozen String 凍結的金額

示例:

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

// Response
{
  "error": null, 
  "result": {
    "BTC": {
      "available": "250",
      "frozen": "10",
    },
    "ETH":{
      "available": "250",
      "frozen": "10",
    }
  },
  "id": 15
}
  • 方法: “asset.account_query”
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:
名稱 類型 是否必須 描述
params[0] Integer Yes account, 賬戶
現貨賬戶: 0
槓桿賬戶: 見獲取市場槓桿賬戶
params[1] Array\<String\> Yes asset array, 資產列表
  • 返還參數說明:

    名稱 類型 描述
    available String 可用的金額
    frozen String 凍結的金額

示例:

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

// Response
{
  "error": null, 
  "result": {
    "1": {
      "BCH": {
        "available": "990554.89473682",
        "frozen": "9445.10526318"
      }, 
      "BTC": {
        "available": "92.919825",
        "frozen": "7.08000000"
       }
    }, 
    "0": { 
      "CET": {
        "available": "999900473.1500094689", 
        "frozen": "0"
      }, 
      "BCH": {
        "available": "1002000200.00000000", 
        "frozen": "0"
      },
      "BTC": {
        "available": "100.00000000", 
        "frozen": "0"
      }
    },
    ...
  },
  "id": 15
}
  • 方法: “asset.account_query_all”
  • 鑑權: 需要, 參考server.sign
  • 返還參數說明:

    名稱 類型 描述
    available String 可用的金額
    frozen String 凍結的金額

示例:

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “asset.subscribe”
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:
名稱 類型 是否必須 描述
params Array\<String\> Yes asset list, 資產列表
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "asset.update", 
  "params": [
    {
      "BTC": {
        "available": "250",
        "frozen": "10",
      }
    }
  ], 
  "id": null
}
  • 方法: “asset.update”
  • 鑑權: 需要, 參考server.sign
  • 推送參數說明:

    名稱 類型 描述
    available String 可用的金額
    frozen String 凍結的金額

示例:

// Request

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

// Response
{
  "error": null,
  "id": 4,
  "result": "success"
}
  • 方法: “asset.unsubscribe”
  • 鑑權: 需要, 參考server.sign
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

// Request
{
  "method":"index.query",
  "params":[
    "BTCUSDT",
  ],
  "id":15
}

// Response
{
  "error": null, 
  "result": {
    "name": "BTCUSDT",
    "time": 1637548343,
    "index": "57000.00"
  },
  "id": 15
}
  • 方法: “index.query”
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] String Yes market, 市場名稱
  • 返還參數說明:

    名稱 類型 描述
    name String 市場名稱
    time Integer 時間戳
    index String 指標價

示例:

// Request
{
  "method":"index.list",
  "params":[],
  "id":15
}

// Response
{
  "error": null, 
  "result": {
    "BTC": {
      "time": 1637564110000, 
      "index": "239094157.9068"
    }, 
    "HCUSDT": {
      "time": 1637564110000, 
      "index": "1.005"
    }, 
    "BSVUSDT": {
      "time": 1637564110000, 
      "index": "155.54000000"
    },
    ...
  },
  "id": 15
}
  • 方法: “index.list”
  • 返還參數說明:

    名稱 類型 描述
    time Integer 時間戳
    index String 指標價

示例:

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

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • 方法: “index.subscribe”
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "index.update",
  "params": [
    "BTCUSDT",
    "57000.00"
  ],
  "id": null
}
  • 方法: “index.update”
  • 推送參數說明:

    名稱 類型 描述
    params[0] String 市場名稱
    params[1] String 指標價

示例:

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

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • 方法: “index.unsubscribe”
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

// Request
{
  "method": "notice.subscribe",
  "params": [
    101
  ],
  "id":15
}

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • 方法: “notice.subscribe”
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:

    名稱 類型 是否必須 描述
    params[0] Integer Yes 101,表示臨時維護通知
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "notice.update",
  "params": [
    101,
    {
      "started_at": 1655347758, 
      "ended_at": 1656556940, 

      protect_duration" protect_duration_end": 1703834854,
      "scope": ["SPOT"]
    }
  ],
  "id": null
}
  • 方法: “notice.update”
  • 推送參數說明:
名稱 類型 描述
params[0] Integer 訂閱id,101表示臨時維護通知
params[1] Object 維護內容
started_at Integer 維護開始時間
ended_at Integer 維護結束時間
protect_duration_start Integer 維護結束後的保護期開始時間
protect_duration_end Integer 維護結束後的保護期結束時間
scope Array\<String\> 維護範圍,PERPETUAL: 合約, SPOT: 現貨, ALL_SITE: 全域維護

示例:

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

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • 方法: “notice.unsubscribe”
  • 鑑權: 需要, 參考server.sign
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

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

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • 方法: “deals_own.subscribe”
  • 鑑權: 需要, 參考server.sign
  • 請求參數說明:
名稱 類型 是否必須 描述
params Array\<String\> No 市場列表, 空為訂閱所有市場
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "deals_own.update",
  "params": [
    "BTCUSDT",
    [
      {
        "type": "sell",
        "time": 1496458040.059284,
        "price": "46444.74",
        "id": 29433,
        "amount": "0.00120000",
        "order_id": 523941,
        "client_id": ""
      }
    ]
  "
}
  • 方法: “deals_own.update”
  • 推送參數說明:

    名稱 類型 描述
    params[0] String market, 市場
    type String 類型, “sell”: 賣, “buy”: 買
    time float 時間戳
    price String 價格
    id Integer 編號
    amount String 數量
    order_id Integer 訂單id
    client_id String 客戶端id

示例:

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

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • 方法: “deals_own.unsubscribe”
  • 鑑權: 需要, 參考server.sign
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果

示例:

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

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • 方法: “bbo.subscribe”

  • 請求參數說明:

    名稱 類型 是否必須 描述
    params Array<String> No 市場列表, 空為訂閱所有市場
  • 返還參數說明:

    名稱 類型 描述
    result String 訂閱結果

示例:

// Notify
{
  "method": "deals_own.update",
  "params": {
    "market": "BTCUSDT"
    "time": 1656660154,
    "bid_price": "20000",
    "bid_amount": "0.1",
    "ask_price": "200001",
    "ask_amount": "0.15"
  },
  "id": null
}
  • 方法: “bbo.update”
  • 推送參數說明:

    名稱 類型 描述
    market String 市場名稱
    time Integer 時間戳
    bid_price String 買一價
    bid_amount String 買一量
    ask_price String 賣一價
    ask_amount String 賣一量

示例:

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

// Response
{
  "error": null, 
  "result": "success",
  "id": 15
}
  • 方法: “bbo.unsubscribe”
  • 返還參數說明:

    名稱 類型 描述
    result String 取消訂閱結果
做市商专属对接人
Telegram @CoinExvipmanager
Email vip@coinex.com