Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

open-exchange-rates

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

open-exchange-rates

nodeJS/npm wrapper for the Open Exchange Rates API

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
953
increased by3.36%
Maintainers
1
Weekly downloads
 
Created
Source

Open Exchange Rates npm/nodeJS module

nodeJS/npm wrapper for the Open Exchange Rates API service. Loads up-to-date or historical currency/exchange rate data from the API, for seamless server-side integration.

Requires a free or paid App ID to connect to the service, available here.

Introduction

$ npm install open-exchange-rates

To install, type npm install open-exchange-rates in the terminal.

Requires: http-agent

Example Usage:

See the example.js script in this repository for a basic, working example.

Load the module:
var oxr = require('open-exchange-rates');
Load the latest rates from https://openexchangerates.org:
var oxr = require('open-exchange-rates');
oxr.set({ app_id: 'YOUR_APP_ID' })

oxr.latest(function() {
	// You can now use `oxr.rates`, `oxr.base` and `oxr.timestamp`
});
Get historical rates ("YYYY-MM-DD"):
var oxr = require('open-exchange-rates');
oxr.set({ app_id: 'YOUR_APP_ID' })

oxr.historical('2001-02-03', function() {
	// You can now use `oxr.rates`, `oxr.base` and `oxr.timestamp`
});
Currency conversion with money.js (fx) module:

money.js (npm install money) is a tiny JavaScript currency-conversion library for web and nodeJS.

var oxr = require('open-exchange-rates'),
	fx = require('money');

oxr.set({ app_id: 'YOUR_APP_ID' })

oxr.latest(function() {
	// Apply exchange rates and base rate to `fx` library object:
	fx.rates = oxr.rates;
	fx.base = oxr.base;
	
	// money.js is ready to use:
	fx(100).from('HKD').to('GBP'); // ~8.0424
});
Advanced API Features:

Advanced API features (such as Time Series requests and real-time value conversion) will be added to this module in future.

More Info

For more information, documentation, examples and showcase, check out the Open Exchange Rates homepage

Roadmap

  • Support HTTPS connections
  • Support advanced API queries/features
  • Support Time Series data requests
  • Support Date objects for historical queries

Changelog

0.3

  • Now maintained by openexchangerates.org
  • Tidied up library, readme and example

0.2

  • Updated to work with Open Exchange Rates App IDs
  • Renamed to 'open-exchange-rates'

0.1 - first version

Keywords

FAQs

Package last updated on 16 Jul 2014

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc