b3_insigths
Version:
A brazillian stock exchange CLI
18 lines • 749 B
JavaScript
import { load } from "cheerio";
import FixedIncomeScraperBase from "./FixedIncomeScraperBase.js";
export default class SelicScraper extends FixedIncomeScraperBase {
constructor() {
super();
this.URL = "https://www.bcb.gov.br/controleinflacao/historicotaxasjuros";
}
async getValue() {
const html = await this.getPageHTML("#historicotaxasjuros > tbody > tr");
const $ = load(html);
const table = $("#historicotaxasjuros");
const firstRow = table.find("tbody > tr").first();
const value = $(firstRow.children()[4]).text();
const formattedValue = Number(value.replace(",", ".")).toFixed(2);
return `${formattedValue}%`;
}
}
//# sourceMappingURL=SelicScraper.js.map