Bitwise API v1.0.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
The Bitwise API is used to fetch data about the Bitwise indexes. An API Key is needed for authentication. If you would like to access the API, and do not have a key, email [email protected] to request one.
Authentication
Authentication is required for all endpoints, either as an HTTP header Authorization
.
Please see examples further down for samples of how to authenticate.
Errors
If an API request results in an error, data about the encountered error will be returned. Each error contains an id and a message.
Example 40X Response
{
'id': "validation_error",
'message': "Part of your request was invalid.",
'errors': [
'field': "start",
'message': "start was not valid ISO8601"
]
}
Example 50X Response
{
'id': "internal_server_error",
'message': "The server encountered an unexpected condition."
}
ID | CODE | MESSAGE |
---|---|---|
validation_error | 400 | Part of your request was invalid |
unauthorized_request | 401 | Authentication credentials were missing or incorrect. |
access_not_permitted | 403 | The request is understood, but it has been refused or access is not allowed. |
not_found | 404 | The URI requested is invalid or the resource requested does not exists. |
rate_limited | 429 | The request cannot be served due to the application’s rate limit having been exhausted for the resource. |
internal_server_error | 500 | The server encountered an unexpected condition. |
service_unavailable | 503 | The server is up, but overloaded with requests. Try again later. |
Indexes
The index endpoints return data about Bitwise indexes. To begin, make a request to the /indexes endpoint to learn about the supported indexes and their constitutents. The names of the indexes that are returned are used for ticker and historical data requests.
Get Index Descriptions
Code samples
export YOUR_API_KEY="YOUR_API_KEY_HERE"
curl -X GET "https://api.bitwiseinvestments.com/api/v1/indexes"\
-H "Authorization: $YOUR_API_KEY" \
-H "Accept: application/json"
var YOUR_API_KEY = "SUPER_SECRET_KEY";
var headers = {
'Authorization': YOUR_API_KEY,
'Accept': 'application/json'
};
$.ajax({
url: 'https://api.bitwiseinvestments.com/api/v1/indexes',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
YOUR_API_KEY = 'SUPER_SECRET_KEY'
import requests
headers = {
'Authorization': YOUR_API_KEY,
'Accept': 'application/json'
}
r = requests.get('https://api.bitwiseinvestments.com/api/v1/indexes', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization': YOUR_API_KEY,
'Accept' => 'application/json'
}
result = RestClient.get(
'https://api.bitwiseinvestments.com/api/v1/indexes',
headers: headers
)
p JSON.parse(result)
GET /indexes
A list of indexes, with their inception dates and constituents.
200 Response
[
{
"name": "BITWISE10",
"inception": "2018-07-31T20:00:00.000Z",
"constituents": [
"BTC",
"ETH",
"XRP",
"EOS",
"BCH",
"XLM",
"LTC",
"ZEC",
"DASH",
"XMR"
]
}
]
Get Index Ticker
Code samples
export YOUR_API_KEY="YOUR_API_KEY_HERE"
curl -X GET "https://api.bitwiseinvestments.com/api/v1/indexes/{name}/ticker"\
-H "Authorization: $YOUR_API_KEY" \
-H "Accept: application/json"
var YOUR_API_KEY = "SUPER_SECRET_KEY";
var headers = {
'Authorization': YOUR_API_KEY,
'Accept': 'application/json'
};
$.ajax({
url: 'https://api.bitwiseinvestments.com/api/v1/indexes/{name}/ticker',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
YOUR_API_KEY = 'SUPER_SECRET_KEY'
import requests
headers = {
'Authorization': YOUR_API_KEY,
'Accept': 'application/json'
}
r = requests.get('https://api.bitwiseinvestments.com/api/v1/indexes/{name}/ticker', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization': YOUR_API_KEY,
'Accept' => 'application/json'
}
result = RestClient.get(
'https://api.bitwiseinvestments.com/api/v1/indexes/{name}/ticker',
headers: headers
)
p JSON.parse(result)
GET /indexes/{name}/ticker
Returns the most recent value, performance, and constituent weights for the specified index.
Parameters
-
name required string, provided in path
The name of the index that you want to fetch ticker data for. For example, "BITWISE10". Valid indexes can be fetched from the /indexes endpoint.
200 Response
{
"time": "2018-09-14T20:41:08.000Z",
"value": 7956.95117349885,
"constituent_weights": [
{
"symbol": "BTC",
"weight": 0.662976540307136,
"price": 6517.928338950098
},
{
"symbol": "ETH",
"weight": 0.119028894194217,
"price": 217.45347980583
},
{
"symbol": "XRP",
"weight": 0.066048622709267,
"price": 0.278964408498707
},
{
"symbol": "BCH",
"weight": 0.0465480255694524,
"price": 455.83322707699
},
{
"symbol": "XLM",
"weight": 0.0211487208643347,
"price": 0.0211487208643347
},
{
"symbol": "LTC",
"weight": 0.0224269964245699,
"price": 58.0847114127314
},
{
"symbol": "ZEC",
"weight": 0.0090726887222396,
"price": 121.061306404668
},
{
"symbol": "DASH",
"weight": 0.0122829796423117,
"price": 194.993638691812
},
{
"symbol": "XMR",
"weight": 0.0112798210657469,
"price": 114.840347001058
},
{
"symbol": "EOS",
"weight": 0.029186710500725,
"price": 5.33871195196655
}
]
}
Get Index Values
Code samples
export YOUR_API_KEY="YOUR_API_KEY_HERE"
curl -X GET "https://api.bitwiseinvestments.com/api/v1/indexes/{name}/history?exclude_backtests=true&start=2017-01-01T00:00:00.000Z&end=2018-08-01T00:00:00.000Z"\
-H "Authorization: $YOUR_API_KEY" \
-H "Accept: application/json"
var YOUR_API_KEY = "SUPER_SECRET_KEY";
var headers = {
'Authorization': YOUR_API_KEY,
'Accept': 'application/json'
};
$.ajax({
url: 'https://api.bitwiseinvestments.com/api/v1/indexes/{name}/history?exclude_backtests=true&start=2017-01-01T00:00:00.000Z&end=2018-08-01T00:00:00.000Z',
method: 'get',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
YOUR_API_KEY = 'SUPER_SECRET_KEY'
import requests
headers = {
'Authorization': YOUR_API_KEY,
'Accept': 'application/json'
}
r = requests.get('https://api.bitwiseinvestments.com/api/v1/indexes/{name}/history?exclude_backtests=true&start=2017-01-01T00:00:00.000Z&end=2018-08-01T00:00:00.000Z', params={
}, headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Authorization': YOUR_API_KEY,
'Accept' => 'application/json'
}
result = RestClient.get(
'https://api.bitwiseinvestments.com/api/v1/indexes/{name}/history?exclude_backtests=true&start=2017-01-01T00:00:00.000Z&end=2018-08-01T00:00:00.000Z',
headers: headers
)
p JSON.parse(result)
GET /indexes/{name}/history
Returns a list of historical daily index values for an index. Each element in the response array contains a ISO8601 date of the index value, followed by the index value for that date. By default, all index values are included for an index, including backtested index values starting at "2017-01-01T00:00:00.000Z". Parameters exist to exclude backtested data, as well as filtering data that is before or after a given date.
Parameters
-
name required string, provided in path
The name of the index that you want to fetch historical data for
-
exclude_backtests optional boolean, provided in query
Each Bitwise index is backtested to provide historical performance. By default, this data is included (and the parameter is set to false). Backested data can be excluded from the response by setting this parameter to true.
-
start optional string(date-time), provided in query
A start can be provided to only include index values after or equal to the given ISO8601 datetime. By default, index values are included since "2017-01-01T00:00:00.000Z". To exclude backtested data, see the exclude_backtests parameter.
-
end optional string(date-time), provided in query
An end can be provided to only include index values before or equal to the given ISO8601 datetime. If no end is provided, index values are included up to the most recent index value.
200 Response
[
[
"2017-01-01T00:00:00.000Z",
964
],
"...",
[
"2018-08-01T00:00:00.000Z",
10000
]
]