Why can I get the exchange rate for all available coin pairs?

Hi all!

I am integrating binance api for an exchange service. And I had a problem with getting data for exchange pairs.

For example, such a pair returns the course:
https://api.binance.com/api/v3/ticker/price?symbol=BNBBTC

But it doesn’t work the other way around:
https://api.binance.com/api/v3/ticker/price?symbol=BTCBNB
(but on the website such conversion is available)

I also tried using the secret key from my account, that behavior is the same.

Tell me please. what is the problem?

Hi!

The endpoints mentioned are only showing you the price with the given symbol name and the 2nd one does not work, because there is no BTCBNB symbol on the exchange.

What exactly do you want the API to do? Maybe there is another endpoint for that task.

Kind regards

If I understand correctly, you want to get the amount of BNB that can be bought for 1 BTC. In this case, you can get data from

https://api.binance.com/api/v3/ticker/price?symbol=BNBBTC

and then divide 1 by the resulting value.