boc_data: Fetch Bank of Canada (BoC) data

View source: R/boc.R

boc_dataR Documentation

Fetch Bank of Canada (BoC) data

Description

Retrieve time series data from the Bank of Canada Valet API.

Usage

boc_data(
  group_name = NULL,
  series_name = NULL,
  start_date = NULL,
  end_date = NULL
)

Arguments

group_name

(NULL | character(1))
Name of the group. Only one of group_name or series_name can be used.

series_name

(NULL | character())
Name of the series.

start_date

(NULL | Date(1) | character(1))
Start date of the data. Default NULL.

end_date

(NULL | Date(1) | character(1))
End date of the data. Default NULL.

Value

A data.table::data.table() with the requested data.

Source

https://www.bankofcanada.ca/valet/docs

See Also

Other data: bbk_data(), bbk_series(), bde_data(), bdf_codelist(), bdf_data(), bdf_dataset(), boe_data(), ecb_data(), onb_data(), snb_data()

Examples

## Not run: 
# fetch all data for a single group
dt <- boc_data(group_name = "FX_RATES_DAILY")
head(dt)

# or for multiple series ids
dt <- boc_data(
  series_name = c("FXUSDCAD", "FXEURCAD"),
  start_date = "2023-01-23",
  end_date = "2023-07-19"
)
head(dt)

## End(Not run)

bbk documentation built on Nov. 5, 2025, 6:07 p.m.