cotahist_get: Get COTAHIST data from B3

View source: R/scraper-cotahist.R

cotahist_getR Documentation

Get COTAHIST data from B3

Description

Download COTAHIST file and parses it returning structured data into R objects.

Usage

cotahist_get(
  refdate,
  type = c("yearly", "monthly", "daily"),
  cache_folder = cachedir(),
  do_cache = TRUE
)

Arguments

refdate

the reference date used to download the file. This reference date will be formatted as year/month/day according to the given type. Accepts ISO formatted date strings.

type

a string with yearly for all data of the given year, monthly for all data of the given month and daily for the given day.

cache_folder

Location of cache folder (default = cachedir())

do_cache

Whether to use cache or not (default = TRUE)

All valuable information is in the HistoricalPrices element of the returned list. Header and Trailer have informations regarding file generation. The HistoricalPrices element has a data.frame with data of many assets traded in the stock exchange: stocks, bdrs, funds, ETFs, equity options, forward contracts on equities and a few warrants due to some corporate events.

Value

a list with 3 data.frames: Header, HistoricalPrices, Trailer.

Examples

## Not run: 
# get all data to the year of 2001
df_2001 <- cotahist_get("2001-01-01", "yearly")
# get data of January of 2001
df_200101 <- cotahist_get("2001-01-01", "monthly")
# get data of 2001-01-02
df_daily <- cotahist_get("2001-01-02", "daily")

## End(Not run)


rb3 documentation built on April 14, 2023, 5:10 p.m.