Code Monkey home page Code Monkey logo

bcra-exchange's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.