View source: R/fetch-marketdata.R
fetch_marketdata | R Documentation |
Downloads market data based on a template and parameter combinations, then reads the data into a database.
fetch_marketdata(
template,
force_download = FALSE,
reprocess = FALSE,
throttle = FALSE,
...
)
template |
A character string specifying the market data template to use |
force_download |
A logical value indicating whether to force downloading files
even if they already exist in the cache (default is |
reprocess |
A logical value indicating whether to reprocess files even if they
are already processed (default is |
throttle |
A logical value indicating whether to throttle the download requests
(default is |
... |
Named arguments that will be expanded into a grid of all combinations to fetch data for |
This function performs three main steps:
Downloads market data files by creating all combinations of the provided parameters.
Processes the downloaded files by reading them into the input layer of the database.
Creates the staging layer if configured in the template.
Progress indicators are displayed during both steps, and warnings are shown for combinations that failed to download or produced invalid files.
The throttle
parameter is useful for avoiding server overload and ensuring
that the requests are sent at a reasonable rate. If set to TRUE
, a 1-second
delay is introduced between each download request.
The force_download
parameter allows you to re-download files even if they already exist
in the cache. This can be useful if you want to ensure that you have the latest version
of the data or if the files have been modified on the server.
The reprocess
parameter allows you to reprocess files even if they have already been processed.
This can be useful if you want to ensure that the data is up-to-date.
## Not run:
fetch_marketdata("b3-cotahist-yearly", year = 2020:2024)
fetch_marketdata("b3-cotahist-daily", refdate = bizseq("2025-01-01", "2025-03-10", "Brazil/B3"))
fetch_marketdata("b3-reference-rates",
refdate = bizseq("2025-01-01", "2025-03-10", "Brazil/B3"),
curve_name = c("DIC", "DOC", "PRE")
)
fetch_marketdata("b3-indexes-historical-data",
throttle = TRUE, index = c("IBOV", "IBXX", "IBXL"),
year = 2000:2025
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.