---
title: "Using GetFREData"
author: "Marcelo Perlin"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Using GetFREData}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---


```{r, include = FALSE}
knitr::opts_chunk$set(
  eval = FALSE,
  comment = "#>",
  out.width = "100%",
  results='hold'
)
library(knitr)
```

# Package GetFREData

`GetFREData` is an R package for downloading information about companies traded at B3, the Brazilian financial exchange. The source of the data is B3's [FRE](https://www.b3.com.br/pt_br/produtos-e-servicos/negociacao/renda-variavel/acoes/consultas/informacoes-por-periodo/), the official system for the registration of all major corporate actions. 

The corporate data includes (since 2010):

- List of stockholders
- All capital issues 
- Stock value over years
- Compensation of boards and directors
- Composition of boards and comittes
- Family relations within the company
- List of companies related to family members
- Stock details
- Intangible details
- Auditing details
- Dividends details


## Installation

```{r, eval=FALSE}
# CRAN (stable)
install.packages('GetFREData')

# github (development)
if (!require(devtools)) install.packages('devtools')
if (!require(GetFREData)) devtools::install_github('msperlin/GetFREData') 
```

## Example of usage

```{r}
library(GetFREData)
library(tidyverse)

search_company('grendene', 
               cache_folder = tempdir())

l_fre <- get_fre_data(companies_cvm_codes = 19615,
                      fre_to_read = 'last',
                      first_year = 2020,
                      last_year = 2020, 
                      cache_folder = tempdir())
                      
glimpse(l_fre)
```