Skip to content

Instantly share code, notes, and snippets.

View rafalimaz's full-sized avatar
💭
I may be slow to respond.

Rafael Lima rafalimaz

💭
I may be slow to respond.
View GitHub Profile
@danperrout
danperrout / TesouroDireto.gs
Last active April 27, 2026 23:58
API Função TESOURODIRETO Google Sheets
/*
* @return Acessa radaropcoes.com e retorna informações de um título específico do Tesouro Direto
* Endpoint: https://api.radaropcoes.com/bonds/{bondName}
*/
function TESOURODIRETO(bondName, argumento = "r") {
let srcURL = "https://api.radaropcoes.com/bonds/" + encodeURIComponent(bondName);
let response = UrlFetchApp.fetch(srcURL, {
muteHttpExceptions: true
});
@lucashmsilva
lucashmsilva / TESOURODIRETO(taxa).js
Last active February 5, 2026 15:16
API para criar a função TESOURODIRETO Google Sheets
/*
* @return Retorna a cotação atual de um título específico do Tesouro Direto Junto com a taxa anual de retorno
* @customfunction
**/
function TESOURODIRETO(bondName) {
let srcURL = "https://www.tesourodireto.com.br/json/br/com/b3/tesourodireto/service/api/treasurybondsinfo.json";
let jsonData = UrlFetchApp.fetch(srcURL);
let parsedData = JSON.parse(jsonData.getContentText()).response;
for(let bond of parsedData.TrsrBdTradgList) {