Skip to contents

Retrieve time series observations from the CNB ARAD database. ARAD is the CNB's full statistical database, covering monetary, financial-market, balance-of-payments, and government finance statistics. Access requires an API key, which can be generated from a free account at https://www.cnb.cz/arad/.

Usage

cnb_data(
  indicator_id = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  start_period = NULL,
  end_period = NULL,
  snapshot_id = NULL,
  api_key = cnb_arad_key()
)

Arguments

indicator_id

(NULL | character())
One or more indicator identifiers to retrieve (e.g. "SMV5M603"). Exactly one of indicator_id, set_id, base_id, or selection_id must be provided.

set_id

(NULL | character(1))
A set ("sestava") identifier, returning all of its indicators.

base_id

(NULL | character(1))
A base identifier, returning all of its indicators.

selection_id

(NULL | character(1))
The identifier of a named selection ("My selections") created in your ARAD account.

start_period

(NULL | character(1) | Date(1))
Start of the period to retrieve. If NULL, no start restriction is applied. Default NULL.

end_period

(NULL | character(1) | Date(1))
End of the period to retrieve, in the same format as start_period. Default NULL.

snapshot_id

(NULL | character())
One or more snapshot ids to retrieve historical vintages, or "ALL" for every snapshot. If NULL, the current (non-snapshot) data is returned. See cnb_snapshots(). Default NULL.

api_key

(character(1))
API key to use for the request. Defaults to the value returned by cnb_arad_key(), which reads from the CNB_ARAD_KEY environment variable.

Value

A data.table::data.table() with columns:

date

The observation period

indicator_id

The indicator identifier

snapshot_id

The snapshot identifier, or NA for non-snapshot data

value

The observation value

Examples

if (FALSE) { # \dontrun{
# a single indicator over 24 months
cnb_data("SMV5M603", start_period = "2023-01-01")

# every indicator in a set
cnb_data(set_id = "1058")
} # }