Giter Site home page Giter Site logo

selic's Introduction

Selic

All Contributors

Donate via Paypal Build Status License npm GitHub stars GitHub forks

A tiny lib to fetch brazilian's selic, ipca and cdi rates.

About

This is a tiny lib compatible with Node.js v11+ and TypeScript, with zero dependencies, supports ESImport and CommonJS.

Basically this lib fetchs the current brazilian SELIC, IPCA and CDI rates, all values in apy (percentage per year).

The Selic rate and IPCA rate are fetched from Banco Central do Brasil
The CDI rate is fetched from CETIP

How to install

npm install --save selic

How to use

ESImport

import * as selic from 'selic';

CommonJS

const selic = require('selic');
Fetch selic, ipca and cdi brazilian rates in list version
(async () => {
  const output = await selic.getRatesList();
  /*
   * [
   *  { name: 'Selic', apy: 7.75 },
   *  { name: 'CDI', apy: 7.65 },
   *  { name: 'IPCA', apy: 9.32 },
   * ]
   */
  console.log(output);
})()
Fetch selic, ipca and cdi brazilian rates in object version
(async () => {
  const output = await selic.getRatesObject();
  console.log(output); // { selic: 7.75, cdi: 7.65, ipca: 9.32 }
})()
Get only Selic rate
(async () => {
  const output = await selic.getSelicRate();
  console.log(output); // 7.75
})()
Get only IPCA rate
(async () => {
  const output = await selic.getIpcaRate();
  console.log(output); // 9.32
})()
Get only CDI rate
(async () => {
  const output = await selic.getCdiRate();
  console.log(output); // 7.65
})()

Author

Caio Ribeiro Pereira [email protected]
Twitter: https://twitter.com/crp_underground
About me: https://crpwebdev.github.io

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Michael Wu

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

selic's People

Contributors

caio-ribeiro-pereira avatar allcontributors[bot] avatar

Watchers

James Cloos avatar

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.