api24-currencyrate

1.0.3 • Public • Published

Currency-Rate

If you need any information about our webservice Please visit Currency Rate Official Documentation

Currency Rate API Documentation (Farsi)

If you need latest rate of currencies in Iran in your application, you can easily use our webservice.

For more information and check other products check our WebSite

Installation

First of all, You need to make an account on Api24.net from Here

After that you just need to pick API-KEY up from Dashboard section.

For installing CurrencyRate use this command via npm

npm i api24-currencyrate

If you don't have npm you can easily install it from npm website

Usage

Well, There is three examples to get Data from the service:

Get List of All Rates

const { CurrencyRate } = require("api24-currencyrate");
const cr = new CurrencyRate("YOUR_API_KEY");

// Get List of Rates
const prices = await cr.rates(); // Result in Array
console.log("Prices in Array", prices);

/*
Output:
[
  Rate {
    title: 'USD',
    price: 10000,
    measure: 'TOMAN',
    date: undefined
  },
  Rate {
    title: 'EUR',
    price: 10000,
    measure: 'TOMAN',
    date: undefined
  },
  ....
]
*/

Get a Single Rate

const { CurrencyRate } = require("api24-currencyrate");
const cr = new CurrencyRate("YOUR_API_KEY");

// Get a Single Rate
const rateUSD = await cr.rates({ currency: "USD" });
const rateUSD_price = rateUSD.price;
console.log("Single USD Rate", rateUSD, rateUSD_price);

/*
Output:
  Rate {
    title: 'USD',
    price: 10000,
    measure: 'TOMAN',
    date: undefined
  }
*/

Convert Rates

const { CurrencyRate } = require("api24-currencyrate");
const cr = new CurrencyRate("YOUR_API_KEY");

// Convert Rates
const amount = 100;
const convertResult = await cr.convert(amount, "USD", "Toman");
console.log("Convert Result", convertResult);

/*
Output should be float
*/

وب سرویس نرخ ارز

Package Sidebar

Install

npm i api24-currencyrate

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

21.2 kB

Total Files

15

Last publish

Collaborators

  • dev3mike