Skip to content

EconObs/bacensgs-gas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bacensgs-gas

ctrl+s ✌️

BacenSgs is a JavaScript library for Google Apps Script that facilitates interaction with the API of the Central Bank of Brazil's (BCB) Time Series Management System (SGS). With this library, you can easily retrieve historical data on various economic and financial variables made available by the BCB.

Installation

To use BacenSgs in your Google Apps Script, follow these steps:

  1. Open the Google Apps Script script where you want to use the library.
  2. Go to Library > Add libraries.
  3. Paste the project ID:
1pmDEF2HnD0TbBvI9fsoZcMUVGp8sVnq9cCsXkt3n06PVDnKmI0O_yGRF

Using the Library

The BacenSgs library exposes the getDataSerie function to retrieve historical data for a specific series.

The getDataSerie function receives two parameters:

  • seriesCode (string): The identifier code of the desired series. You can find the list of available codes in the BCB SGS API documentation.
  • params (object - opcional): Object containing optional query parameters.
    • periods (number): Number of recent periods in the series to be retrieved. By entering this parameter, the startDate and endDate options will be ignored.
    • startDate (string): Start date of the series in dd/mm/yyyy format. Must be entered together with endDate.
    • endDate (string): End date of the series in dd/mm/yyyy format. Must be entered together with startDate.

The function returns a JSON object containing the retrieved time series data.

Usage example:

// Retrieve the last 4 periods of the series identified by the code “1637”
const data = BacenSgs.getDataSerie('1637', { periods: 4 });

// Recover the series identified by the code “433” between January 1, 2020 and 2021
const data = BacenSgs.getDataSerie('433', { startDate: '01/01/2020', endDate: '01/01/2021' });

Logger.log(data);

Thank you for considering the BacenSgs for your needs. If you have any questions or need further assistance, please don't hesitate to reach out.



Static Badge Static Badge Static Badge Static Badge

About

Google Apps Script implementation to retrieve time series data from the Brazilian Central Bank API.

Topics

Resources

License

Stars

Watchers

Forks

Contributors