javascriptreactjsbinance

How to retrieve a list of all market pairs like ETH/BTC using Binance API?


I am working on a project relevant to crypto trading where I need to select a market pair of Binance Exchange and based on the pair choice I have to show various results like current price, 24 Hr price change, 24 Hr Volume and last 10 trade history of that market pair. I have gone through Binance Rest API Docs: https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md ,and can't find the endpoint which can help me retrieve a list of market pairs. Is there any documentation I am unaware about?

Thanks.


Solution

  • You are looking for the /exchangeInfo public endpoint.

    See more at https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md :

    Exchange information

    GET /api/v1/exchangeInfo

    Current exchange trading rules and symbol information

    Resulting symbols array of all coin pairs:

    ...
    "symbols": [{
    "symbol": "ETHBTC",
    "status": "TRADING",
    "baseAsset": "ETH",
    "baseAssetPrecision": 8,
    "quoteAsset": "BTC",
    "quotePrecision": 8,
    "orderTypes": [
      // These are defined in the `ENUM definitions` section under `Order types (orderTypes)`.
      // All orderTypes are optional.
    ],
    "icebergAllowed": false,
    "filters": [
      // There are defined in the `Filters` section.
      // All filters are optional.
    ]
    }]
    ...