Market Data API (v3)

Download OpenAPI specification:Download

Introduction

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:

  • A call to obtain an OAuth token based on client credentials.
  • A call to one of the lookups to get the UUID for an asset, market or an exchange.
  • A call to the API endpoint to get the response.

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

Authentication

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.

Websocket API Authentication

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>

Rest API Authentication

Our REST endpoints require a bearer token, valid for 24 hours, to be sent in the Authorization header.

Authorization: Bearer <token>

auth

Security Scheme Type OAuth2
clientCredentials OAuth Flow
Token URL: https://api.bravenewcoin.com/v3/oauth/token
Scopes:
  • read:exchange-ticker -

    Read the latest exchange ticker

  • read:index-ticker -

    Read the historical index tickers

  • read:ohlcv -

    Read end of day open, high, low, close and volume

  • read:market-cap -

    Read the market capatilization

  • read:LX -

    Read historical LX index tickers and end of day open, high, low, close and volume

  • read:derivatives -

    Read derivatives contract information and latest ticker data

Client Credentials

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

Request Body schema: application/json
grant_type
string

Denotes the flow you are using. For Client Credentials use client_credentials.

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.

Audience Description
https://api.bravenewcoin.com Access the Rest API
wss://ws.bravenewcoin.com Subscribe to the Websocket Stream

Responses

Response Schema: application/json
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.

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "access_token": "string",
  • "scope": "string",
  • "expires_in": 0,
  • "token_type": "string"
}

IDs

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:

  • Asset: Identifier for an asset, coin or token. e.g. BTC, LTC, ETH etc.
  • Market: Identifier for a market pair, consisting of a base asset and quote asset. e.g. BTC/USD, BTC/ETH etc.
  • Exchange: Identifier for an exchange. e.g. Binance, Bitstamp, Kraken.
  • Contract: Identifier for a derivatives contract. e.g. Bybit's BTCUSDM23 Future or Deribit's ETH-31MAR23-4000-C Option.

Pagination

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.

Timezones

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.

Support

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.

Versioning

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:

  • Adding new API resources
  • Adding new optional request parameters to existing API methods
  • Adding new properties to existing API responses
  • Changing the order of properties in existing API responses
  • Changing the length or format of object IDs or other opaque strings

GWA

Global weighted average Spot Rates:

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

Example API call for GWA Intraday 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

Example API call for GWA Open, High, Low, Close, Volume for LTC:

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

MWA

Market Weighted Average Reference Rates:

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}&quoteAssetId={USD_Asset_Id}

The respective asset Ids can be obtained by querying the Asset API as shown in the GWA section.

Example API call for MWA Intraday BTC/USD:

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

Example API call for MWA Open, High, Low, Close, Volume for BTC/USD:

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

Rest API Overview

Brave New Coin REST API exposes the following endpoints:

  • GWA / MWA / LX: Data from intraday API's is limited to a 200 day trailing window and refreshed every 30 seconds from June 1st, 2019.
  • OHLCV: OHLCV API's can provide the full historic dataset.
  • Market Cap: Latest ranking within the last 5 minutes.
  • XchangeFeed: Standardized exchange market tickers updated every 30 seconds.

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

Rest API Errors

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 status code summary

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

Handling Errors

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.

Asset

Retrieve information about assets.

List all assets

List all assets or provide a query parameter to search.

query Parameters
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.

Responses

Response Schema: application/json
Array of objects (Asset)

Request samples

curl https://api.bravenewcoin.com/v3/asset/ -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ]
}

Retrieve an asset

Retrieves the details of an asset that has previously been created. Supply the unique identifier of the asset.

path Parameters
id
required
string <uuid>

The unique resource identifier

Responses

Response Schema: application/json
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.

Request samples

curl https://api.bravenewcoin.com/v3/asset/f1ff77b6-3ab4-4719-9ded-2fc7e71cff1f -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "name": "string",
  • "symbol": "string",
  • "status": "ACTIVE",
  • "type": "FIAT",
  • "url": "string",
  • "contractAddress": "string"
}

Market

Retrieve information about markets.

List all markets

List all markets or provide a query parameter to search.

query Parameters
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.

Responses

Response Schema: application/json
Array of objects (Market)

Request samples

curl https://api.bravenewcoin.com/v3/market/ -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ]
}

Retrieve a market

Retrieves the details of a market that has previously been created. Supply the unique identifier of the market.

path Parameters
id
required
string <uuid>

The unique resource identifier

Responses

Response Schema: application/json
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

Request samples

curl https://api.bravenewcoin.com/v3/market/6ea0d2ef-6dd0-4adb-ad32-f7f3db58ccbe -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "baseAssetId": "1271cdfd-c286-4e6c-bca5-dce2da2fbc43",
  • "quoteAssetId": "aa90b6f3-20ad-4613-b096-27339b67231a"
}

Exchange

Retrieve information about exchanges.

List all exchanges

List all exchanges or provide a query parameter to search.

query Parameters
status
string
Enum: "ACTIVE" "INACTIVE"

Only return exchanges which have a particular status.

name
string

Return exchange with specified name.

Responses

Response Schema: application/json
Array of objects (Exchange)

Request samples

curl https://api.bravenewcoin.com/v3/exchange/ -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ]
}

Retrieve an exchange

Retrieves the details of an exchange that has previously been created. Supply the unique identifier of the exchange.

path Parameters
id
required
string <uuid>

The unique resource identifier

Responses

Response Schema: application/json
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

Request samples

curl https://api.bravenewcoin.com/v3/exchange/65cf072d-2ffa-48f8-9497-6654234f52e3 -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "name": "string",
  • "url": "string",
  • "status": "ACTIVE",
  • "markets": [
    ],
  • "symbols": [
    ]
}

XchangeFeed

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:

  • All the markets for an individual exchange
  • For a particular market on an individual exchange
  • For a particular market across all the exchanges that trades the pair
  • Returns all when unparameterized

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.

List all exchange tickers

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.

Authorizations:
auth (read:exchange-ticker)
query Parameters
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.

Responses

Response Schema: application/json
Array of objects (Tick)
nextId
string <uuid>

The next id which can be used as startAfter for pagination

Request samples

curl https://api.bravenewcoin.com/v3/exchange-ticker/ -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ],
  • "nextId": "de98e92a-2a9c-43e0-9588-39d760517db3"
}

GWA / MWA / LX

Get intraday

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.

Authorizations:
auth (read:index-tickerread:LX)
query Parameters
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>

Retrieve all the indices by the particular index id. The index id will differ based on the index type.

Index Type Index Id Description
MWA Market Id
GWA Asset Id
LX 191724d4-7915-491b-8b73-bc293e03a93e BLX
LX 6560acf3-1cb7-4fe4-aa19-fbd90c7b56ee ELX
LX ce36445a-2a33-4a0f-8b5b-e56175f8db60 XRPLX
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.

Responses

Response Schema: application/json
Array of objects (IndexTicker)
nextId
string <uuid>

The next id which can be used as startAfter for pagination

Request samples

curl https://api.bravenewcoin.com/v3/index-ticker?indexId={index_id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ],
  • "nextId": "de98e92a-2a9c-43e0-9588-39d760517db3"
}

Get end of day Open, High, Low, Close, Volumes

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)
Authorizations:
auth (read:ohlcvread:LX)
query Parameters
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.

Index Type Index Id Description
MWA Market Id
GWA Asset Id
LX 191724d4-7915-491b-8b73-bc293e03a93e BLX
LX 6560acf3-1cb7-4fe4-aa19-fbd90c7b56ee ELX
LX ce36445a-2a33-4a0f-8b5b-e56175f8db60 XRPLX
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.

Responses

Response Schema: application/json
Array of objects (OpenHighLowCloseVolume)
nextId
string <uuid>

The next id which can be used as startAfter for pagination

Request samples

curl https://api.bravenewcoin.com/v3/ohlcv?indexId={index_id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ],
  • "nextId": "de98e92a-2a9c-43e0-9588-39d760517db3"
}

Market Cap

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.

List the market capitalisation for assets

This API will return a list of assets ranked by their market capitalization.

Authorizations:
auth (read:market-cap)
query Parameters
assetId
string <uuid>

The asset id to search

percentChange
boolean
Default: false

Return the percent change in the response.

Responses

Response Schema: application/json
Array of objects (MarketCap)

Request samples

curl https://api.bravenewcoin.com/v3/market-cap -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ]
}

Derivatives

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

List all contracts

This API provides derivatives contract information e.g. expiration, contract value, settlement currency.

Authorizations:
auth (read:derivatives)
path Parameters
derivativeType
required
string
Enum: "futures" "perpetuals" "options"

Identifies the contracts derivative type.

query Parameters
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.

Responses

Response Schema: application/json
Array of objects (DerivativeContract)

Request samples

curl https://api.bravenewcoin.com/v3/derivatives/contract/{derivative_type}?exchangeId={exchange_id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ]
}

Retrieve a contract

Retrieve the information for a single contract by providing it's unique resource identifier.

Authorizations:
auth (read:derivatives)
path Parameters
derivativeType
required
string
Enum: "futures" "perpetuals" "options"

Identifies the contracts derivative type.

id
required
string <uuid>

The unique contract resource identifier.

Responses

Response Schema: application/json
id
string <uuid>

Unique identifier for the resource. Known as contractId in other endpoints.

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

optionStrike
string

The options strike price. Only for derivativeType OPTION.

listing
string <date-time>

The timestamp when the contract was listed. Only for derivativeType FUTURE and OPTION.

expiration
string <date-time>

The timestamp when the contract expires. Only for derivativeType FUTURE and OPTION.

Request samples

curl https://api.bravenewcoin.com/v3/derivatives/contract/{derivative_type}/{id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "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"
}

Get tickers

This API provides derivatives tickers e.g. price, volume, open interest, ask, bid etc.

Authorizations:
auth (read:derivatives)
path Parameters
derivativeType
required
string
Enum: "futures" "perpetuals" "options"

Identifies the contracts derivative type.

query Parameters
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.

Responses

Response Schema: application/json
Array of objects (DerivativeTicker)

Request samples

curl https://api.bravenewcoin.com/v3/derivatives/ticker/{derivative_type}?exchangeId={exchange_id} -H 'Authorization: Bearer test_SiHrnL5NKsea0G2W4LHd' -G

Response samples

Content type
application/json
{
  • "content": [
    ]
}

Websocket Overview

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 :

Connection URL

wss://ws.bravenewcoin.com?access_token=<token>

Authentication

All websocket connections require authentication. For more information see -

Common Message Types

Websocket messages have an event field to identify them

Connection Message

Once the client connection is successful, the server will send back a connection message

{
  "event" : "CONNECTED",
  "timestamp" : "2018-09-05T01:34:39Z"
}

Ping message

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.

Websocket Errors

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 summary

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.

Websocket XchangeFeed

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.

Parameters

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

Subscribe to Exchange by Id

{
  "event": "SUBSCRIBE_EXCHANGE_TICKER",
  "exchangeId": "359107d3-bd1a-418c-9470-58831ed9a45e"
}

Subscribe to Market by Id

{
  "event": "SUBSCRIBE_EXCHANGE_TICKER",
  "marketId": "359107d3-bd1a-418c-9470-58831ed9a45e"
}

Subscribe to Market by Name

{
  "event": "SUBSCRIBE_EXCHANGE_TICKER",
  "marketName": "BTC_USD"
}

Subscribe to a Market in an Exchange

{
  "event": "SUBSCRIBE_EXCHANGE_TICKER",
  "exchangeId": "359107d3-bd1a-418c-9470-58831ed9a45e",
  "marketId": "f7cbc588-283e-41da-9c28-eee2113d7b8d"
}

Responses

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

Unsubscribe

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

Websocket LX

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

Subscribe by Index ID

{
  "event": "SUBSCRIBE_INDEX_TICKER",
  "indexId": "191724d4-7915-491b-8b73-bc293e03a93e",
  "requestId" : 1
}

Subscribe by Index Type

{
  "event": "SUBSCRIBE_INDEX_TICKER",
  "indexType": "LX",
  "requestId": 2
}

Responses

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

Unsubscribe

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
}

Websocket GWA / MWA

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.

Subscribe by Index ID

{
  "event": "SUBSCRIBE_INDEX_TICKER",
  "indexId": "1490fca6-29f8-416a-835b-e9d000f26fd0",
  "requestId" : 1
}

Subscribe by Index Type

{
  "event": "SUBSCRIBE_INDEX_TICKER",
  "indexType": "MWA",
  "requestId": 2
}

Responses

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

Unsubscribe

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
}