Socket
Book a DemoInstallSign in
Socket

currency-exchange-rate

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-exchange-rate

Completely free NPM library to get realtime Currency Exchange Rate

1.0.9
latest
Source
npmnpm
Version published
Weekly downloads
31
933.33%
Maintainers
1
Weekly downloads
 
Created
Source

currency-exchange-rate

NPM library to get realtime Currency Exchange Rate from Yahoo Finance Website. This library uses axios under the hood to make HTTP Call to Yahoo Finance.

Parameters

fromCurrency and toCurrency are two mandatory properties for config parameter of getCurrencyExchangeRate(config, callbackFunction(exchangeRateValue, error)) function. The currency symbols are ISO 4217 Currency Codes. You must pass valid values for these 2 config properties, otherwise the library function will retun error. You can optionally use any of the axios request config along with fromCurrency and toCurrency

If you are using the library behind a coporate proxy please refer axios request config properties link on how to set your proxy settings.

Usage

var currencyExchangeRate = require("currency-exchange-rate");
//Using a Promise.
currencyExchangeRate.getCurrencyExchangeRate({ fromCurrency: "USD", toCurrency: "INR" }).then(function (exchangeRateValue) {
    console.log(exchangeRateValue);
}).catch((error) => {
    console.log(error);
});

//Using a callback function.
currencyExchangeRate.getCurrencyExchangeRate({ fromCurrency: "USD", toCurrency: "INR" }, function (exchangeRateValue, error) {
    if (error) {
        console.error(error);
    }
    else {
        console.log(exchangeRateValue);
    }
});

Keywords

currency

FAQs

Package last updated on 23 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.