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

## Fetching collections of prices

Collections are just a bundle of tickers pre-organized in the package. For example, collection `SP500` represents the current composition of the SP500 index. 

The available collections are:

```{r}
available_collections <- yfR::yf_get_available_collections(
  print_description = TRUE
  )

available_collections
```

One can download the composition of the collection with `yf_collection_get`:

```{r, eval=FALSE}
library(yfR)

# be patient, it takes a while
df_yf <- yf_collection_get("SP500")

head(df_yf)
```