API

Public API

All requests go over https protocol, The field 'contentType' in request header should be: 'application/x-www-form-urlencoded'. The root url is: https://api.bitholic.com/public In case of any problem, please contact our support team.

Please note that making more than 10 calls per second to the public API, or repeatedly and needlessly fetching excessive amounts of data, can result in your IP being banned. There are public methods, all of which take HTTP GET requests and return output in JSON format:

ticker

Returns the ticker for all markets. Sample output:

{
  "market":
    {
      "BTC_ETH":
        {
          "last":  "0.03752222",
          "ask":  "0.03760001",
          "bid":  "0.03660009",
          "percentChange":  "2.52",
          "volume24h":  "1345.12000000"
        },
      "BTC_ETC":
        {...},
      "BTC_LTC":
        {...}
    }
}

Call: https://api.bitholic.com/public/ticker

orderBook

Returns the buy/sell order for all markets, buy/sell:[price,amount,total] Sample output:

{
  "BTC_ETH":
      {
        "buy":
          [
            [0.03199998,129.99,4.15999739],
            [0.03129998,77.12458475,2.41399796],
            [0.03,200,6]
          ],
        "sell":
          [
            [0.032,170.99,12.8],
            [0.041,74.98,3.07418],
            [0.0415,10,0.415],
            [0.08,500,40],
            [0.1,1011,101.1]
          ]
      },
  "BTC_LTC":
      {...}
}

Call: https://api.bitholic.com/public/orderbook

tradeHistory

Returns the past 20 trades for a given market Sample output:

{
  "BTC_ETH":
  [
    [179339,"sell",0.03199998,0.01,"2017-08-14 02:22:09",0.00032],
    [179338,"buy",0.032,0.01,"2017-08-14 02:21:48",0.00032],
    [179337,"buy",0.032,0.01,"2017-08-14 02:21:42",0.00032],
    [179336,"buy",0.032,0.01,"2017-08-14 02:21:37",0.00032]
  ],
  "BTC_LTC":
  [
    ...
  ]
}

Call: https://api.bitholic.com/public/tradehistory

Private API

General API Information

  • The base endpoint is: https://api.bitholic.com/private
  • All endpoints return either a JSON object or array.
  • For `POST`, `PUT`, and `DELETE` endpoints, the parameters may be sent as a `query string` or in the `request body` with content type `application/x-www-form-urlencoded`. You may mix parameters between both the `query string` and `request body` if you wish to do so.
  • Parameters may be sent in any order.
  • If a parameter sent in both the `query string` and `request body`, the `query string` parameter will be used.

Endpoint security type

  • Each endpoint has a security type that determines the how you will interact with it.
  • API-keys are passed into the Rest API via the `X-BITHOLIC-API` header.
  • API-keys and secret-keys are case sensitive.
  • API-keys can be configured to only access certain types of secure endpoints. For example, one API-key could be used for TRADE only, while another API-key can access everything except for TRADE routes.
  • By default, API-keys can access all secure routes.
  • Security Type
    Description
    NONE
    Endpoint can be accessed freely.
    TRADE
    Endpoint requires sending a valid API-Key and signature.
    USER_DATA
    Endpoint requires sending a valid API-Key and signature.
  • `TRADE` and `USER_DATA` endpoints are `SIGNED` endpoints.

SIGNED (TRADE and USER_DATA) Endpoint security

  • `SIGNED` endpoints require an additional parameter, `X-BITHOLIC-SECRET`, to be sent in the `Header`.
  • Endpoints use `HMAC SHA256` signatures. The `HMAC SHA256 X-BITHOLIC-SECRET` is a keyed `HMAC SHA256` operation.
  • The `X-BITHOLIC-SECRET` is not case sensitive.

SIGNED Endpoint Examples for POST /private/order/{pairs}

Here is a step-by-step example of how to send a vaild signed payload from the Linux command line using `echo`, `openssl`, and `curl`.

Key
Value
apiKey
c6b185f35ea09f0168bc3374df63737e
secretKey
933c83b1514543a7c98e4d18ef6227db4ad8a6ad0d781136da6e7bd77312adfd9.
917652802465165e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
Parameter
Value
type
buy
price
1.00000
amount
1.00000000

Example 1: As a query string

  • queryString: symbol=qtum_btc
  • HMAC SHA256 signature:
  • [linux]$ echo -n "symbol=qtum_btc" | openssl dgst -sha256 -hmac "933c83b1514543a7c98e4d18ef6227db4ad8a6ad0d781136da6e7bd77312adfd9.917652802465165e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
    (stdin)= 5a7a04dd34108f0885eaf4e03592caab907e1fbac1c6ce4db92689851a16491b

  • curl command:
  • (HMAC SHA256)
    [linux]$ curl -X GET \
    'https://api.bitholic.com/private/balances?symbol=qtum_btc' \
    -H 'X-BITHOLIC-API: c6b185f35ea09f0168bc3374df63737e' \
    -H 'X-BITHOLIC-SECRET: 5a7a04dd34108f0885eaf4e03592caab907e1fbac1c6ce4db92689851a16491b'

Example 2: As a request body

  • requestBody: type=buy&price=1.00000&amount=1.00000000
  • HMAC SHA256 signature:
  • [linux]$ echo -n "type=buy&price=1.00000&amount=1.00000000" | openssl dgst -sha256 -hmac "933c83b1514543a7c98e4d18ef6227db4ad8a6ad0d781136da6e7bd77312adfd9.
    917652802465165e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
    (stdin)= f3c45c8858b54ee633914d45ee38171b9d97c5fd903c4965dd7af55261f9faca

  • curl command:
  • (HMAC SHA256)
    [linux]$ curl -X POST \
    https://api.bitholic.com/private/order/btc-qtum \
    -H 'X-BITHOLIC-API: c6b185f35ea09f0168bc3374df63737e' \
    -H 'X-BITHOLIC-SECRET: f3c45c8858b54ee633914d45ee38171b9d97c5fd903c4965dd7af55261f9faca' \
    -F type=buy \
    -F price=1.00000 \
    -F amount=1.00000000

Private API End point

Get current balances (USER_DATA)

GET /private/balances (HMAC SHA256)

Get current balances.

Parameters:

Name
Type
Mandatory
Description
symbol
STRING
qtum_btc
baseCoin_coin

Response:

{
  "data": {
    "qtum": {
      "unit": "qtum",
      "trade": "230.14094719",
      "withdrawal": "0.00000000",
      "available": "999590.67375618"
    },
    "btc": {
      "unit": "btc",
      "trade": "0.44064877",
      "withdrawal": "0.00000000",
      "available": "999999.47896251"
    }
  }
}

Register your order (TRADE)

POST /private/order/{pairs} (HMAC SHA256)

Register your order.

Parameters:

Name
Type
Mandatory
Description
type
STRING
buy
buy or sell
price
FLOAT
1.00000
digit 5 or 8
amount
FLOAT
1.00000000
digit 8

Notes:

  • Either `type` or `price` or `amount` must be sent.

Response:

{
  "orderId": "58461",
  "price": "1.00000",
  "amount": "1.00000000",
  "total": "1.00000000",
  "time": 1554018564.829608,
  "isTaker": false
}

Cancel order (TRADE)

POST /private/cancel/{pairs}

Cancel the registered order.

Parameters:

Name
Type
Mandatory
Description
orderId
INT
58461

Notes:

  • `orderId` must be sent.

Response:

{
  "orderId": 58461,
  "delete": true
}

Get your open orders (USER_DATA)

GET /private/openOrders (HMAC SHA256)

Get your open orders.

Parameters:

Name
Type
Mandatory
Description
symbol
STRING
qtum_btc
baseCoin_coin
type
STRING
buy
buy or sell
limit
INT
30
count result

Notes:

  • `symbol` must be sent.

Response:

[
  {
    "id": "466",
    "type": "Buy",
    "status": "REQ",
    "price": "1744.97294",
    "amount": "0.14255421",
    "filledAmount": "0.00000000"
  }
]

Get your completed order (USER_DATA)

GET /private/tradeHistories (HMAC SHA256)

Get your completed order.

Parameters:

Name
Type
Mandatory
Description
symbol
STRING
qtum_btc
baseCoin_coin
type
STRING
sell
buy or sell
limit
INT
30
count result

Notes:

  • `symbol` must be sent.

Response:

[
  {
    "type": "Sell",
    "status": "OK",
    "filledAmount": "0.57135842",
    "avgPrice": "1744.97293",
    "total": "997.00498193"
  },
  {
    "type": "Sell",
    "status": "OK",
    "filledAmount": "0.57250228",
    "avgPrice": "1744.97293",
    "total": "999.00098667"
  }
]

Get your balance History (USER_DATA)

GET /private/balanceHistories (HMAC SHA256)

Get your balance History.

Parameters:

Name
Type
Mandatory
Description
coin
STRING
qtum
coin
type
STRING
withdrawals
deposits or withdrawals
limit
INT
30
count result

Notes:

  • `type` must be sent.

Response:

[
  {
    "id": "9",
    "type": "withdrawals",
    "coin": "qtum",
    "amount": "6.00000000",
    "is_pay": "N",
    "timestamp": "2019-02-13 09:47:26.725403"
  }
]