npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bccr-indicadores-economicos

v2.0.3

Published

Interfaz para consumo del servicio web de indicadores económicos del Banco Central de Costa Rica (BCCR).

Downloads

35

Readme

BCCR indicadores económicos

Interfaz para consumo del servicio web de indicadores económicos del Banco Central de Costa Rica (BCCR).

npm version npm Libraries.io dependency status for latest release NPM License code style: prettier language: typescript

Pre-requisitos

Registro a servicio web de indicadores económicos del BCCR

Es necesario el registro en el servicio web del BCCR: Formulario de registro a servicio web BCCR.

El correo electrónico registrado y el token generado por el servicio web del BCCR son necesarios para el funcionamiento de esta biblioteca.

Tabla de contenidos

Instalación

$ npm install bccr-indicadores-economicos

Uso

ANTES DE UTILIZAR: Completar los pasos indicados en pre-requisitos y chequear la lista de indicadores públicos en lista de indicadores públicos.

Importación

No ES6

const BCCRWebService = require("bccr-indicadores-economicos");

ES6

import BCCRWebService from "bccr-indicadores-economicos";

Clase BCCRWebService

El constructor de la clase BCCRWebService recibe como parámetros el correo electrónico registrado y el token generado por el sistema del Banco Central.

const bccrWS = new BCCRWebService("[email protected]", "EJEMPLOTOKEN");

Esta clase cuenta con un único método: request el cual es asincrónico y sobrecargado.

request(code)
request(code, targetDate)
request(code, startDate, endDate)

Recuperar el valor actual de un indicador

Utilice el método bccrWS.request(code) para recuperar el valor actual (último valor publicado por el BCCR) de un indicador económico.

// Ejemplo con código 318: Tipo de cambio venta dólar/colón.
const currentColonDollarSellPrice = await bccrWS.request("318");

Resultado

{ code: '318', date: '2024-02-26T00:00:00-06:00', value: 511.27 }

Recuperar el valor de un indicador en una fecha específica

Utilice el método bccrWS.request(code, targetDate) para recuperar el valor de un indicador económico en una fecha específica.

// Fecha que de la cual desea recuperar el indicador económico.
const targetDate = new Date(2024, 0, 1);
// Ejemplo con código 318: Tipo de cambio venta dólar/colón.
const singleColonDollarSellPrice = await bccrWS.request( "318", targetDate);

Resultado

{ code: '318', date: '2024-01-01T00:00:00-06:00', value: 519.21 }

Recuperar el valor de un indicador en un rango de fechas

Utilice el método bccrWS.request(code, startDate, endDate) para recuperar el valor de un indicador económico en un rango de fechas.

// Fecha que de inicio del rango que se desea recuperar.
const startDate = new Date(2024, 0, 1);
// Fecha que de fin del rango que se desea recuperar.
const endDate = new Date(2024, 0, 5);
// Ejemplo con código 318: Tipo de cambio venta dólar/colón.
const rangedColonDollarSellPrice = await bccrWS.request(
    "318",
    startDate,
    endDate,
);

Resultado

[
    { code: "318", date: "2024-01-01T00:00:00-06:00", value: 519.21 },
    { code: "318", date: "2024-01-02T00:00:00-06:00", value: 519.21 },
    { code: "318", date: "2024-01-03T00:00:00-06:00", value: 518.92 },
    { code: "318", date: "2024-01-04T00:00:00-06:00", value: 518.01 },
    { code: "318", date: "2024-01-05T00:00:00-06:00", value: 516.88 },
]

Lista de indicadores públicos

Listado de indicadores económicos populares:

| Código | Descripción | | ------ | ---------------------------------- | | 317 | Tipo de cambio: compra colón/dólar | | 318 | Tipo de cambio: venta colón/dólar | | 3323 | Tipo de cambio: promedio MONEX | | 23698 | TED: Tasa Efectiva en Dólares | | 3541 | TPM: Tasa de Política Monetaria | | 423 | TBP: Tasa Básica Pasiva |

Para obtener el listado completo de indicadores económicos públicos en el servicio web del BCCR consulte el siguiente archivo: Lista de indicadores públicos BCCR.

Limitaciones

ESTA BIBLIOTECA ESTÁ DESARROLLADA PARA SU USO DESDE EL LADO DEL SERVIDOR.

Debido al bloqueo solicitudes de origen cruzado (CORS), toda petición debe ejecutarse desde un servidor web. Por lo tanto, aquellas llamadas desde el lado del cliente (frontend) ocasionrán problemas al momento de solicitar recursos al servicio web del BCCR.

Versionamiento

El sistema de versionamiento utilizado para esa biblioteca es SemVer.

Autor

Andrés Montero Gamboa Estudiante de ingeniería en computación Instituto Tecnológico de Costa Rica LinkedIn | GitHub

Licencia

MIT License

Copyright (c) 2024 Andrés Montero Gamboa

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.