Skip to content

A Typescript library for getting exchange rates from ARS to other currencies from the BCRA site

License

Notifications You must be signed in to change notification settings

JLannoo/BCRA-Exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

679d797 · May 31, 2023

History

16 Commits
May 29, 2023
May 30, 2023
May 31, 2023
May 31, 2023
May 29, 2023
May 31, 2023
May 30, 2023
May 31, 2023
May 31, 2023
May 31, 2023
May 30, 2023
May 30, 2023
May 31, 2023

Repository files navigation

BCRA Exchange

A lightweight fully type-safe crawler for the BCRA (Banco Central de la República Argentina) exchange rate frontend.

Easily get the exchange rate from Pesos Argentinos to any other currency and date provided by the BCRA.

Features

Only works with Node.js >= 18 (Fetch API is required)

Under 3kb gzipped and no dependencies. 7.7k (gzipped: 2.8k)

Easy to use and fully type-safe. Fully type-safe

Installation

npm install bcra-exchange

Usage

import { getCurrencyToday , getCurrencyByDate } from 'bcra-exchange';
// or
const { getCurrencyToday , getCurrencyByDate } = require('bcra-exchange');

// Get the exchange rate from Pesos Argentinos to US Dollars
await getCurrencyToday('Dolar Estadounidense');
await getCurrencyByDate('Dolar Estadounidense', new Date('2020-01-01'));

This will return something like:

{
    "currency": "Dolar Estadounidense",
    "dateTried": "2020-01-01T00:00:00.000Z",
    "dateFetched": "2019-12-31T00:00:00.000Z", 
    // The BCRA doesn't provide exchange rates every day
    // In this case, the closest earlier date is returned
    "value": ...
}

To-Do

  • Add more tests
  • Better error handling
  • CI/CD

About

A Typescript library for getting exchange rates from ARS to other currencies from the BCRA site

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published