Introduction
Welcome to the BitcoinAverage API! The world's best and longest running Cryptocurrency price API provider.
These APIs can be used to gather real-time, OHLC, volume and historical price data for the following Cryptocurrencies:
Bitcoin (BTC), Bitcoin Cash (BCH), Litecoin (LTC), Ethereum (ETH), Dash (DASH), Ripple (XRP), Monero (XMR) plus many more.
The full list of supported cryptocurrency markets can be found at this endpoint: Price Symbols
The full list of cryptocurrencies and tokens with full names is here: Full Names
Our Cryptocurrency price data is sourced and aggregated from exchanges all over the world, a selection of these can be found below:
Bitfinex, Bitstamp, GDAX, Kraken, Coinbase, Poloniex, Bittrex, LocalBitcoins, ItBit, HitBTC, Coinfloor, LakeBTC, Gemini, Exmo, Korbit, QuadrigaCX, Bitsquare, Quoine, Luno, Independant Reserve, Coinmate, Bitbay, Paymium, Rocktrading, CampBX, Loyalbit, Spacebtc, Mexbt, Okcoin, Btcc, Btc38, Bitflyer, Binance.
The full list of integrated cryptocurrency exchanges and their orderbook symbols can be found at this endpoint: Exchange Symbols
DISCLAIMER
ANY ACCESS AND USE OF THE API AND OUR DATA IS SOLELY YOUR RESPONSIBILITY. FOR FULL TERMS AND CONDITIONS PLEASE CLICK HERE
Permissions
Most endpoints are free to use without restriction, however some do require additional permissions, the current permission levels are:
- Free (Registered)
- Developer
- Business
- Enterprise
If an endpoint requires special permissions the level required will be outlined on the endpoint. The API key used to authenticate requests to these endpoints must be of the correct level to gain access.
API Key Generation Limit
Plan | API Keys Allowed |
---|---|
Free | 1 |
Developer | 3 |
Business | 5 |
Enterprise | 10 |
Authentication
The majority of our API is free to use. However, certain endpoints require authentication that requires registration and the generation of an API Key. Please Sign Up to create a key pair.
Access to our API is rate limited depending on the users plan. Full details of each plan's access rights can be found here
Signing
Any request that is made using an API Key must be signed, you can create an API Key pair in your account.
Requests
All authenticated requests must contain this header:
X-signature
- Containing timestamp, public_key and digest_value
Note: These values are dot (.) separated URL safe strings
Step 1 - Create a payload consisting of “timestamp.public_key”:
timestamp
- This is an integer value representing the unix epoch. This needs to be no more than 15 seconds different than our server time for the request to pass. This prevents replay attacks. If you wish to check our server time please use the "/constants/time" endpoint.
public_key
- Public API Key as a string
Note: On some systems the timestamp is generated as 123541.123, a decimal value, make sure to convert this to integer i.e. strip the decimal part.
Example payload:
* 1234.YzQxNGYyMGI1YzJjNDg3YThkOGU1MTgwZWNhYjY4ODI=
Step 2 - The payload needs to be HMAC encrypted with the sha256 algorithm using your API secret key that corresponds to the given public key in the payload. This result is called a 'digest_value' and needs to be in hex representation:
Example:
payload = 1234.YzQxNGYyMGI1YzJjNDg3YThkOGU1MTgwZWNhYjY4ODI=
Secret key = abcdef123456
digest_value = a963aa66dbe4871ca17bbd64d5c1043d2f9204f19538b6e0f69c78f04adab9c8
Example of an invalid digest_value
:
* \xc4\xfe\x8e\xe0\xa7b-F{&\xbaj\x99\x0f"\xdc\xe6\xdbxT\n\xd9\xa7\x96\x95:G!\x96\xdav|
- This value is the raw bytes value.
Step 3 - Finally we can compose the value that needs to be used in the X-signature
header. It’s contents need to be in the format:
timestamp.public_key.digest_value
Example X-signature
header:
* 1234.YzQxNGYyMGI1YzJjNDg3YThkOGU1MTgwZWNhYjY4ODI=.a963aa66dbe4871ca17bbd64d5c1043d2f9204f19538b6e0f69c78f04adab9c8
Integration
Github Code Snippets
Integration examples in multiple programming languages can be found on our GitHub repository.
We are looking to expand the languages we support, if you are interested in helping out please get in touch! support@bitcoinaverage.com
Python PIP library
This is as simple as running the following command in console:
pip install bitcoinaverage
For more details please visit: https://pypi.org/project/bitcoinaverage/
You can find out usage examples for all functions provided by our PIP library on our GitHub repository.
NPM NodeJS library
This is as simple as running the following command in console:
npm install bitcoinaverage
For more details please visit: https://www.npmjs.com/package/bitcoinaverage
Constants
Endpoints to return active symbols, exchange rates and time for use in other endpoints where required.
Fiat Exchange Rates
Example Request
$ curl https://apiv2.bitcoinaverage.com/constants/exchangerates/global
Example Response
{
"time": "23-03-2016 16:59:19",
"rates": {
"MXN": {
"name": "Mexican Peso",
"rate": "17.48512"
},
"USD": {
"name": "United States Dollar",
"rate": "1"
},
"JPY": {
"name": "Japanese Yen",
"rate": "112.5204"
},
"KRW": {
"name": "South Korean Won",
"rate": "1161.976675"
},
},
}
Returns global fiat exchange rates used in the current indices calculations
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/constants/exchangerates/{market}
PERMISSIONS
- No permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
market | False | Market. Options: global ,local |
Server Time
Example Request
$ curl https://apiv2.bitcoinaverage.com/constants/time
Example Response
{
"epoch": 1458754280,
"iso": "2016-03-23T17:31:20"
}
Returns our server time that can be used as a check when using API Key authentication
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/constants/time
PERMISSIONS
- No permissions required
Cryptocurrencies and Tokens by name
Example Request
$ curl https://apiv2.bitcoinaverage.com/symbols/indices/names/
Example Response
{
"tokens": {
"BAT": "Basic Attention Token",
"BRD": "Bread token",
"BTM": "BitMark",
"SUB": "Substratum Network",
"TNB": "Time New Bank",
"ZRX": "0x",
"APPC": "AppCoins",
"BTM*": "Bytom",
"CVC": "Civic",
"PAX": "Paxos Standard Token",
"PLC": "PlusCoin",
"MAID": "MaidSafe Coin",
...
},
"crypto": {
"ADA": "Cardano",
"RDD": "ReddCoin",
"BTCD": "BitcoinDark",
"BCN": "ByteCoin",
"GRS": "Groestlcoin",
"MONA": "MonaCoin",
"ARK": "ARK",
"ETC": "Ethereum Classic",
"NEBL": "Neblio",
"XVG": "Verge",
"VET": "VeChain",
"ZEC": "ZCash",
"NEO": "NEO",
}
}
Returns full names of all supported cryptocurrencies and tokens
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/symbols/indices/names/
PERMISSIONS
- No permissions required
Supported Currencies
Our APIs support 4 sets of symbols. When requesting any price related endpoint you will need to specify which set of symbols your required symbols resides in.
The Symbols (currency pairs), are a core concept of our platform, understanding how each symbols is derived is crucial for efficient usage of our APIs, please take the time to ensure you are aware of where and why they reside. If further clarification is needed please do Email Us and we will be more than happy to assist, or join us on [Slack!][https://slack.bitcoinaverage.com]
Below you can find descriptions for each symbol_set.
Symbol_Set | Description | Example |
---|---|---|
Global | This set provides global symbols that are derived from the Local currency markets. Symbols supported in this set will comprise a Cryptocurrency against approximately 170 fiat currencies. | BTCUSD,BTCMKD,ETHAUD |
Local | This set includes Cryptocurrencies that are actively traded to a fiat currency on an exchange. These are also known as our Currency Markets. | BTCUSD,ETHEUR,LTCUSD |
Crypto | This set comprises Crypto/Crypto pairs only. | XMRBTC,ETHXRP,LTCETH |
Tokens | This set includes any Token that is not in itself a coin or crypto, and instead resides on top of another blockchain such as Ethereum. These symbols can either be Token/Crypto or Token/Fiat | OMGUSD,REPBTC,EOSBTC |
Price Symbols (Ticker)
Returns a list of symbol sets and supported symbols for ticker endpoints.
Calculating reverse symbols
If you wish to get price data for say Bitcoin to Ethereum, symbol BTCETH, but only ETHBTC is supported in our API, you can easily derive the BTCETH price data from our ETHBTC price data.
- For all prices: Calculate 1/price. For example if the last value for ETHBTC is 0.0406, then BTCETH = 1 / 0.0406 = 24.63
- For volume: Multiply the given volume by the given last price. With the ETHBTC example, if the volume in ETH is 527348 and the last price is 0.0406 then the volume in BTC will be 527348 * 0.0406 = 21410.328
Example Request
$ curl https://apiv2.bitcoinaverage.com/symbols/indices/ticker
Example Response
{
"local": {
"symbols": [
"BTCAUD",
"BTCBRL",
"BTCCAD",
]
},
"global": {
"symbols": [
"BTCAED",
"BTCAFN",
"BTCALL",
]
},
"success": true
}
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/symbols/indices/ticker/{symbol_set}
PERMISSIONS
- No permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | False | Symbol Set. Options: global ,local ,crypto ,tokens |
Price Symbols (Historical)
Example Request
$ curl https://apiv2.bitcoinaverage.com/symbols/indices/history
Example Response
{
"symbols": [
"BTCAUD",
"BTCBRL",
"BTCCAD",
],
"success": true
}
Returns a list of symbol sets and supported symbols for historical data endpoints.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/symbols/indices/history/{symbol_set}
PERMISSIONS
- No permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | False | Symbol Set. Options: global ,local ,crypto ,tokens |
Exchange Symbols (Ticker)
Example Request
$ curl https://apiv2.bitcoinaverage.com/symbols/exchanges/ticker
Example Response
{
"local": {
"symbols": [
"BTCAUD",
"BTCBRL",
"BTCCAD",
]
},
"global": {
"symbols": [
"BTCAED",
"BTCAFN",
"BTCALL",
]
},
"success": true
}
Returns a list of supported symbols for exchange ticker endpoints.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/symbols/exchanges/ticker
PERMISSIONS
- No permissions required
Exchange Symbols (Historical)
Example Request
$ curl https://apiv2.bitcoinaverage.com/symbols/exchanges/history
Example Response
{
"symbols": [
"BTCAUD",
"BTCBRL",
"BTCCAD",
],
"success": true
}
Returns a list of supported symbols for exchange historical data endpoints.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/symbols/indices/history
PERMISSIONS
- No permissions required
Crypto Metadata
We provide metadata for Cryptocurrencies including their Market Caps. This is a new endpoint and will be expanding over the coming months.
Metadata
Example Request
$ curl -H https://apiv2.bitcoinaverage.com/metadata
Example Response
{
"XRP": {
"volume": 298540280.0888047,
"change_percent": 8.63,
"market_cap": 114585354368.5959,
"change_price": 0.23,
"low": 2.333,
"bid": 2.95385,
"last": 2.95787,
"ask": 2.95787,
"high": 3.2
},
"ZEC": {
"volume": 9901767.491939863,
"change_percent": -6.41,
"market_cap": 1555241089.5,
"change_price": -35.73,
"low": 515.01,
"bid": 521.51,
"last": 521.52,
"ask": 521.8,
"high": 565.54
},
}
This endpoint returns metadata and market information for all suppported symbols.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/metadata
PERMISSIONS
- No permissions required
Price Data
We provide a single Global index, Local or currency market indices, Cryptocurrency indices, and Token price data.
All endpoints in this collection require the symbol_set parameter to be provided in the URL.
Ticker Data (All)
Example Request
$ curl -H "X-testing: testing" https://apiv2.bitcoinaverage.com/indices/global/ticker/all?crypto=BTC&fiat=USD,EUR
Example Response
{
"BTCUSD": {
"ask": 659.82,
"bid": 659.14,
"last": 659.58,
"high": 660.59,
"low": 653.86,
"open": {
"day": 653.99,
"week": 665.5,
"month": 638.03
},
"averages": {
"day": 656.36,
"week": 656.34,
"month": 657.07
},
"volume": 98908.81,
"changes": {
"percent": {
"day": 0.85,
"week": -0.89,
"month": 3.38
},
"price": {
"day": 5.59,
"week": -5.92,
"month": 21.55
}
},
"volume_percent": 29.57,
"timestamp": 1469802310,
"display_timestamp": "2016-07-29 14:25:10"
}
}
Filtering
- If no query parameters are sent, ticker data for every supported symbol is returned.
- If only crypto parameter is sent, then all symbols beginning with that cryptocurrency are returned.
- If only fiat parameter is sent, then all symbols ending with that fiat currency are returned.
- If both crypto and fiat parameters are sent, then only the symbols that both start with the cryptocurrency and end with the fiat currency are returned.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/{symbol_set}/ticker/all?crypto={crypto}&fiat={fiat,fiat}
PERMISSIONS
- Developer permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: global ,local ,crypto ,tokens |
crypto | False | Filters repsonse by supplied crypto currency. Example: BTC |
fiat | False | Filters repsonse by supplied fiat currency. Example: USD . (Accepts comma seperated values) |
Ticker Data (Per Symbol)
Example Request
$ curl https://apiv2.bitcoinaverage.com/indices/global/ticker/BTCUSD
Example Response
{
"ask": 418.79,
"bid": 418.35,
"last": 418.66,
"high": 418.83,
"low": 417.1,
"open": {
"day": "417.73",
"week": "408.74",
"month": "439.27"
},
"averages": {
"daily": 418.98,
"weekly": 418.39,
"monthly": 419.76
},
"volume": 56542.49,
"changes": {
"price": {
"weekly": 9.92,
"monthly": -20.62,
"daily": 0.93
},
"percent": {
"weekly": 2.43,
"monthly": -4.69,
"daily": 0.22
}
},
"volume_percent": 66.42,
"timestamp": 1458754392,
"display_timestamp": "Wed, 23 Mar 2016 17:33:12 +0000"
}
Returns ticker data for specified symbol
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/{symbol_set}/ticker/{symbol}
PERMISSIONS
- No permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: global ,local ,crypto ,tokens |
symbol | True | Full currency pair symbol. Example: BTCUSD |
Short Ticker (local and global symbols sets)
Example Request
$ curl https://apiv2.bitcoinaverage.com/indices/global/ticker/short?crypto=BTC&fiat=USD,EUR
Example Response
{
"BTCUSD": {
"last": 7008.87,
"bid": 7001.27,
"ask": 7010.12,
"averages": {
"daily": 6992.88882018
}
},
"BTCEUR": {
"last": 5990,
"bid": 5989,
"ask": 5992.42,
"averages": {
"daily": 5997.21898
}
}
}
Returns basic ticker denoting bid, ask, last prices and daily average price for the specified crypto/fiat values
Filtering
- If no query parameters are sent, ticker data for every supported symbol is returned.
- If only crypto parameter is sent, then all symbols beginning with that cryptocurrency are returned.
- If only fiat parameter is sent, then all symbols ending with that fiat currency are returned.
- If both crypto and fiat parameters are sent, then only the symbols that both start with the cryptocurrency and end with the fiat currency are returned.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/{symbol_set}/ticker/short?crypto={crypto}&fiat={fiat,fiat}
PERMISSIONS
- No permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: global ,local |
crypto | False | Filters repsonse by supplied crypto currency. Example: BTC . (Accepts comma separated values) |
fiat | False | Filters repsonse by supplied fiat currency. Example: USD . (Accepts comma seperated values) |
Short Ticker (crypto and tokens symbols sets)
Example Request
$ curl https://apiv2.bitcoinaverage.com/indices/crypto/ticker/short?base=DASH,NEO&target=BTC,ETH
Example Response
{
"DASHBTC": {
"last": 0.021395266752125056,
"averages": {
"day": 0.05197267
},
"timestamp": 1535089680,
"ask": 0.021434040608448474,
"bid": 0.021342895647318318
},
"DASHETH": {
"last": 0.5057714133779478,
"averages": {
"day": 0.58314002
},
"timestamp": 1535089681,
"ask": 0.5066995885976693,
"bid": 0.5053734038463437
},
"NEOBTC": {
"last": 0.00269529815470372,
"averages": {
"day": 0.00814457
},
"timestamp": 1535089685,
"ask": 0.002696300117623886,
"bid": 0.002693643744789217
},
"NEOETH": {
"last": 0.06380616754597206,
"averages": {
"day": 0.09714228
},
"timestamp": 1535089685,
"ask": 0.06384968777133948,
"bid": 0.0637315057381096
}
}
Returns basic ticker denoting bid, ask, last prices and daily average price for the specified base and target cryptocurrencies
Filtering
- If no query parameters are sent, ticker data for every supported symbol is returned.
- If only base parameter is sent, then all symbols beginning with any of the base cryptocurrencies are returned.
- If only target parameter is sent, then all symbols ending with any of the target currencies are returned.
- If both base and target parameters are sent, then only the symbols that both start with the base cryptocurrencies and end with the target cryptocurrencies are returned.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/{symbol_set}/ticker/short?base={crypto1,crypto2}&target={crypto3,crypto4}
PERMISSIONS
- Developer Permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: crypto ,tokens |
base | False | Filters repsonse by supplied base cryptocurrency. Example: XRP,XMR . (Accepts comma separated values) |
target | False | Filters repsonse by supplied target cryptocurrency. Example: BTC,ETH . (Accepts comma seperated values) |
Ticker Changes
Example Request
$ curl -H "X-Testing: testing" https://apiv2.bitcoinaverage.com/indices/global/ticker/BTCUSD/changes
Example Response
{
"BTCAED": {
"last": 1537.87,
"averages": {
"daily": 1538.88882018
}
},
"BTCAFN": {
"last": 28622.42,
"averages": {
"daily": 28641.47321898
}
},
"BTCALL": {
"last": 51817.38,
"averages": {
"daily": 51851.87587098
}
},
"BTCAMD": {
"last": 201234.11,
"averages": {
"daily": 201368.07228102
}
},
}
Returns ticker values and price changes for specified symbol_set and symbol.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/{symbol_set}/ticker/{symbol}/changes
PERMISSIONS
- Developer permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: global ,local ,crypto ,tokens |
symbol | True | Full currency pair symbol. Example: BTCUSD |
Custom Ticker
Example Request
$ curl -H "X-Testing: testing" https://apiv2.bitcoinaverage.com/indices/ticker/custom/include/BTCUSD?exchanges=bitstamp,bitfinex
Example Response
{
"bid": {
"price": 2774.53
},
"timestamp": 1496934885,
"ask": {
"price": 2776.85
},
"last": {
"price": 2776.85
}
}
Returns ticker values and price changes for specified symbol_set and symbol.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/ticker/custom/{inex}/{symbol}?exchanges={exchange_list}
PERMISSIONS
- Business permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
inex | True | Include or Exclude the provided exchange_list. Options: include or exclude |
exchanges | True | A comma seperated list of exchanges. |
Historical Data
Historical Data
Example Request
$ curl https://apiv2.bitcoinaverage.com/indices/global/history/BTCUSD?period=daily&?format=json
Example Response
[
{
"time": "2016-03-23 17:40:00",
"average": 418.81
},
{
"time": "2016-03-23 17:39:00",
"average": 418.57
},
{
"time": "2016-03-23 17:38:00",
"average": 418.57
},
{
"time": "2016-03-23 17:37:00",
"average": 418.7
},
{
"time": "2016-03-23 17:36:00",
"average": 418.68
},
{
"time": "2016-03-23 17:35:00",
"average": 418.57
},
]
Return historical ticker data for 'symbol'. Optional 'format' parameter with value csv/json
Periods
- daily - per minute daily sliding window.
- monthly - per hour monthly sliding window.
- alltime - per day all time history (default value)
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/{symbol_set}/history/{symbol}?period={period}&format={format}
PERMISSIONS
- Developer permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: global ,local ,crypto ,tokens |
symbol | True | Full currency pair symbol. Example: BTCUSD |
period | False | Data set period. Options: daily ,monthly ,alltime |
format | False | Response format. Options: json ,csv |
Data Since Timestamp
Example Request
$ curl -H "X-Testing: testing" https://apiv2.bitcoinaverage.com/indices/global/history/BTCUSD?since=1405394590
Example Response
[
{
"ts": 1460624400.0,
"average": 424.06,
"time": "2016-04-14 09:00:00"
},
{
"ts": 1460620800.0,
"average": 423.90,
"time": "2016-04-14 08:00:00"
},
{
"ts": 1460617200.0,
"average": 424.14,
"time": "2016-04-14 07:00:00"
},
]
Return historical ticker data since 'timestamp' only
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/{symbol_set}/history/{symbol}?since={timestamp}
PERMISSIONS
- Developer permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: global ,local ,crypto ,tokens |
symbol | True | Full currency pair symbol. Example: BTCUSD |
since | True | Timestamp in unix format. Example: 1405394590 |
Price At Timestamp
Example Request
$ curl -H "X-Testing: testing" https://apiv2.bitcoinaverage.com/indices/global/history/BTCUSD?at=1402476700
Example Response
{
"average": 424.79,
"time": "2016-04-14 00:00:00"
}
Return price at specified timestamp (unix format)
- If timestamp is in per_minute data set, returns price closest to minute
- If timestamp is in per_hour data set, returns price closest to hour
- If timestamp is in per_day data set, returns price closest to timestamp at 00:00 that day
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/indices/{symbol_set}/history/{symbol}?at{timestamp}
PERMISSIONS
- Developer permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: global ,local ,crypto ,tokens |
symbol | True | Full currency pair symbol. Example: BTCUSD |
since | True | Timestamp in unix format. Example: 1402476700 |
Exchange Data
The endpoints in this section provide real-time exchange data and other metrics.
If you require historical exchange data please refer to the Historical Data section.
Exchange Data (Per Exchange)
Example Request
$ curl https://apiv2.bitcoinaverage.com/exchanges/ticker/bitstamp
Example Response
{
"name": "bitstamp",
"display_name": "Bitstamp",
"url": "https://bitstamp.net/",
"timestamp": 1458755191,
"data_source": "api",
"symbols": {
"BTCUSD": {
"last": 2419.82,
"volume": 34209.98,
"ask": 2419.76,
"bid": 2412.56,
"high": 2756.16,
"low": 2230.00,
"open": 2451.42,
"vwap": 2504.92
}
}
}
Returns specified exchange's symbols and data
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/exchanges/ticker/{exchange_name}
PERMISSIONS
- No permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
exchange_name | True | Exchanage's name. Example: bitstamp |
Exchange Data (All)
Example Request
$ curl -H "X-testing: testing" https://apiv2.bitcoinaverage.com/exchanges/ticker/all
Example Response
[
{
"name": "bitcurex",
"display_name": "Bitcurex",
"url": "https://bitcurex.com/",
"timestamp": 1458755176,
"data_source": "api",
"symbols": {
"BTCPLN": {
"ask": 1610.00,
"bid": 1609.00,
"last": 1610.00,
"volume": 47.22
},
"BTCEUR": {
"ask": 373.10,
"bid": 370.23,
"last": 373.10,
"volume": 98.86
}
}
},
{
"name": "bitex",
"display_name": "Bitex.la",
"url": "https://bitex.la/",
"timestamp": 1458755194,
"data_source": "api",
"symbols": {
"BTCUSD": {
"ask": 417.00,
"bid": 415.57,
"last": 416.70,
"volume": 133.54
}
}
},
]
Returns a list of all exchanges with their integrated symbols and data. Data can be filtered by crypto and/or fiat currency
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/exchanges/ticker/all?crypto={crypto}&fiat={fiat}
PERMISSIONS
- Developer permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
crypto | False | Filters repsonse by supplied crypto currency. Example: BTC |
fiat | False | Filters repsonse by supplied fiat currency. Example: USD,EUR,GBP . Accepts one or more comma seperated values |
Exchange Data (Per Symbol)
Example Request
$ curl -H "X-testing: testing" https://apiv2.bitcoinaverage.com/exchanges/ticker/all?symbol={symbol}
Example Response
{
"name": "gdax",
"display_name": "GDAX",
"url": "https://www.gdax.com/",
"timestamp": 1497516426,
"data_source": "api",
"symbols": {
"BTCUSD": {
"last": 2448.08,
"volume": 35068.96,
"ask": 2448.08,
"bid": 2446.56,
"high": 2789.31,
"low": 2210.00,
"open": 2775.81
}
}
},
{
"name": "btce",
"display_name": "BTC-e",
"url": "https://btc-e.com/",
"timestamp": 1497516426,
"data_source": "api",
"symbols": {
"BTCUSD": {
"last": 2437.78,
"volume": 13714.70,
"ask": 2437.78,
"bid": 2431.00,
"high": 2704.00,
"low": 2291.00,
"vwap": 2497.50
}
}
},
Returns a list of all exchanges with their integrated symbols and data. Data can be filtered by crypto or fiat currency
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/exchanges/ticker/all?symbol={symbol}
PERMISSIONS
- Developer permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol | True | Full currency pair symbol. Example: BTCUSD |
Ignored Exchanges
Example Request
$ curl https://apiv2.bitcoinaverage.com/exchanges/ignored
Example Response
[
{
"name": "cointrader",
"display_name": "Cointrader",
"url": "https://www.cointrader.net/",
"timestamp": 1458755278,
"ignore_reason": "Exchange has no daily volume"
}
]
Returns exchanges that are either ignored or inactive according to specified state parameter. With ignored exchanges a "ignore_reason" is provided
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/exchanges/{state}
PERMISSIONS
- No permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
state | True | Filter with specific state. Options: ignored ,inactive |
Exchange Count
Example Request
$ curl https://apiv2.bitcoinaverage.com/exchanges/count
Example Response
{
"included": 44,
"ignored": 3,
"count": 47,
"success": true
}
Return a total of integrated exchanges along with ignored, included and inactive status counts
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/exchanges/count
PERMISSIONS
- No permissions required
Exchange Outliers
Example Request
$ curl https://apiv2.bitcoinaverage.com/exchanges/outliers
Example Response
{
"last": {
"BTCUSD": {
"localbitcoins": 489.99
},
"BTCEUR": {
"hitbtc": 452.0
},
"BTCCAD": {
"localbitcoins": 586.59
}
},
"bid": {
"BTCUSD": {
"independentreserve": 414.06
},
"BTCEUR": {
"btcgreece": 367.87
}
},
"ask": {
"BTCUSD": {
"bitkonan": 438.99
}
}
}
Returns a list of exchanges that failed our sanity checks. Provides what value failed and on what order book
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/exchanges/outliers
PERMISSIONS
- No permissions required
Algorithm Weighting
These endpoints return the weighting data that are used to calculate our various indices
Indices Weighting
Example Request
$ curl https://apiv2.bitcoinaverage.com/weighting/exchanges
Example Response
{
"bit2c": {
"BTCILS": 100.00
},
"bitbargain": {
"BTCGBP": 9.00
},
"bitbay": {
"BTCPLN": 87.00,
"BTCEUR": 0.00
},
"bitcoin_co_id": {
"BTCIDR": 100.00
},
"bitcoin_de": {
"BTCEUR": 3.00
},
"bitcurex": {
"BTCPLN": 12.00,
"BTCEUR": 0.00
},
}
Returns a list of exchanges, their symbols, and their associated weights
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/weighting/exchanges
PERMISSIONS
- Developer permissions required
Currency Weights
Example Request
$ curl https://apiv2.bitcoinaverage.com/weighting/currencies
Example Response
{
"BTCUSD": {
"market_share": 56.77
},
"BTCEUR": {
"market_share": 25.81
},
"BTCHKD": {
"market_share": 3.54
},
"BTCSGD": {
"market_share": 2.37
},
"BTCRUB": {
"market_share": 2.02
},
"BTCGBP": {
"market_share": 1.87
},
}
Returns a list of currencies and their weights that are used to produce our Global Bitcoin Price Index
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/weighting/currencies
PERMISSIONS
- Developer permissions required
Price Conversion
Converter
Example Request
$ curl https://apiv2.bitcoinaverage.com/convert/global?from=BTC&to=USD&amount=2
Example Response
{
"success": true,
"time": "14-04-2016 13:55:32",
"price": 424.93
}
Returns conversion from start currency to resulting currency. Only conversion from fiat to crypto, or vice verca are supported. Conversion from crypto to crypto is not supported.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/convert/{symbol_set}?from={source_cur}&to={target_cur}&amount={amount}
PERMISSIONS
- Registered permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol_set | True | Symbol Set. Options: global ,local ,crypto ,tokens |
source_cur | True | Source currency code. Example: BTC |
target_cur | True | Target currency code. Example: USD |
amount | False | Amount of currency to convert. Example: 2 |
Blockchain Tools
Price Based on Transaction Hash
Example Request
$ curl https://apiv2.bitcoinaverage.com/blockchain/tx_price/BTCUSD/8a3b4394ba811a9e2b0bbf3cc56888d053ea21909299b2703cdc35e156c860ff
Example Response
{
"time": "2016-05-17 00:00:00",
"average": 457.91
}
Takes a transaction hash and returns a price for the day the transaction was conducted. The price is for the provided symbol.
Currently this endpoint only supports BTC currency symbols.
HTTP REQUEST
GET https://apiv2.bitcoinaverage.com/blockchain/tx_price/{symbol}/{hash}
PERMISSIONS
- Registered permissions required
URL PARAMETERS
Parameter | Required | Description |
---|---|---|
symbol | True | Full currency pair symbol. Example: BTCUSD |
hash | True | Valid transaction hash. Example: 8a3b4394ba811a9e2b0bbf3cc56888d053ea21909299b2703cdc35e156c860ff |
Websocket API
Overview
The websocket feed provides real-time market data for price indices and exchanges.
Root URL: wss://apiv2.bitcoinaverage.com/
Client Limits
Our Websocket APIs are limited to a fixed amount of clients per API Key. These are as follows:
Plan | Clients Allowed |
---|---|
Free | 2 |
Developer | 5 |
Business | 5 |
Enterprise | 10 |
Your account also supports multiple API Keys, the number of allowed keys can be found here.
Data Frequency
Our Websocket APIs update/push data at the following intervals:
Plan | Update Interval (seconds) |
---|---|
Free | 20 |
Developer | 15 |
Business | 10 |
Enterprise | 1 (real-time) |
Authentication
The procedure for authenticating websocket connections is the following:
Step 1.
- Send a GET request, signed with your public_key and secret_key to
https://apiv2.bitcoinaverage.com/websocket/get_ticket
- You will receive the ticker in the response. e.g:
{"ticket": "ASDFXZCVASDF2341234"}
- The method to sign the above request is explained in the general Authentication Section
Step 2.
Connect to the endpoints using their respective urls including public_key and ticket parameters. An example for subscribing to the single ticker endpoint would be:
wss://apiv2.bitcoinaverage.com/websocket/ticker?ticket=<THE RECEIVED TICKET>&public_key=<YOUR PUBLIC KEY>
Notes.
- If either of the parameters, public_key or ticket, are wrong, then the connection will be closed immediately by our server.
- The ticket can only be used once.
Channels
After authentication is complete the websocket connection is established, you may then subscribe to the required channel.
Available channels are listed below, they are single ticker, multiple ticker, single exchange and multiple exchanges.
Single Ticker
URL
wss://apiv2.bitcoinaverage.com/websocket/ticker
This channel returns data for one currency.
Every time you send a new subscription message, the response data switches to the latest currency. You will always receive data only for the currency in your last subscription message.
The unsubscribe message automatically closes the websocket connection.
Example Subscribe Message
{
"event": "message",
"data": {
"operation": "subscribe",
"options": {
"currency": "BTCUSD",
"symbol_set": "global"
}
}
}
Example Unsubscribe Message
{
"event": "message",
"data": {
"operation": "subscribe",
"options": {
"currency": "BTCUSD",
"symbol_set": "global"
}
}
}
Example Response
{
"event": "message",
"data": {
"ask": 3794.37,
"bid": 3788.77,
"last": 3792.99,
"high": 3886.24,
"low": 3646.44,
"open": {
"day": 3207.15,
"week": "",
"month": ""
},
"averages": {
"day": 3858.24,
"week": 3638.93,
"month": 3551.50
},
"volume": 91647.05917798,
"changes": {
"percent": {
"day": 18.27,
"week": "",
"month": ""
},
"price": {
"day": 585.84,
"week": "",
"month": ""
}
},
"volume_percent": 17.372942071735917,
"timestamp": 1504088398,
"display_timestamp": "2017-08-30 10:19:58",
"success": true,
"time": "2017-08-30 10:20:02"
}
}
Multiple Ticker
URL
wss://apiv2.bitcoinaverage.com/websocket/multiple/ticker
This channel returns data for multiple currencies. They are grouped by their market, local, global, crypto and tokens.
Every time you send a new subscription message, the requested currency is added to the response.
The unsubscribe message does not close the websocket connection but only removes the unsubscribed currency from the response.
Example Subscribe Message
{
"event": "message",
"data": {
"operation": "subscribe",
"options": {
"currency": "BTCUSD",
"symbol_set": "global"
}
}
}
Example Unsubscribe Message
{
"event": "message",
"data": {
"operation": "unsubscribe",
"options": {
"currency": "BTCUSD",
"symbol_set": "global"
}
}
}
Example Response
{
"event": "message",
"data":{
"local": {
"BTCUSD": {...data},
"ETHEUR": {...data},
...
},
"global":{
"BTCGBP": {...data},
"BCHCAD": {...data},
...
}
}
}
Single Exchange
URL
wss://apiv2.bitcoinaverage.com/websocket/exchanges
This channel returns data for one exchange.
Every time you send a new subscription message, the response data switches to the latest exchange. You will always receive data only for the exchange in your last subscribe message.
The unsubscribe message will automatically close the websocket connection
Example Subscribe Message
{
"event": "message",
"data": {
"operation": "subscribe",
"options": {
"exchange": "bitstamp",
}
}
}
Example Unsubscribe Message
{
"event": "message",
"data": {
"operation": "unsubscribe",
"options": {
"exchange": "bitstamp",
}
}
}
Example Response
{
"event": "message",
"data": {
"name": "bitstamp",
"display_name": "Bitstamp",
"url": "https://bitstamp.net/",
"timestamp": 1504089517,
"data_source": "api",
"symbols": {
"BTCUSD": {
"last": 4521.00000000,
"volume": 13804.66498165,
"ask": 4520.99000000,
"bid": 4516.00000000,
"high": 4649.78000000,
"low": 4352.00000000,
"open": 4578.82000000,
"vwap": 4552.56000000
},
"BTCEUR": {
"last": 3791.68000000,
"volume": 1828.26480131,
"ask": 3791.50000000,
"bid": 3785.66000000,
"high": 3845.00000000,
"low": 3586.38000000,
"open": 3818.06000000,
"vwap": 3766.39000000
},
"XRPUSD": {
"last": 0.22000000,
"volume": 13810294.23579809,
"ask": 0.22000000,
"bid": 0.21971000,
"high": 0.22600000,
"low": 0.21500000,
"open": 0.21994000,
"vwap": 0.22074000
},
"XRPEUR": {
"last": 0.18489000,
"volume": 5471715.21778042,
"ask": 0.18544000,
"bid": 0.18405000,
"high": 0.18831000,
"low": 0.17761000,
"open": 0.18320000,
"vwap": 0.18401000
}
},
"success": true, "time": "2017-08-30 10:38:49"
}
}
Multiple Exchanges
URL
wss://apiv2.bitcoinaverage.com/websocket/multiple/exchanges
This channel returns data for multiple exchanges.
Every time you send a new subscription message, the requested exchange is added to the response.
The unsubscribe message does not close the websocket connection here but only removes the unsubscribed exchange from the response.
Example Subscribe Message
{
"event": "message",
"data": {
"operation": "subscribe",
"options": {
"exchange": "bitstamp",
}
}
}
Example Unsubscribe Message
{
"event": "message",
"data": {
"operation": "unsubscribe",
"options": {
"exchange": "bitstamp",
}
}
}
Example Response
{
“event": "message",
“data": {
"success":true,
"time”: "2017-08-30 10:46:10",
"bitstamp": {...data},
"bitfinex": {...data},
...
}
}
}
NEW Websocket API V2
Overview
Improved version of our Websocket API that pushes realtime updates as soon as they happen instead on a set interval of seconds, depending on your plan.
This allows for faster updates with less bandwidth because we push updates of only the prices that have changed.
Root URL: wss://apiv2.bitcoinaverage.com/websocket/v2
Client Limits
Our NEW Websocket API V2 is available to Enterprise users only.
Data Frequency
Updates are pushed in real time, so they depend on the activity of the markets. For activelly traded cryptocurrencies like Bitcoin and Ethereum this could be less than a second, but for more obscure cryptocurrencies it could be minutes appart.
Authentication
The procedure for authenticating these websocket connections is the same as in version 1 except the urls are changed.
Step 1.
- Send a GET request, signed with your public_key and secret_key to
https://apiv2.bitcoinaverage.com/websocket/v2/get_ticket
- You will receive the ticker in the response. e.g:
{"ticket": "ASDFXZCVASDF2341234"}
- The method to sign the above request (for getting ticket) is explained in the general Authentication Section
Step 2.
Connect to the channels using their respective urls including public_key and ticket parameters. An example for subscribing to the ticker channel would be:
wss://apiv2.bitcoinaverage.com/websocket/v2/ticker?ticket=<THE RECEIVED TICKET>&public_key=<YOUR PUBLIC KEY>
Notes.
- If either of the parameters, public_key or ticket, are wrong, then the connection will be closed immediately by our server.
- The ticket can only be used once.
Channels
After authentication is complete the websocket connection is established, you may then send your subscription message to the channel.
There are two channels, ticker and exchanges, that can be used to connect to one or more indices or exchanges respectively.
Ticker
URL
wss://apiv2.bitcoinaverage.com/websocket/v2/ticker
This channel returns ticker data for multiple symbols grouped in symbol sets. The symbols sets are local, global, crypto and tokens. Every time you send a new subscription message, the new symbols are added to the response in their symbol set. The unsubscribe message does not close the connect but removes symbols from the response.
Example Subscribe Message
{
"event": "message",
"data": {
"operation": "subscribe",
"options": {
"currency_list": ["BTCUSD", "BTCGBP", "ETHUSD"],
"symbol_set": "global"
}
}
}
Example Unsubscribe Message
{
"event": "message",
"data": {
"operation": "unsubscribe",
"options": {
"currency_list": ["BTCUSD"],
"symbol_set": "global"
}
}
}
Example Response
{
"event": "message",
"data":{
"local": {
"BTCUSD": {...data},
"ETHEUR": {...data},
...
},
"global":{
"BTCGBP": {...data},
"BCHCAD": {...data},
...
}
}
}
Exchanges Price Data
URL
wss://apiv2.bitcoinaverage.com/websocket/v2/exchanges
This channel returns data for multiple exchanges. Every time you send a new subscription message, the requested exchanges are added to the response.
The unsubscribe message does not close the websocket connection but only removes the unsubscribed exchanges from the response.
Example Subscribe Message
{
"event": "message",
"data": {
"operation": "subscribe",
"options": {
"exchange_list": ["bitstamp", "bitfinex"],
}
}
}
Example Unsubscribe Message
{
"event": "message",
"data": {
"operation": "unsubscribe",
"options": {
"exchange_list": ["bitstamp"],
}
}
}
Example Response
{
“event": "message",
“data": {
"bitstamp": {...data},
"bitfinex": {...data},
...
}
}
Exchanges Orderbook Data
URL
wss://apiv2.bitcoinaverage.com/websocket/v2/orderbooks
This channel returns orderbook data from single exchange but for more symbols.
Example Subscribe Message
{
"event": "message",
"data": {
"operation": "subscribe",
"symbols": ["BTCUSD", "BTCEUR"],
"exchange": "bitfinex"
}
}
Example Unsubscribe Message
{
"event": "message",
"data": {
"operation": "unsubscribe",
"symbols": ["BTCUSD", "BTCEUR"],
"exchange": "bitfinex",
}
}
The first response this channel provides is a snapshot of the current state of the orderbook.
Snapshot Response
{
“event": "message",
“data": {
bids: [sorted array of buy orders (sorted descending)],
asks: [sorted array of sell orders (sorted ascending)],
symbol: "BTCUSD",
type: "snapshot"
}
}
Order format
{
price: 8100,
amount: 1.9384
}
After the snapshot is sent, the channel will continue sending update events that represent the changes in the orderbook.
Update Response
{
symbol: "BTCUSD",
updates: [array of updated orders],
type: "update
}
Update order format
{
side: "bids",
price: 8100,
amount: 1,
}
Every updated order in the updates field has the following format. The side value can be bids or asks representing the array where this order is located. The amount is greater or equal to 0. If it is 0, then the order has been completed and is no longer part of the orderbook. If it is greater than 0 then this is the new amount for the given price and needs to be updated in the orderbook.
Keeping an up-to-date orderbook
Keeping an up-to-date orderbook
const ba = require('bitcoinaverage');
var publicKey = 'yourPublicKey';
var secretKey = 'yourSecretKey';
var wsClient = ba.websocketClient(publicKey, secretKey);
var symbols = ['BTCUSD', 'ETHUSD'];
var exchange = 'bitfinex';
var ORDERBOOKS = {
BTCUSD: {},
ETHUSD: {}
};
var symbol = '';
wsClient.connectToOrderbookWebsocket(exchange, symbols, function(response){
symbol = respnose.data.symbol;
if(response.data.type === "snapshot"){
ORDERBOOKS[symbol].asks = response.data.asks;
ORDERBOOKS[symbol].bids = response.data.bids;
}else{
for (var i = 0; i < response.data.updates.length; i++){
var item = response.data.updates[i];
if(item.amount === 0){
delete(ORDERBOOKS[symbol][item.side][item.price]);
}else{
ORDERBOOKS[symbol][item.side][item.price] = item;
}
}
}
}, function(err){
console.log(err);
});
The process of keeping an orderbook is quite straightforward:
- Connect to the orderbook channel (our npm package makes this easier).
- If the response is of type snapshot then store the arrays of bids(buy orders) and asks(sell orders).
- Otherwise the respnose is of type update. Iterate the update array from the response and update the orderbook.
- If the amount is 0 then remove that price level from the orderbook.
- If the amount is greater than 0 then update the price level.
In this example we're using our npm package that can be installed with:
npm install bitcoinaverage
Errors
The BitcoinAverage API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Incorrectly formatted request |
401 | Unauthorized -- An issue with Authentication |
403 | Forbidden -- Higher level API Keys required |
404 | Not Found -- Incorrect endpoint URL |
429 | Too Many Requests -- You're requesting too often, upgrade your API Keys. |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline. Please try again later. |