As a example in coinbase-api I can get cryptocurrency's price this way:
const eth_eur = await publicClient.getProductOrderBook('ETH-EUR', { level: 1 });
As you can see, I need pair cryptocurrency - eur
, and that's important. So, how can I do it using binance api?
I was trying to use something like this:
const price = await binance.futuresFundingRate("ETHUSDT");
But this is not what I need. I need price in euro.
You can use the "Current average price" endpoint (docs) for base currencies that have pair against EUR
.
Example:
const axios = require('axios');
axios.get('https://api.binance.com/api/v3/avgPrice?symbol=BTCEUR').then(response => {
const body = response.data;
console.log(body.price);
});