Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

argy-usd

alestivanello13MIT1.0.4TypeScript support: included

A simple and efficient library for fetching Argentine dollar exchange rates and performing currency conversions.

dólar, argentina, cotización, blue, oficial, mep, ccl, tipo de cambio

readme

argy-usd

A simple and efficient library for fetching Argentine dollar exchange rates and performing currency conversions.

Installation

npm install argy-usd

Usage

import { getDollarRates, convertUsdToArs, convertArsToUsd, pollDollarRates } from 'argy-usd';

// Get dollar rates
const rates = await getDollarRates({
    source: "dolarapi",
    cache: true,
    dollarType: "cripto"
});

// Convert USD to ARS
const arsAmount = await convertUsdToArs(100, 'cripto', 'sell', "dolarapi");

// Convert ARS to USD
const usdAmount = await convertArsToUsd(10000, 'oficial', 'buy', "bluelytics");

// Poll dollar rates
const stopPolling = pollDollarRates({
    interval: 1000,
    onUpdate: (rates) => console.log(rates),
    onError: (error) => console.error(error)
});

// Stop polling
stopPolling();

Sources

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

alestivanello99@hotmail.com