Package 'valet'

Title: Provide R Client to the Bank of Canada's Valet API
Description: The Bank of Canada updated their Valet API <https://www.bankofcanada.ca/valet/docs>, and no R client currently exists. This provides access to all of Valet's endpoints and serves responses in wide format easy for researchers to handle but also provides tools to access API responses as a list.
Authors: Corey Runkel [aut, cre]
Maintainer: Corey Runkel <[email protected]>
License: MIT + file LICENSE
Version: 0.9.0
Built: 2024-11-05 03:41:49 UTC
Source: https://github.com/runkelcorey/valet

Help Index


Get series or series-group details

Description

get_details returns metadata from a Bank of Canada series or series group.

Usage

get_details(name = NULL, group = FALSE)

Arguments

name

A character of length 1 indicating the series or series group for which information should be retrieved.

group

A Boolean indicating whether the name is a series or a series group.

Value

A list of series or group details.

Examples

get_details("CES_C4E_LOSE_JOB_SK")
## Not run: 
get_details("BAPF_TRANSACTION_DATA")

## End(Not run)
get_details("BAPF_TRANSACTION_DATA", group = TRUE)

Get series-group observations

Description

get_group returns observations from a Bank of Canada series group.

Usage

get_group(name = NULL, ...)

Arguments

name

A character of length 1 indicating the series group to retrieve.

...

Additional query parameters. Possible values are start_date and/or end_date (both character), or one of recent, recent_weeks, recent_months, or recent_years (all numeric).

Details

Valet, the server-side API, does not always return observations filtered by ... arguments for series groups, even if it will accept the request.

Value

A tibble.

Examples

get_group("BAPF_TRANSACTION_DATA")
get_group("gbpp")

## Not run: 
#this is a series
get_group("FXCADAUD")

## End(Not run)

List possible series or groups.

Description

get_list returns metadata about all Bank of Canada series or series groups.

Usage

get_list(type = c("series", "groups"))

Arguments

type

Either series or groups.

Value

A tibble of series or group information.


Get series observations

Description

get_series returns observations from one or more Bank of Canada series, subject to some date filtering.

Usage

get_series(name = NULL, ...)

Arguments

name

A character of at least length 1 indicating the series to retrieve.

...

Additional query parameters. Possible values are start_date and/or end_date (both character), or one of recent, recent_weeks, recent_months, or recent_years (all numeric).

Value

A tibble of size length(name)+1length(name) + 1.

Examples

get_series("FXCADAUD")

## Not run: 
#this is a group
get_series("BAPF")

## End(Not run)

Retrieve Valet response

Description

valet is the core back-end to get responses from the Bank of Canada API.

Usage

valet(name = NULL, group = FALSE, ...)

Arguments

name

A character of at least length 1 indicating the series or series group to retrieve.

group

Boolean indicating whether the name is a series or a series group.

...

Query parameters from other methods.

Value

A valet object.

Examples

valet(name = "GBPP", group = TRUE, recent_weeks = 2)