coin-ticker
Version:
Wrapper for bitcoin exchange apis. The easiest way to add cryptocurrency market data into your application!
15 lines (13 loc) • 418 B
JavaScript
const axios = require('axios');
module.exports = () => {
return axios.get('https://api.binance.com/api/v3/ticker/price')
.then((res) => {
return res.data.map((currencyPair) => {
pair = currencyPair.symbol.toUpperCase();
return pair.slice(0, -3) + '_' + pair.substr(pair.length - 3)
})
})
.catch((err) => {
console.error('Error fetching binance pairs:', err);
});
}