Bancor provides public API methods which take HTTP GET requests and return JSON.
Please note that making more than 6 calls per second to the public API, or repeatedly and needlessly fetching excessive amounts of data, can result in your IP being banned.
What is the “Ticker” API?
The “Ticker” API returns all relevant data (name, symbol, code, decimals, price 24h high, price 24h low, price, price 24h, volume 24h, total supply) for the specific pair.
“Volume” and “total supply” values are indicated in the smallest unit of the token (example: Wei for ETH) which means you will need to format it correctly based on the {toToken} decimal digit settings.
Ticker API URL Format:
GET:
https://api.bancor.network/0.1/currencies/{toToken}/ticker?fromCurrencyCode={fromToken}&displayCurrencyCode={displayCurrency}
Values you are required to pass:
- toToken - this needs to be the token code (ETH, BNT, etc).
- fromToken - this needs to be the token code (ETH, BNT, eth).
Note - toToken & fromToken will define the pair you are aiming to receive data for. The response will return all values for the indicated pair including volume and price.
- displayCurrency - we support 3 display currencies: ETH, USD or EUR.
For accuracy of data we advise using the following pairs:
- BNT/ETH
- {token}/BNT
Sample URL format: BNT/ETH
https://api.bancor.network/0.1/currencies/BNT/ticker?fromCurrencyCode=ETH&displayCurrencyCode=ETH
Sample output:
{
"data": {
"name": "Bancor",
"symbol": "BNT",
"code": "BNT",
"decimals": 18,
"totalSupply": "78484266561094012877746246",
"price24h": 0.006597180383137444,
"volume24h": "2887858753166105000000",
"displayCurrency": "ETH",
"price": 0.006608204569155241
}
}
Sample URL format: GNO/BNT
https://api.bancor.network/0.1/currencies/GNO/ticker?fromCurrencyCode=BNT&displayCurrencyCode=USD
Sample output:
{
"data": {
"name": "Gnosis",
"symbol": "GNO",
"code": "GNO",
"decimals": 18,
"totalSupply": "10000000000000000000000000",
"price": 21.739506617308834,
"volume24h": "11641320610427583000000",
"displayCurrency": "USD",
"price24h": 25.640709006574166
}
}
- Token indication must be in upper case and match the token code from the “Pairs” API.
Keep in mind:
Bancor API is currently in alpha and is likely to break or be slow to respond.
We offer several APIs for our partners, for more information please visit our API Documentation