9

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

General Grievance
  • 4,555
  • 31
  • 31
  • 45
TVA van Hesteren
  • 1,031
  • 3
  • 20
  • 47
  • https://stackoverflow.com/questions/55549499/how-to-retrieve-a-list-of-all-market-pairs-like-eth-btc-using-binance-api - there's a couple of solutions on the problem – Mike Shum Nov 17 '21 at 13:14
  • @MikeK.Shum this is not what I'm looking for? I'm looking for the asset-name (e.g. Bitcoin), not for the market-pair (e.g. BTCEUR). This information is available, I'm missing the asset-names on a public API endpoint – TVA van Hesteren Nov 22 '21 at 08:46
  • Yeah, there's no endpoint for this for sure. We've solved it by caching the result of the /exchangeInfo method. There are baseAsset and quoteAsset on a symbol. – Mike Shum Nov 22 '21 at 13:07
  • @MikeK.Shum I think we are talking about different things here..? What has caching to do with a result-set that doesn't contain the required information? – TVA van Hesteren Nov 23 '21 at 08:29
  • BTW, not all symbols are available on the `/sapi/v1/margin/allAssets` endpoint, either. 158:515 (June 2022) – tony gil Jun 06 '22 at 19:32

2 Answers2

2

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.

tony gil
  • 9,424
  • 6
  • 76
  • 100
user974565
  • 33
  • 4
1

You can

  1. Proxy the private enpoint through your app, so that your API key stays hidden from your users

  2. Use another data source such as Coinmarketcap as already mentioned in another answer

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

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • spot on. thank you, you deserved the bounty award. In case you know how to get the data from PRIVATE endpoint, I'd like to know that as well. I'll write a question and you supply the answer. BOUNTY on that as well. – tony gil Jun 06 '22 at 20:27