1.0.0 • Published 2 years ago

selic v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Selic

All Contributors

Donate via Paypal Build Status License NPM Dependencies GitHub stars GitHub forks

Node.js Deno TypeScript Jest

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

About

This is a tiny lib compatible with Node.js v12+ and Deno v1+, 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

For Node.js via NPM

npm install --save selic

For Node.js via Yarn

yarn add selic

How to use

For Deno

import * as selic from 'https://deno.land/x/selic/mod.ts';

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 caio.ribeiro.pereira@gmail.com
Twitter: https://twitter.com/crp_underground
About me: https://crpwebdev.github.io

Contributors ✨

Thanks goes to these wonderful people (emoji key):

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

1.0.0

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago