Skip to content

dev3mike/Currency-Rate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Currency-Rate

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

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
*/

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

About

Currency Rate Module for Api24.net WebService

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 3

  •  
  •  
  •