npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tbhaxor/fixer

v1.0.6

Published

Fixer.io SDK for Nodejs and Browser

Downloads

2

Readme

Node Fixer

Node Fixer is an unofficial API Client for Fixer. Fixer is a simple and lightweight API for current and historical foreign exchange (forex) rates.

To get an API, you need to subscribe to atlest $10 plan ⇒ https://fixer.io/product

Features

  • Lightweight
  • Fast
  • Nodejs and Browser Integration
  • Typescript support
  • API Calls to
    • Available currency symbols
    • Currency conversion (both latest and historic)
    • Timeseries of past 365 days
    • Fluctuations in the rate change of past 365 days

Installation

Nodejs

# yarn
yarn add @tbhaxor/fixer

# Npm
npm i @tbhaxor/fixer

CDN

<script src="https://cdn.jsdelivr.net/gh/tbhaxor/node-fixer/dist/bundle/fixer.web.js"></script>

Usage

// es6
import Fixer from '@tbhaxor/fixer';

// commonjs
const { default: Fixer } = require('@tbhaxor/fixer');

const fixer = new Fixer('API KEY HERE');

(async () => {
  const conversion = await fixer.convert(1, 'USD', 'INR');
  console.log(conversion.result); // 72.46
})();

API

All the callable methods are listed here

Symbols

Return all available currencies

Usage

(async () => {
  await fixer.symbols();
})();

N/A

| Name | Type | Description | | :-----: | :----: | :------------------------------------------------------------------------------------ | | symbols | object | All supported currencies with their respective three-letter currency codes and names. |

Latest Rates

Real-time exchange rate data updated every 60 minutes, every 10 minutes or every 60 seconds.

Usage

(async () => {
  await fixer.symbols('USD', ['INR', 'RSD', 'JPY']);
})();

| Name | Type | Description | | :-----: | :------: | :------------------------------------------------------------------------------------------------ | | base | string | (Optional) Enter the three-letter currency code of your preferred base currency. (default: USD) | | symbols | string[] | (Optional) Enter a list of currency codes to limit output currencies. (default: []) |

| Name | Type | Description | | :-------: | :----: | :--------------------------------------------------------------------- | | timestamp | number | Exact date and time (UNIX time stamp) the given rates were collected. | | base | string | Three-letter currency code of the base currency used for this request. | | symbols | object | Exchange rate data for the currencies you have requested. |

Conversion

Retrieve information about how currencies fluctuate on a day-to-day basis.

Note: Maximum allowed timeframe is 365 days.

Usage

(async () => {
  await fixer.convert(1, 'USD', 'INR');
})();

| Name | Type | Description | | :-----: | :------: | :------------------------------------------------------------------------------------------- | | ammount | number | The amount to be converted. | | base | string | Three-letter currency code of the currency you would like to convert from. | | target | string[] | Three-letter currency code of the currency you would like to convert to. | | date | string | (Optional) Specify a date (format YYYY-MM-DD) to use historical rates for this conversion. |

| Name | Type | Description | | :------------: | :-----: | :-------------------------------------------------------------------------- | | query | object | Source requested | | query.from | string | Three-letter currency code of the currency converted from. | | query.to | string | Three-letter currency code of the currency converted to. | | query.amount | number | Amount that is converted. | | info | object | Metadata | | info.timestamp | number | Exact date and time (UNIX time stamp) the given exchange rare was collected | | info.rate | number | Exchange rate used for your conversion. | | historical | boolean | Returns true if historical rates are used for this conversion. | | result | number | Converted money. Use this to charge users |

Fluctuation

Retrieve information about how currencies fluctuate on a day-to-day basis.

Note: Maximum allowed timeframe is 365 days.

Usage

(async () => {
  await fixer.fluctuation('2019-12-02', '2020-01-02', 'USD', ['INR', 'JPY']);
})();

| Name | Type | Description | | :-----: | :------: | :---------------------------------------------------------------------------- | | start | string | The start date (format YYYY-MM-DD) of your preferred fluctuation timeframe. | | end | string | The end date (format YYYY-MM-DD) of your preferred fluctuation timeframe. | | base | string | Three-letter currency code of your preferred base currency. (default: USD) | | symbols | string[] | List of currency codes to limit output currencies. (default: []) |

| Name | Type | Description | | :-----------------------------: | :-----: | :---------------------------------------------------------------------------------- | | fluctuation | boolean | Returned true if a request to the fluctuation endpoint is made. | | start_date | boolean | The start date of your time frame. | | end_date | boolean | The end date of your time frame. | | base | string | Three-letter currency code of the base currency used for this request. | | rates | object | Exchange rate data for the currencies you have requested. | | rates.<SYMBOL>.start_rate | number | Exchange collected on your start date. | | rates.<SYMBOL>.end_rate | number | Exchange collected on your end date. | | rates.<SYMBOL>.change | number | Change (decimal number) of the given currency rate between your start and end date. | | rates.<SYMBOL>.change_pct | number | Percentage change of the given currency rate between your start and end date. |

Timeseries

Query the API for daily historical rates between two dates of your choice, with a maximum time frame of 365 days.

Usage

(async () => {
  await fixer.timeseries('2019-12-02', '2020-01-02', 'USD', ['INR', 'JPY']);
})();

| Name | Type | Description | | :-----: | :------: | :---------------------------------------------------------------------------- | | start | string | The start date (format YYYY-MM-DD) of your preferred fluctuation timeframe. | | end | string | The end date (format YYYY-MM-DD) of your preferred fluctuation timeframe. | | base | string | Three-letter currency code of your preferred base currency. (default: USD) | | symbols | string[] | List of currency codes to limit output currencies. (default: []) |

| Name | Type | Description | | :--------: | :----------------: | :--------------------------------------------------------------------- | | timeseries | boolean | Returned true if a request to the timeseries endpoint is made. | | start_date | boolean | The start date of your time frame. | | end_date | boolean | The end date of your time frame. | | base | string | Three-letter currency code of the base currency used for this request. | | rates | "object of object" | Exchange rate data for the currencies you have requested. |

Error Handling

The generic response contains success key of boolean type. If there is any error, you will get error field with success = false

Error schema

| Name | Type | Description | | :--: | :----: | :------------------------------------- | | code | number | Numeric error code | | type | string | Type of error (for developers) | | info | string | Human readable message (for end users) |

Contribution

Feel free to contribute to this project. I have convered almost all the feature this service provides, I would be interesting to see what you can do with it

Possible scope of contribution

  1. Documentation
  2. Issues
  3. Performance
  4. Removing axios dependencies and using creating own http mini utility compatible with nodejs and browser

Licence

Node Fixer is licensed under MIT License

Contact the Author

Follow the links to reach me