'Binance API list all symbols with their names from a public endpoint
I've integrated the Binance API in my project to show a list of all supported symbols and their corresponding icon. However, I'm unable to fetch the symbols name/description
.
For instance, I can fetch BTC-EUR, but I can't fetch 'Bitcoin' or similar through a public endpoint. At least, I haven't found the endpoint so far.
For now, I'm using a private endpoint (which is behind authentication) at /sapi/v1/margin/allAssets
. This returns me the name/description
for each symbol, but as you can imagine I want to prevent usage of private API tokens on fetching public
information
{
"assetFullName": "Bitcoin", <----- This is what I'm looking on a public endpoint
"assetName": "BTC",
"isBorrowable": true,
"isMortgageable": true,
"userMinBorrow": "0.00000000",
"userMinRepay": "0.00000000"
}
So, my question is whether there is a public endpoint available to fetch the same information? Right now, I'm using the endpoint /api/v3/exchangeInfo
to retrieve the available symbols on the exchange, but this response hasn't got the name/description
of the symbol in it...
"symbols": [
{
"symbol": "ETHBTC",
"status": "TRADING",
"baseAsset": "ETH",
"baseAssetPrecision": 8,
"quoteAsset": "BTC",
"quotePrecision": 8,
"quoteAssetPrecision": 8,
"orderTypes": [
"LIMIT",
"LIMIT_MAKER",
"MARKET",
"STOP_LOSS",
"STOP_LOSS_LIMIT",
"TAKE_PROFIT",
"TAKE_PROFIT_LIMIT"
],
"icebergAllowed": true,
"ocoAllowed": true,
"isSpotTradingAllowed": true,
"isMarginTradingAllowed": true,
"filters": [
//These are defined in the Filters section.
//All filters are optional
],
"permissions": [
"SPOT",
"MARGIN"
]
}
]
I've already looked for public endpoints about listing assets
, as that's usually the namespace other exchanges return this information for, but I can't find such an endpoint in the documentation of the Binance API
Solution 1:[1]
I ran into this same frustrating mess. Binance US doesn't allow the /sapi/v1/margin/allAssets
because MARGIN permissions aren't granted for US users (returns an 'Invalid Api-Key ID').
There is nothing else available in their SPOT accounts that gives this data.
What I ended up doing was pulling the data from CoinMarketCap via https://pro-api.coinmarketcap.com/v1/cryptocurrency/map
PROS: It's free w/ the Basic account (you will need an account)
CONS: It's NOT a standard (there isn't one, that I can tell). It will work fine for BTC, but take a look at the symbol HOT -- there's a few of them. You will have to manually curate those to match Binance (I persisted the CMC Unique ID in addition to the symbol & name). It sucks, but Binance doesn't give basic data like the name of the currency, which is absurd.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user974565 |