Written by KomoDeFi Editorial Team on May 18, 2019

How to use HitBTC public api - example price, pair & volume

Today we will review how to use HitBTC public API to get the price, market data for use in your market maker-in-a-box or a secure trustless oracle for price feeds, like one in testing at Komodo. The market currently has more than 700 coins listed to trade from. This means you can get pricing data of every popular cryptocurrency in the world.

Check out our cryptocurrency wallet getting started articles.

Getting Prices with HitBTC API

There can be a lot of functions that can be achieved using the public API of HitBTC. We can get the latest market prices, get market limits and even deposit or withdraw from our CEX accounts. To get custom and advanced market data it will require authenticated APIs with API keys.

https://api.hitbtc.com/api/2/public/ticker/ETHBTC

This API endpoint URL returns the current market price for BTC and ETH pair returning a JSON data like this,

JSON Response Example:

{
  "ask": "0.030488",
  "bid": "0.030487",
  "last": "0.030487",
  "open": "0.031790",
  "low": "0.030424",
  "high": "0.031834",
  "volume": "75801.4510",
  "volumeQuote": "2366.3425029031",
  "timestamp": "2019-04-24T01:41:00.233Z",
  "symbol": "ETHBTC"
}

Public API for other market pairs

We can get more and different price data for different markets by just simply editing the coin pairs which is called a parameter in the API endpoint. We will get BTC/KMD, BTC/LTC, BTC/BCH like this.

BTC to KMD Endpoint: https://api.hitbtc.com/api/2/public/ticker/KMDBTC

JSON Response Example:

{
  "ask": "0.00018699",
  "bid": "0.00018625",
  "last": "0.00018691",
  "open": "0.00020104",
  "low": "0.00018578",
  "high": "0.00020144",
  "volume": "116171.5",
  "volumeQuote": "22.386307664",
  "timestamp": "2019-04-24T01:41:55.825Z",
  "symbol": "KMDBTC"
}

BTC to LTC Endpoint: https://api.hitbtc.com/api/2/public/ticker/LTCBTC

JSON Response Example:

{
  "ask": "0.0131614",
  "bid": "0.0131429",
  "last": "0.0131437",
  "open": "0.0142510",
  "low": "0.0128523",
  "high": "0.0143290",
  "volume": "584901.901",
  "volumeQuote": "8113.7049880954",
  "timestamp": "2019-04-24T01:42:19.236Z",
  "symbol": "LTCBTC"
}


BTC to BCH Endpoint: https://api.hitbtc.com/api/2/public/ticker/BCHBTC

JSON Response Example:

{
  "ask": "0.061494",
  "bid": "0.061330",
  "last": "0.061372",
  "open": "0.064887",
  "low": "0.060848",
  "high": "0.066511",
  "volume": "26.8784",
  "volumeQuote": "1.7347668728",
  "timestamp": "2019-04-24T01:43:05.532Z",
  "symbol": "BCHBTC"
}

Advanced API Key Functions

More advanced API endpoints are used with API key in headers or API endpoint.The pricing API used or ticker information is public and do not require secure API key or signup.This data can be used anywhere in your bots, softwares, websites because this data is real time and dynamic which you can feed to your programs.  You can find the API’s on https://api.hitbtc.com/ .

Back to Top
Experience Web3
© 2024 komodefi.com