API Documentation v1

Overview

  1. API 有两类:公共 API 和用户 API。目前公共 API 包括 ticker, trades, depth;用户 API 包括 info, orders, order, transactions, trade, cancel
  2. 公共 API 无需身份验证,用户 API 需要使用 密钥,请求时 HTTP 头部需要如下字段:
    1. Key: API Key,例如:2B-58D181C3-13E6053D-939BB278
    2. Sign: 使用 API Secret,对 POST 参数(例如:a=1&b=2)进行 HMAC-SHA512 运算得到的签名
  3. Each User API request requires an additional POST parameter: nonce (must be a positive integer)
  4. API initiation address:https://mixcoins.com/api/v1
  5. Public API uses HTTP GET requests. User API uses POST requests.
  6. Server responses use the JSON format, and the data structure is as follows:
    {'status': xxx, 'message': 'xxx', 'result': xxx}
    During a normal request, status is 200 and result returns the content. When there is a request error, status is not 200, message will return a specific error message

API List

APIIdentity Verification RequiredFunction
/ticker/-Get the latest quotes
/trades/-Get the latest transaction list
/depth/-Get the latest depth
/info/获取用户资产
/orders/获取用户委托列表
/order/获取单个委托
/transactions/获取用户成交列表
/trade/下单
/cancel/Cancel

/ticker/

  1. Get the latest quotes
  2. Supported parameters:
    1. market: Market, optional: btc_usdt, eth_btc, bch_btc, lsk_btc, bch_usdt, eth_usdt
  3. Examples
    {
      "status": 200,
      "message": "ok",
      "result": {
        "last": "600",
        "sell": "610.77",
        "buy": "590",
        "high": "650",
        "low": "550",
        "vol": "9",
      }
    }
    

/trades/

  1. Get the latest transaction list
  2. Supported parameters:
    1. market: Market, optional: btc_usdt, eth_btc, bch_btc, lsk_btc, bch_usdt, eth_usdt
  3. Examples
    {
      "status": 200,
      "message": "ok",
      "result": [
        {
          "date": 1407694316,
          "amount": "38.9998",
          "price": "2",
          "id": 3355
        },
        {
          "date": 1406813788,
          "amount": "0.1",
          "price": "582.6",
          "id": 3205
        }
      ]
    }
    

/depth/

  1. Get the latest depth
  2. Supported parameters:
    1. market: Market, optional: btc_usdt, eth_btc, bch_btc, lsk_btc, bch_usdt, eth_usdt
  3. Examples
    {
      "status": 200,
      "message": "ok",
      "result": {
        "bids": [
          [
            3.0,
            1.2345
          ],
          [
            1.0,
            82.99
          ]
        ],
        "asks": [
          [
            4.0,
            1.2345
          ]
        ]
      }
    }
    

/info/

  1. 获取用户资产
  2. Examples
    {
      "status": 200,
      "message": "ok",
      "result": {
        "wallet": {
          "usd": {
            "avail": "1171.16",
            "lock": "8830.54"
          },
          "btc": {
            "avail": "38.99984835",
            "lock": "61"
          },
          "cny": {
            "avail": "0",
            "lock": "0"
          }
        },
        "fund": {
          "arbitrage": {
            "usd": {
              "avail": "0",
              "last_income": "0",
              "last_earn": "0"
            },
            "btc": {
              "avail": "0",
              "last_income": "0",
              "last_earn": "0"
            }
          }
        }
      }
    }
    
    wallet 是用户钱包,avail 为可用余额,lock 为冻结;fund 是用户基金,arbitrage 是套利宝,last_income 和 last_earn 表示昨日收益及昨日奖励

/orders/

  1. 获取用户委托列表
  2. Supported parameters:
    1. market: Market, optional: btc_usdt, eth_btc, bch_btc, lsk_btc, bch_usdt, eth_usdt
    2. catalog: 类别,0 表示买入,1 表示卖出
    3. status: 状态,0~4 分别表示:未成交、部分成交、全部成交、已撤单、撤单中
    4. since_id: 从哪个 id 开始
    5. order: 排序,可选 ASC 或 DESC(默认)
    6. count: 返回数量,最多为:20
  3. Examples
    {
      "status": 200,
      "message": "ok",
      "result": [
        {
          "status": 3,
          "created_at": "2014/08/10 18:14:57",
          "money_deal": "0",
          "amount_deal": "0",
          "updated_at": "2014/08/10 18:14:57",
          "id": 4317,
          "catalog": 0,
          "order_type": 0,
          "avg_price": "0",
          "market": "btc_usdt",
          "fee": "0",
          "price": "3",
          "amount": "1.2345"
        },
        {
          "status": 0,
          "created_at": "2014/08/10 18:13:12",
          "money_deal": "90",
          "amount_deal": "1",
          "updated_at": "2014/08/10 18:13:12",
          "id": 4316,
          "catalog": 0,
          "order_type": 1,
          "market": "btc_usdt",
          "fee": "0",
          "avg_price": "90",
          "amount": "1"
        }
      ]
    }
    
    created_at 是下单时间;updated_at 是最后更新时间(有交易或撤单了);order_type 是挂单类型(0:限价单,1:市价单);price 和 amount_total 是下单时指定的价格和数量(限价单才有);money_deal 是成交金额;amount_done 是成交数量;avg_price 是平均成交价;mo_amount 是总金额或卖出量(市价单才有)

/order/

  1. 获取单个委托
  2. 支持参数(都必选):
    1. id: 委托单号
  3. Examples
    {
      "status": 200,
      "message": "ok",
      "result": {
          "status": 3,
          "created_at": "2014/08/10 18:14:57",
          "money_deal": "0",
          "amount_done": "0",
          "updated_at": "2014/08/10 18:14:57",
          "id": 4317,
          "catalog": 0,
          "order_type": 0,
          "avg_price": "0",
          "price": "3",
          "amount_total": "1.2345"
      }
    }
    

/transactions/

  1. 获取用户成交列表
  2. Supported parameters:
    1. market: Market, optional: btc_usdt, eth_btc, bch_btc, lsk_btc, bch_usdt, eth_usdt
    2. catalog: 类别,0 表示买入,1 表示卖出
    3. since_id: 从哪个 id 开始
    4. order: 排序,可选 ASC 或 DESC(默认)
    5. count: 返回数量,最多为:20
  3. Examples
    {
      "status": 200,
      "message": "ok",
      "result": [
        {
          "amount": "38.9998",
          "type": "bid",
          "price": "2",
          "id": 3355
        },
        {
          "amount": "38.9998",
          "type": "bid",
          "price": "2",
          "id": 3354
        }
      ]
    }
    

/trade/

  1. 下单
  2. Supported parameters:
    1. market: Market, optional: btc_usdt, eth_btc, bch_btc, lsk_btc, bch_usdt, eth_usdt
    2. op: 类别,buy 或 sell,必选
    3. order_type: 挂单类型,0 表示限价单,1 表示市价单,必选
    4. price: 价格,order_type 为 0 时必选
    5. amount: 数量,必选
  3. Examples
    {
      "status": 200,
      "message": "ok",
      "result": {
        "status": 0,
        "created_at": "2014/08/10 19:15:17",
        "money_deal": 0,
        "amount_done": 0,
        "updated_at": "2014/08/10 19:15:17",
        "id": 4318,
        "catalog": 0,
        "order_type": 0,
        "avg_price": 0,
        "price": "3",
        "amount_total": "2"
      }
    }
    

/cancel/

  1. Cancel
  2. 支持参数(都必选):
    1. id: 委托单号
  3. Examples
    {
      "status": 200,
      "message": "ok",
      "result": "OK"
    }