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 “Tokens” API?
The “Tokens” API returns all the available data we have for the tokens on the Bancor network.
Base URL format:
https://api.bancor.network/0.1/currencies/{TokenType}?
URL Values:
The following values can be appended to the API call :
- TokenType= indicate the type of tokens you wish to receive in the response
- Tokens - returns ERC20 and smart tokens
- Relays - returns relay tokens
- fromCurrencyCode=ETH - will result in receiving data back in ETH currency.
- orderBy= define the order of items returned. Available values:
- liquidityDepth - the size of the connector balance
- change24h - the change of token price in the last 24 hours
- price - the current token price
- volume24 - the conversion volume during the last 24 hours
- code - token name
- sortOrder= define the sort order of the list received. Available values:
- desc - descending order
- asc - ascending order
- limit= 1-100 (default is 30). Determine the amount of records to receive.
- skip= 1-100 (default is 0). Determine the amount of records to skip.
- includeTotal= boolean value. Indicate if you with to receive the total amount of available tokens in the response.
Sample Call:
https://api.bancor.network/0.1/currencies/tokens?limit=1&skip=0&fromCurrencyCode=ETH&includeTotal=false&orderBy=liquidityDepth&sortOrder=desc
- TokenType = tokens
- fromCurrencyCode = ETH
- orderBy = liquidityDepth
- sortOrder = desc
- limit = 1
- skip = 0
- includeTotal = false
Sample Response:
{
"data": {
"total": 140,
"page": [
{
"id": "594bb7e468a95e00203b048d",
"code": "BNT",
"name": "Bancor",
"primaryCommunityId": "5967699a4a93370018b7b891",
"primaryCommunityImageName": "f80f2a40-eaf5-11e7-9b5e-179c6e04aa7c.png",
"liquidityDepth": 29961.835919611894,
"price": 0.0023567912639538,
"change24h": 0.34433789508516177,
"volume24h": {
"ETH": 2075.178868559292,
"USD": 645858.922348,
"EUR": 576120.430588
},
"priceHistory": [
[
0,
96.51478
],
...
[
167,
21.70567
]
]
}
]
}
}
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