Reputation: 1241
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
Upvotes: 11
Views: 14744
Reputation: 33
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?CMC_PRO_API_KEY=<your-API-key>
Check their API authentication documentation.
PROS: It's free w/ the Basic account (you will need an account and an active API key - 5 minutes, tops)
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.
Upvotes: 2
Reputation: 43521
You can
Proxy the private enpoint through your app, so that your API key stays hidden from your users
Use another data source such as Coinmarketcap as already mentioned in another answer
Query undocumented public endpoints (list with just name
per each symbol, detail with name
and description
) that they use on the web app and are likely to change
However there is currently no direct way to get a currency name and symbol through an officially documented public Binance API endpoint without authorization.
Upvotes: 1