A tiny lib to scrap brazilian's selic, ipca and cdi rates
npm install selic
 !TypeScript !Jest
A tiny lib to fetch brazilian's selic, ipca and cdi rates.
This is a tiny lib compatible with Node.js v18+ 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 B3
bash
npm install --save selic
`$3
` bash
yarn add selic
`How to use
$3
` javascript
import * as selic from 'selic';
`$3
` javascript
const selic = require('selic');
`$3
` javascript
(async () => {
const output = await selic.getRatesList();
/*
* [
* { name: 'Selic', apy: 7.75 },
* { name: 'CDI', apy: 7.65 },
* { name: 'IPCA', apy: 9.32 },
* ]
*/
console.log(output);
})()
`$3
` javascript
(async () => {
const output = await selic.getRatesObject();
console.log(output); // { selic: 7.75, cdi: 7.65, ipca: 9.32 }
})()
`$3
` javascript
(async () => {
const output = await selic.getSelicRate();
console.log(output); // 7.75
})()
`$3
` javascript
(async () => {
const output = await selic.getIpcaRate();
console.log(output); // 9.32
})()
`$3
` javascript
(async () => {
const output = await selic.getCdiRate();
console.log(output); // 7.65
})()
``Caio Ribeiro Pereira
Twitter:
About me:
Thanks goes to these wonderful people (emoji key):
Michael Wu 💻 | Caio Ribeiro Pereira 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!