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

currency-rates-store

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-rates-store

A storage bot which sync exchange rates

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

A storage bot to sync exchange rates with any exchange rates api

Example

const CurrStore = require('currency-rates-store');
const pull = require('currency-restapi-openexchangerates').Latest('YOUR_APP_ID');

var store = CurrStore({pull: pull});

  // CurrencyRatesStore is an EventEmitter, 
  // log error, warn, info events
['error', 'warn', 'info'].forEach(lv=> store.on(lv, e=> console.log(e);));

store.on('load', store=>{

  // convert €100 EUR to USD 
  console.log(store.convert(100).from('EUR').to('USD'));
  
  // convert € 1 EUR to USD
  console.log(store.from('EUR').to('CAD'));
  
  // simply pass the pair
  console.log(store.pair('EURUSD'));
  
  // or pass the symbol one by one
  console.log(store.rate('USD', 'EUR'));
  
  // same as above, if the pull restapi request is based on `USD`
  console.log(store.rate('EUR'));
  

});

Options

  • wait: milliseconds, default to 3 hours per request. minimum 10 minutes.
  • pull: restapi wrapper. node.js style callback. it should callback the latest rates in the following structure
{
  base: 'USD|EUR|GBP'   - after `loaded` event, this property is ignored
  rates: {
    USD: 1,  
    GBP: ...
    EUR: ...
    ...
  }
}

FAQs

Package last updated on 04 Apr 2016

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