NAV Navbar
Logo
curl

Introduction

Welcome to the BitcoinAverage API!

This API can be used to gather real-time and historical price data for the following crypto-currencies:

Bitcoin (BTC), Bitcoin Cash (BCH), Litecoin (LTC), Ethereum (ETH), Dash (DASH), Ripple (XRP), Monero (XMR) and many more.

The full list of supported currencies can be found at this endpoint: Supported 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:

If an ednpoint 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.

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:

Note: These values are dot (.) separated URL safe strings

Step 1 - Create a payload consisting of “timestamp.public_key”:

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:

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.

Constants

Endpoints to return active symbols, exchange rates and time for use in other endpoints where required.

Currrency Symbols

Example Request

$ curl https://apiv2.bitcoinaverage.com/constants/symbols

Example Response

{
    "local": {
        "symbols": [
            "BTCAUD",
            "BTCBRL",
            "BTCCAD",
        ]
    },
    "global": {
        "symbols": [
            "BTCAED",
            "BTCAFN",
            "BTCALL",
        ]
    },
    "success": true
}

Returns a list of all symbols for global, local and crypto markets.

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/constants/symbols

PERMISSIONS

Currency Symbols (Per Market)

Example Request

$ curl https://apiv2.bitcoinaverage.com/constants/symbols/global

Example Response

{
    "symbols": [
        "BTCAUD",
        "BTCBRL",
        "BTCCAD",
    ],
    "success": true
}

Returns a list of all symbols for both global and local markets

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/constants/symbols/{market}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local

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

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or 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

Price Indices

We provide a single global index, and multiple local or currency indices

All endpoints in this collection require the market parameter to be provided

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"
  }
}

If no query parameters are sent, then returns ticker data for every supported symbol. If crypto(s) and/or fiat(s) are sent as parameters, then only the ticker for those values is sent

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/indices/{market}/ticker/all?crypto={crypto}&fiat={fiat,fiat}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
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/{market}/ticker/{symbol}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
symbol True Full currency pair symbol. Example: BTCUSD

Short Ticker

Example Request


$ curl https://apiv2.bitcoinaverage.com/indices/global/ticker/short?crypto=BTC&fiat=USD,EUR

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 basic ticker denoting last and daily average price for the specified crypto/fiat values

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/indices/{market}/ticker/short?crypto={crypto}&fiat={fiat,fiat}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
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 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 market and symbol.

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/indices/{market}/ticker/{symbol}/changes

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
crypto False Filters repsonse by supplied crypto currency. Example: BTC
fiat False Filters repsonse by supplied fiat currency. Example: USD. Accepts comma seperated values

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 market and symbol.

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/indices/ticker/custom/{inex}/{symbol}?exchanges={exchange_list}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
exchange_list True

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

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/indices/{market}/history/{symbol}?period={period}&format={format}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
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/{market}/history/{symbol}?since={timestamp}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
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)

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/indices/{market}/history/{symbol}?at{timestamp}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
symbol True Full currency pair symbol. Example: BTCUSD
since True Timestamp in unix format. Example: 1402476700

Exchanges

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

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 or fiat currency

HTTP REQUEST

GET https://apiv2.bitcoinaverage.com/exchanges/ticker/all?crypto={crypto}&fiat={fiat}

PERMISSIONS

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. Accepts 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

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

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

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

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

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

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/{market}?from={source_cur}&to={target_cur}&amount={amount}

PERMISSIONS

URL PARAMETERS

Parameter Required Description
market True Market type. Options: global or local
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

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/

Authentication

The procedure for authenticating websocket connections is the following:

Step 1.

Step 2.

Notes.

Channels

After authentication is complete the websocket connection is established, you may then subscribe to the required channel.

Available channels are listed below, they currency include single ticker, multiple ticker and 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",
            "market": "global"
        }
    }
}

Example Unsubscribe Message

{
    "event": "message",
    "data": {
        "operation": "subscribe",
        "options": {
            "currency": "BTCUSD",
            "market": "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 or global. 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 here but only removes the unsubscribed currency from the response.

Example Subscribe Message

{
    "event": "message",
    "data": {
        "operation": "subscribe",
        "options": {
            "currency": "BTCUSD",
            "market": "global"
        }
    }
}

Example Unsubscribe Message

{
    "event": "message",
    "data": {
        "operation": "unsubscribe",
        "options": {
            "currency": "BTCUSD",
            "market": "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 Exchange

URL wss://apiv2.bitcoinaverage.com/websocket/multiple/exchanges

This channel returns data for multiple exchanges. They are grouped by their market, local or global. 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 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},
        ...
    }
}

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.