DEV Community

pawan deore
pawan deore

Posted on

Get Currency Exchange rate for FREE

how to convert you currency from dollar to 10+ currencies for FREE

sometimes we need data in Dollar because most of enterprise product accepts payments in all countries and its difficult to predict at the end of the month how much revenue is generated so this API will be helpful

https://currencydatahub.tech/


 /**
 * Get currency exchange rates within a specific date range.
 * @param {string} start - The start date in "YYYY-MM-DD" format.
 * @param {string} end - The end date in "YYYY-MM-DD" format.
 */
function getCurrencyExchangeRates(start, end) {
  try {
    fetch(`https://currencyexchange.host20.uk/api/?start=${start}&end=${end}`)
    .then(res => res.json())
    .then(data => console.log(data))
  } catch (error) {
    console.error('Error fetching currency exchange rates:', error);
    throw error;
  }
}   

getCurrencyExchangeRates("2020-01-02", "2020-01-03");


Enter fullscreen mode Exit fullscreen mode

Top comments (0)