Brave New Coin (BNC) has been providing data for the cryptographic asset marketplace since April 2014. BNC makes this data available through its API's. The V3 platform is the latest iteration, currently presenting market data but expanding to include indices, taxonomy and newsfeeds through a single interface. Access is either via REST or Websockets. In both cases authentication is by OAuth token. Contact support@bravenewcoin.com to obtain the API credentials.
Market data includes the ticker data from over 200 exchanges representing the markets for more than 1500 crypto assets.
BNC aggregates market prices from across exchanges to provide reference rates - the market weighted average (MWA) - for the 6000+ traded market pairs being tracked. These international market reference rates provide the basis to derive a single USD rate, the global weighted average (GWA), for each asset.
Market data is available both as intraday values or as daily summaries (EOD) based on a midnight UTC close providing the open, high, low and close for the 24hr period. Intraday data is limited to a 200 day trailing window. Historic datasets covering the full history back to April 2014 are available on request by contacting support@bravenewcoin.com
A typical interaction with an API endpoint might include:
The following sections provide further details about the general features of the API. You can jump to the Quickstart section if preferred or to the full details of the REST API or Websocket
BNC uses OAuth2 flows for security. When on-boarding to the BNC API platform for the first time, clients are provided with API credentials that allow them to be authenticated and authorised to make API calls. With these credentials a user may obtain an access token which must be submitted as a Header with each API request. The token will contain the information to permit the client to make the call and the scopes that define which endpoints will be accessible to them depending on their contract.
Our websocket endpoint requires the bearer token to be sent as access_token parameter in the connection url. The token will have to be used within 86400 seconds (24 hours) of being issued.
wss://ws.bravenewcoin.com?access_token=<token>
Our REST endpoints require a bearer token, valid for 24 hours, to be sent in the Authorization header.
Authorization: Bearer <token>
Security Scheme Type | OAuth2 |
---|---|
clientCredentials OAuth Flow | Token URL: https://api.bravenewcoin.com/v3/oauth/token Scopes:
|
This is the OAuth 2.0 grant that server processes utilize in order to access an API. Use this endpoint to directly request an Access Token by using the Client Credentials (a Client ID and a Client Secret).
The BNC authentication endpoint is https://api.bravenewcoin.com/v3/oauth/token
grant_type | string Denotes the flow you are using. For Client Credentials use | ||||||
client_id | string Your application's Client ID. | ||||||
client_secret | string Your application's Client Secret. | ||||||
audience | string The unique identifier of the target API you want to access.
|
access_token | string The access token issued. |
scope | string The scope issued. |
expires_in | integer The number of seconds in which the access token will expire. |
token_type | string The type of token type issued. |
{- "grant_type": "client_credentials",
- "client_id": "string",
- "client_secret": "string",
}
{- "access_token": "string",
- "scope": "string",
- "expires_in": 0,
- "token_type": "string"
}
BNC utilises UUIDs to identify entities such as assets, markets and exchanges. These UUIDs often provide the values for API endpoint parameters.
The following resources are our informational API endpoints that can be queried to provide UUIDs:
All top-level API resources have support for bulk fetches via "list" API methods. For instance, you can list assets, list exchange tickers, and list GWA / MWA. These list API methods share a common structure, taking at least these three parameters: size
, timestamp
or startAfter
.
APIs which support query parameters timestamp and startAfter will provide paginated results when these query parameters are provided.
Brave New Coin API's utilise cursor-based pagination using the startAfter
parameter. The parameter should be an existing object ID and returns resources in reverse chronological order. The startAfter
parameter returns resources listed after the named resource. For APIs which take both a startAfter
and timestamp
parameters, the timestamp
is ignored if startAfter
is provided.
Arguments | Description | |
---|---|---|
size | Optional, default is 10 | The number of resources to be returned, between 1 and 2000. |
startAfter | A cursor for use in pagination. startAfter is an resource ID that defines your place in the list. | |
timestamp | The timestamp to start searching from going backwards in time. |
List Response Format | Description |
---|---|
content | An array containing the actual response elements, paginated by any request parameters. |
nextId | The value to be provided in the startAfter to get the next page. |
Brave New Coin APIs will return datetime values in ISO8601 format. Datetime values are always returned in UTC time (as indicated by the Z
at the end of the datetime value).
Currently Brave New Coin APIs only accept datetimes in query parameters and request bodies which are in UTC.
The overall service status for Brave New Coin's platform including the APIs is visible here.
If there any issues or problems arising from using the API's then please contact support@bravenewcoin.com and one of the team will reply within at most one working day if not immediately available.
When we make backwards-incompatible changes to the API, we will release a new version. The current version is v3.
The following changes are considered backwards-compatible:
The Global Weighted Average for an asset, say Litecoin (LTC), can be obtained by passing the indexType query parameter as GWA and indexId as the Asset Id(UUID) for LTC.
You can find detailed explanation under:
In order to get the Asset Id(UUID) for LTC, you need to query the Asset API:
curl https://api.bravenewcoin.com/v3/asset?symbol=LTC
To request LTC index tickers with a timestamp before 17th March 2020
.
curl https://api.bravenewcoin.com/v3/index-ticker?timestamp=2020-03-17T00:00:00.000Z&indexType=GWA&indexId=220cbd0c-e466-4a75-9833-755307f872f3 -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
curl https://api.bravenewcoin.com/v3/ohlcv?timestamp=2019-09-25T00:00:00.000Z&indexType=GWA&indexId={LTC_Asset_Id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
The Market weighted average for a market, say BTC/USD (base/quote) can be obtained by passing the indexType query parameter as MWA and indexId as the Market Id(UUID) for BTC/USD.
You can find detailed explanation under:
In order to get the Market Id(UUID) for BTC/USD, you need to query the Market API:
curl https://api.bravenewcoin.com/v3/market?baseAssetId={BTC_Asset_Id}"eAssetId={USD_Asset_Id}
The respective asset Ids can be obtained by querying the Asset API as shown in the GWA section.
curl https://api.bravenewcoin.com/v3/index-ticker?timestamp=2019-09-25T00:00:00.000Z&indexType=MWA&indexId={BTC_USD_Market_Id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
curl https://api.bravenewcoin.com/v3/ohlcv?timestamp=2019-09-25T00:00:00.000Z&indexType=MWA&indexId={BTC_USD_Market_Id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
Brave New Coin REST API exposes the following endpoints:
There are currently no rate limits on API requests, but pagination is enforced on API responses to limit the payload of any one call. See Pagination
A sample Java API client project using the BNC REST API is available on Github :
Please feel free to create issues and/or pull requests on Github if you would like to contribute to these projects.
You can download the OpenAPI specification and generate your own clients if the language which you are working with is not found in the list. The download link can be found at the top of this page; and is available on github
Brave New Coin uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx
range indicate success. Codes in the 4xx
range indicate an error that failed given the information provided (e.g. A required parameter was missing). Codes in the 5xx
range indicate an error with Brave New Coin's servers.
Some 4xx
errors that could be handled programmatically include an error code that briefly explains the error reported.
{
"status": "BAD_REQUEST",
"timestamp": "2018-08-14T21:55:46.055Z",
"message": "validation error",
"errors": [
{
"object": "Asset",
"field": "status",
"rejectedValue": "ERROR",
"message": "Invalid value provided for status"
}
]
}
HTTP Code | Description |
---|---|
200 - OK | Everything worked as expected |
400 - Bad Request | The request was unacceptable, often due to missing a required parameter. |
401 - Unauthorized | No valid OAuth2 token provided |
403 - Forbidden | Not authorized to access this resource (please contact sales about adding access to your profile). |
404 - Not Found | The requested resource doesn't exist |
409 - Conflict | The request conflicts with another request (perhaps due the resource was updated) |
429 - Too Many Requests | Too many requests hit the API too quickly. We recommend an expontential backoff of your requests. |
500, 502, 503, 504 - Server Errors | Something went wrong on Brave New Coin's end. (These will be rare). |
Our API libraries raise exceptions for many reasons, such as invalid parameters, authentication errors, and network unavailability. We recommend writing code that gracefully handles all possible API exceptions.
List all assets or provide a query parameter to search.
type | string Enum: "FIAT" "CRYPTO" Only return assets of a particular type. |
symbol | string Only return assets which have a particular ticker symbol. |
status | string Enum: "ACTIVE" "INACTIVE" Only return assets which have a particular status. |
Array of objects (Asset) |
curl https://api.bravenewcoin.com/v3/asset/ -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "string",
- "symbol": "string",
- "status": "ACTIVE",
- "type": "FIAT",
- "url": "string",
- "contractAddress": "string"
}
]
}
Retrieves the details of an asset that has previously been created. Supply the unique identifier of the asset.
id required | string <uuid> The unique resource identifier |
id | string <uuid> Unique identifier for the resource. |
name | string The friendly name of the asset. |
symbol | string The ticker symbol of the asset. |
status | string Enum: "ACTIVE" "INACTIVE" The status of the asset. |
type | string Enum: "FIAT" "CRYPTO" Indicator for the type of the asset. |
url | string The url of where information about the asset can be found. |
contractAddress | string (Optional) The contract address on primary blockchain of issuance if the asset is a token. |
curl https://api.bravenewcoin.com/v3/asset/f1ff77b6-3ab4-4719-9ded-2fc7e71cff1f -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "string",
- "symbol": "string",
- "status": "ACTIVE",
- "type": "FIAT",
- "url": "string",
- "contractAddress": "string"
}
List all markets or provide a query parameter to search.
baseAssetId | string <uuid> Only return markets which contain the asset id on the base side of the market. |
quoteAssetId | string <uuid> Only return markets which contain the asset id on the quote side of the market. |
Array of objects (Market) |
curl https://api.bravenewcoin.com/v3/market/ -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "baseAssetId": "1271cdfd-c286-4e6c-bca5-dce2da2fbc43",
- "quoteAssetId": "aa90b6f3-20ad-4613-b096-27339b67231a"
}
]
}
Retrieves the details of a market that has previously been created. Supply the unique identifier of the market.
id required | string <uuid> The unique resource identifier |
id | string <uuid> Unique identifier for the resource. |
baseAssetId | string <uuid> The base asset id which makes up the market |
quoteAssetId | string <uuid> The quote asset id which makes up the market |
curl https://api.bravenewcoin.com/v3/market/6ea0d2ef-6dd0-4adb-ad32-f7f3db58ccbe -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "baseAssetId": "1271cdfd-c286-4e6c-bca5-dce2da2fbc43",
- "quoteAssetId": "aa90b6f3-20ad-4613-b096-27339b67231a"
}
List all exchanges or provide a query parameter to search.
status | string Enum: "ACTIVE" "INACTIVE" Only return exchanges which have a particular status. |
name | string Return exchange with specified name. |
Array of objects (Exchange) |
curl https://api.bravenewcoin.com/v3/exchange/ -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "string",
- "url": "string",
- "status": "ACTIVE",
- "markets": [
- {
- "marketId": "4e934bc8-bf09-4970-9252-7ebc32247830",
- "marketStatus": "ACTIVE",
- "qualified": "YES"
}
], - "symbols": [
- {
- "assetId": "9179b887-04ef-4ce5-ab3a-b5bbd39ea3c8",
- "symbol": "string"
}
]
}
]
}
Retrieves the details of an exchange that has previously been created. Supply the unique identifier of the exchange.
id required | string <uuid> The unique resource identifier |
id | string <uuid> Unique identifier for the resource. |
name | string The name of the exchange |
url | string The URL of the exchange |
status | string Enum: "ACTIVE" "INACTIVE" "MAINTENANCE" The status of the exchange |
Array of objects The markets available on the exchange | |
Array of objects Mapping for asset symbols identifying an exchange's markets that differ from generally accepted usage |
curl https://api.bravenewcoin.com/v3/exchange/65cf072d-2ffa-48f8-9497-6654234f52e3 -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "name": "string",
- "url": "string",
- "status": "ACTIVE",
- "markets": [
- {
- "marketId": "4e934bc8-bf09-4970-9252-7ebc32247830",
- "marketStatus": "ACTIVE",
- "qualified": "YES"
}
], - "symbols": [
- {
- "assetId": "9179b887-04ef-4ce5-ab3a-b5bbd39ea3c8",
- "symbol": "string"
}
]
}
BNC’s XchangeFeed integrates and normalizes data feeds from multiple exchanges and delivers the data via a single API.
The API allows you to query:
To obtain an Exchange Id or Market Id to use as a parameter for REST or Websocket, you need to query the Exchange or Market API respectively:
The exchange tickers are refreshed every 30 seconds even if there has been no trade in that period. In that case the lastMoved timestamp in the response provides the time the price was last updated at the exchange.
This API provides ticker information by exchange and market.
Using this API by base and quote symbol is not recommended as it may result in an error when duplicate symbols are found. Searching by marketId is recommended and will result in a faster response.
read:exchange-ticker
) exchangeId | string <uuid> Retrieve all ticks for the particular exchange id provided. |
marketId | string <uuid> Retrieve all ticks for the particular market id provided. |
baseSymbol | string Retrieve the ticks for the markets which contain the base symbol. If the base symbol is provided then the quote symbol must be provided. |
quoteSymbol | string Retrieve the ticks for the markets which contain the quote symbol. If the quote symbol is provided, then the base symbol must be provided. |
Array of objects (Tick) | |
nextId | string <uuid> The next id which can be used as startAfter for pagination |
curl https://api.bravenewcoin.com/v3/exchange-ticker/ -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "exchangeId": "40dedb6d-6cdf-4712-ac01-ee2c0e6bc037",
- "marketId": "4e934bc8-bf09-4970-9252-7ebc32247830",
- "last": "string",
- "volume": "string",
- "bid": "string",
- "ask": "string",
- "timestamp": "2019-08-24T14:15:22Z",
- "lastMoved": "2019-08-24T14:15:22Z"
}
], - "nextId": "de98e92a-2a9c-43e0-9588-39d760517db3"
}
This API provides support to get GWA or MWAs. A Type parameter is used to filter the type of index being returned.
Currently the following types of indices are supported -
Index Type | Description |
---|---|
MWA | The Market weighted averages |
GWA | The Global weighted averages |
LX | Liquid Indices |
Each index type will have an index id which identifies the constituent type used to build the index -
Index Type | Index Id | Output |
---|---|---|
MWA | Market Id | The Market Weighted Average for that market |
GWA | Asset Id | The Global Weighted Average for that coin / asset |
LX | 191724d4-7915-491b-8b73-bc293e03a93e | Bitcoin Liquid Index (BLX) |
LX | 6560acf3-1cb7-4fe4-aa19-fbd90c7b56ee | Ethereum Liquid Index (ELX) |
LX | ce36445a-2a33-4a0f-8b5b-e56175f8db60 | Ripple Liquid Index (XRPLX) |
Clients are supposed to use this ID to call the other rest API's to get more information about the constituents used while building the index.
read:index-ticker
read:LX
) timestamp | string <date-time> Retrieve all the indices up to the timestamp provided. If no timestamp is provided, then the most recent calculated value will be provided. |
indexType | string Enum: "MWA" "GWA" "LX" Retrieve the index by the type. |
indexId | string <uuid> |
startAfter | string <uuid> Retrieve all market weighted averages starting after this particular id. |
size | integer [ 1 .. 2000 ] Default: 10 The maximum size to return in the result set. This parameter is ignored if no timestamp is provided. |
Array of objects (IndexTicker) | |
nextId | string <uuid> The next id which can be used as startAfter for pagination |
curl https://api.bravenewcoin.com/v3/index-ticker?indexId={index_id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "indexId": "05cc11c1-58f9-44ef-9820-239dea654e62",
- "indexType": "MWA",
- "price": "string",
- "timestamp": "2019-08-24T14:15:22Z",
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "volume": "string",
- "tickVolume": "string"
}
], - "nextId": "de98e92a-2a9c-43e0-9588-39d760517db3"
}
Get end of day open, high, low, close and volumes (OHLCV) for market weighted averages (MWA) or global weighted averages (GWA). The 24hr period for end of day is 00:00:00 UTC.
This API provides the open, high, low, close and volume using the index type provided.
Currently the following types of indices are supported -
Index Type | Description |
---|---|
MWA | The Market weighted averages |
GWA | The Global weighted averages |
LX | Liquid Indices |
Each index type will have an index id which identifies the constituent type used to build the index -
Index Type | Index Id | Output |
---|---|---|
MWA | Market Id | OHLCV for that market |
GWA | Asset Id | OHLCV for that coin / asset |
LX | 191724d4-7915-491b-8b73-bc293e03a93e | OHLCV for Bitcoin Liquid Index (BLX) |
LX | 6560acf3-1cb7-4fe4-aa19-fbd90c7b56ee | OHLCV for Ethereum Liquid Index (ELX) |
LX | ce36445a-2a33-4a0f-8b5b-e56175f8db60 | OHLCV for Ripple Liquid Index (XRPLX) |
read:ohlcv
read:LX
) timestamp | string <date-time> Retrieve all MWA/GWA OHLCV up to the timestamp provided. | ||||||||||||||||||
indexType | string Enum: "MWA" "GWA" "LX" Retrieve the OHLCV end of day by the index type. | ||||||||||||||||||
indexId | string <uuid> Retrieve all the OHLCV values by the particular index id. The index id will differ based on the index type.
| ||||||||||||||||||
interval | string Default: "1d" Value: "1d" The interval period. | ||||||||||||||||||
startAfter | string <uuid> Retrieve OHLCV for the indexId or indexType required, starting after this particular id. | ||||||||||||||||||
size | integer [ 1 .. 2000 ] Default: 10 The maximum size to return in the result set. This parameter is ignored if no timestamp is provided. |
Array of objects (OpenHighLowCloseVolume) | |
nextId | string <uuid> The next id which can be used as startAfter for pagination |
curl https://api.bravenewcoin.com/v3/ohlcv?indexId={index_id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "indexId": "05cc11c1-58f9-44ef-9820-239dea654e62",
- "indexType": "MWA",
- "open": "string",
- "close": "string",
- "high": "string",
- "low": "string",
- "volume": "string",
- "volumeUsd": "string",
- "vwap": "string",
- "twap": "string",
- "startTimestamp": "2019-08-24T14:15:22Z",
- "endTimestamp": "2019-08-24T14:15:22Z"
}
], - "nextId": "de98e92a-2a9c-43e0-9588-39d760517db3"
}
The Market Cap is calculated based on the free float (or circulating) supply figures and the GWA index price. The Total Market Cap is calculated based on the total supply and the GWA index price.
If the percentChange parameter is set to true this API will also return movement in percentage of these values over a 24h, 7d or 30d period.
This API will return a list of assets ranked by their market capitalization.
read:market-cap
) assetId | string <uuid> The asset id to search |
percentChange | boolean Default: false Return the percent change in the response. |
Array of objects (MarketCap) |
curl https://api.bravenewcoin.com/v3/market-cap -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "assetId": "9179b887-04ef-4ce5-ab3a-b5bbd39ea3c8",
- "timestamp": "2019-08-24T14:15:22Z",
- "marketCapRank": "string",
- "volumeRank": "string",
- "price": "string",
- "volume": "string",
- "totalSupply": "string",
- "freeFloatSupply": "string",
- "marketCap": "string",
- "totalMarketCap": "string",
- "marketCapPercentChange": {
- "change24h": "string",
- "change7d": "string",
- "change30d": "string"
}, - "totalMarketCapPercentChange": {
- "change24h": "string",
- "change7d": "string",
- "change30d": "string"
}, - "volumePercentChange": {
- "change24h": "string",
- "change7d": "string",
- "change30d": "string"
}, - "pricePercentChange": {
- "change24h": "string",
- "change7d": "string",
- "change30d": "string"
}
}
]
}
Retrieve contract specifications and ticker data for crypto Futures, Perpetual Swaps and Options.
The following exchanges are currently supported in our derivatives endpoints.
Name | ExchangeId |
---|---|
Binance | a05e02d1-2789-49a3-aa83-1d3c9a442ea8 |
BitMEX | ba8670a7-e166-4a08-99d7-003219e1a1b0 |
Bybit | 03a530ca-e2b8-43cc-8a53-7478939a13f6 |
Deribit | 46f3c558-453c-41d2-b6d8-c6e57128e206 |
Kraken | fa75a209-f460-4195-bbcc-56eb72286e3d |
LedgerX | 6259cb53-3c1b-44c3-8928-0455a30c9634 |
OKX | 153d4b94-3518-4f79-9ebb-b9123467da95 |
This API provides derivatives contract information e.g. expiration, contract value, settlement currency.
read:derivatives
) derivativeType required | string Enum: "futures" "perpetuals" "options" Identifies the contracts derivative type. |
exchangeId required | string <uuid> The unique exchange resource identifier. See above for supported exchanges. |
marketId | string <uuid> The unique market resource identifier. See /market. |
include | string Default: "ACTIVE" Enum: "ACTIVE" "ALL" "EXPIRED" Identifies the contracts expiration status. |
Array of objects (DerivativeContract) |
curl https://api.bravenewcoin.com/v3/derivatives/contract/{derivative_type}?exchangeId={exchange_id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "exchangeId": "40dedb6d-6cdf-4712-ac01-ee2c0e6bc037",
- "marketId": "4e934bc8-bf09-4970-9252-7ebc32247830",
- "exchangeName": "string",
- "settlementCurrency": "string",
- "contractValue": "string",
- "valueCurrency": "string",
- "optionType": "CALL",
- "optionStrike": "string",
- "listing": "2019-08-24T14:15:22Z",
- "expiration": "2019-08-24T14:15:22Z"
}
]
}
Retrieve the information for a single contract by providing it's unique resource identifier.
read:derivatives
) derivativeType required | string Enum: "futures" "perpetuals" "options" Identifies the contracts derivative type. |
id required | string <uuid> The unique contract resource identifier. |
id | string <uuid> Unique identifier for the resource. Known as |
exchangeId | string <uuid> Unique identifier for the exchange. |
marketId | string <uuid> Unique identifier for the market. |
exchangeName | string The contract name provided by exchange. |
settlementCurrency | string The currency symbol which the contract is settled in. |
contractValue | string The size of the contract in units of the valueCurrency |
valueCurrency | string The currency symbol which the contract is settled in. |
optionType | string Enum: "CALL" "PUT" The options type. Only for derivativeType |
optionStrike | string The options strike price. Only for derivativeType |
listing | string <date-time> The timestamp when the contract was listed. Only for derivativeType |
expiration | string <date-time> The timestamp when the contract expires. Only for derivativeType |
curl https://api.bravenewcoin.com/v3/derivatives/contract/{derivative_type}/{id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "exchangeId": "40dedb6d-6cdf-4712-ac01-ee2c0e6bc037",
- "marketId": "4e934bc8-bf09-4970-9252-7ebc32247830",
- "exchangeName": "string",
- "settlementCurrency": "string",
- "contractValue": "string",
- "valueCurrency": "string",
- "optionType": "CALL",
- "optionStrike": "string",
- "listing": "2019-08-24T14:15:22Z",
- "expiration": "2019-08-24T14:15:22Z"
}
This API provides derivatives tickers e.g. price, volume, open interest, ask, bid etc.
read:derivatives
) derivativeType required | string Enum: "futures" "perpetuals" "options" Identifies the contracts derivative type. |
exchangeId required | string <uuid> The unique exchange resource identifier. See above for supported exchanges. |
marketId | string <uuid> The unique market resource identifier. See /market. |
contractId | string <uuid> The unique contract resource identifier. See /contract. |
Array of objects (DerivativeTicker) |
curl https://api.bravenewcoin.com/v3/derivatives/ticker/{derivative_type}?exchangeId={exchange_id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G
{- "content": [
- {
- "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
- "contractId": "dbf32426-cf38-4818-9c6e-3230d889fa51",
- "exchangeId": "40dedb6d-6cdf-4712-ac01-ee2c0e6bc037",
- "marketId": "4e934bc8-bf09-4970-9252-7ebc32247830",
- "timestamp": "2019-08-24T14:15:22Z",
- "price": "string",
- "volume": "string",
- "volumeUsd": "string",
- "bid": "string",
- "ask": "string",
- "openInterest": "string",
- "openInterestUsd": "string",
- "indexPrice": "string",
- "markPrice": "string",
- "fundingRate": "string"
}
]
}
Brave New Coin Websocket API exposes the LX indices, GWA / MWA indices, trade data (for selected markets) and XchangeFeed (for all the exchanges and markets covered by BNC) via Websockets. Clients need to send a subscribe message to authenticate and start receiving data.
A sample project using the BNC Websocket API is available on Github :
wss://ws.bravenewcoin.com?access_token=<token>
All websocket connections require authentication. For more information see -
Websocket messages have an event
field to identify them
Once the client connection is successful, the server will send back a connection message
{
"event" : "CONNECTED",
"timestamp" : "2018-09-05T01:34:39Z"
}
Clients or server can send a ping request to check if the connection is active. Clients are expected to implement a pong
response.
The server may terminate the connection if the client does not respond to ping
from the server.
Request
{
"event": "PING",
"requestId": 1
}
Response
{
"event": "PONG",
"timestamp": "2018-09-05T01:34:39Z",
"requestId": 1
}
A requestId is an optional field that users may include for their own benefit.
Server will return an error message in the below format
{
"event": "ERROR",
"code": "400",
"message": "Invalid event type provided",
"timestamp": "2018-09-05T01:34:39Z"
}
Error Code | Description |
---|---|
400 - Bad Request | The request was unacceptable, often due to missing a required parameter. |
401 - Unauthorized | No valid OAuth2 token provided |
403 - Forbidden | Not authorized to access this resource (please contact sales about adding access to your profile). |
404 - Not Found | Requested resource not found (typically the marketId or exchangeId passed through the subscription request not found) |
There may be other types of errors that may be returned and we recommend handling the ERROR type gracefully.
This endpoint can be used to subscribe to the raw ticker data from different exchanges. Clients can send a Subscribe message to start receiving.
To subscribe to all the ticks of an exchange only the exchangeId can be sent. To subscribe to all the ticks of an market only the marketId or marketName can be sent. Both exchangeId and marketId can be sent to subscribe to the market in an exchange. Clients can subscribe to multiple sources as required. Clients need to call the Market and Exchange REST API's to get the ids.
Name | Description |
---|---|
marketId | Subscribe to the exchange ticks for this market |
exchangeId | Subscribe to the exchange ticks for this exchange |
marketName | Subscribe to the exchange ticks for this exchange by the trade pair. e.g. BTC_USD. It is recommended to subscribe by the marketId rather than the marketName |
{
"event": "SUBSCRIBE_EXCHANGE_TICKER",
"exchangeId": "359107d3-bd1a-418c-9470-58831ed9a45e"
}
{
"event": "SUBSCRIBE_EXCHANGE_TICKER",
"marketId": "359107d3-bd1a-418c-9470-58831ed9a45e"
}
{
"event": "SUBSCRIBE_EXCHANGE_TICKER",
"marketName": "BTC_USD"
}
{
"event": "SUBSCRIBE_EXCHANGE_TICKER",
"exchangeId": "359107d3-bd1a-418c-9470-58831ed9a45e",
"marketId": "f7cbc588-283e-41da-9c28-eee2113d7b8d"
}
Subscription response
{
"event": "SUBSCRIBED_EXCHANGE_TICKER",
"exchangeId": "359107d3-bd1a-418c-9470-58831ed9a45e",
"marketId": "f7cbc588-283e-41da-9c28-eee2113d7b8d",
"timestamp": "2020-06-25T05:01:17.429649Z"
}
The server will return ticks in this format
{
"event": "EXCHANGE_TICKER"
"id": "string",
"exchangeId": "string",
"marketId": "string",
"last": "string",
"volume": "string",
"bid": "string",
"ask": "string",
"timestamp": "2020-06-25T05:02:17.429649Z"
}
To unsubscribe, the user should send a payload with the exact same body as the subscribe payload except the event becomes unsubscribe instead of subscribe
{
"event": "UNSUBSCRIBE_EXCHANGE_TICKER",
"exchangeId": "359107d3-bd1a-418c-9470-58831ed9a45e",
"marketId": "f7cbc588-283e-41da-9c28-eee2113d7b8d"
}
This websocket endpoint can be used to subscribe to BNC's LX indices.
Clients need to send a Subscribe message to start receiving. The LX Indices can be subscribed by the indexId or the indexType LX
.
The following table provides the available index Ids to subscribe to an LX index.
Index Type | Index Id | Example Id | Description |
---|---|---|---|
LX | Index Id | 191724d4-7915-491b-8b73-bc293e03a93e | BLX |
LX | Index Id | 6560acf3-1cb7-4fe4-aa19-fbd90c7b56ee | ELX |
LX | Index Id | ce36445a-2a33-4a0f-8b5b-e56175f8db60 | XRPLX |
{
"event": "SUBSCRIBE_INDEX_TICKER",
"indexId": "191724d4-7915-491b-8b73-bc293e03a93e",
"requestId" : 1
}
{
"event": "SUBSCRIBE_INDEX_TICKER",
"indexType": "LX",
"requestId": 2
}
Subscription response
{
"event": "SUBSCRIBED_INDEX_TICKER",
"indexType": "LX",
"timestamp": "2020-06-25T04:56:14.313516Z",
"requestId": 2
}
The server will return ticks in this format
{
"event": "INDEX_TICKER"
"id": "uuid",
"indexId": "uuid",
"indexType": "LX",
"name": "string",
"price": "string",
"volume": "string",
"tickVolume": "string",
"timestamp": "2020-06-25T04:57:01.298745Z"
}
To unsubscribe, the user should send a payload with the exact same body as the subscribe payload except the event becomes unsubscribe instead of subscribe. The requestId is a user option and isn't required.
{
"event": "UNSUBSCRIBE_INDEX_TICKER",
"indexType": "LX",
"requestId": 2
}
This endpoint can be used to subscribe to the GWA / MWA data. These indices are calculated by BNC and published to the websocket endpoint. Clients need to send a Subscribe message to start receiving. Indices can be subscribed by the indexId or the indexType.
The index id will differ based on the index type.
Index Type | Index Id | Example Id | Description |
---|---|---|---|
MWA | Market Id | 2e6d3ce9-9f30-464c-b73e-ba150d2dfb8a | MWA for XAUT_BTC |
GWA | Asset Id | 1490fca6-29f8-416a-835b-e9d000f26fd0 | GWA for XAUT using the BNC asset Id for XAUT. |
Clients need to call the Market and Asset REST API's to get the ids.
{
"event": "SUBSCRIBE_INDEX_TICKER",
"indexId": "1490fca6-29f8-416a-835b-e9d000f26fd0",
"requestId" : 1
}
{
"event": "SUBSCRIBE_INDEX_TICKER",
"indexType": "MWA",
"requestId": 2
}
Subscription response
{
"event": "SUBSCRIBED_INDEX_TICKER",
"indexType": "MWA",
"timestamp": "2020-06-25T04:56:14.313516Z",
"requestId": 2
}
The server will return ticks in this format
{
"event": "INDEX_TICKER"
"id": "string",
"indexId": "string",
"indexType": "string",
"price": "string",
"volume": "string",
"timestamp": "2020-06-25T04:57:01.298745Z"
}
To unsubscribe, the user should send a payload with the exact same body as the subscribe payload except the event becomes unsubscribe instead of subscribe. The requestId is a user option and isn't required.
{
"event": "UNSUBSCRIBE_INDEX_TICKER",
"indexId": "1490fca6-29f8-416a-835b-e9d000f26fd0",
"requestId" : 1
}