Learn R Programming

bbk (version 0.11.0)

boj_data: Fetch Bank of Japan (BoJ) data

Description

Retrieve time series data from the Bank of Japan Statistics API.

Usage

boj_data(db, code, start_date = NULL, end_date = NULL, lang = "en")

Value

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

Arguments

db

(character(1))
The database code to query (e.g., "FM08" for foreign exchange rates). See the API manual for available databases.

code

(character())
One or more series codes to query (e.g., "FXERD01" for USD/JPY spot rate). Maximum 250 codes per request. All codes must have the same frequency. Use boj_metadata() to find available codes.

start_date

(NULL | character(1) | integer(1))
Start date of the data. Format depends on frequency: "YYYYMMDD" or YYYY for daily, "YYYYMM" for monthly, "YYYYQQ" for quarterly (where QQ is 01-04), "YYYY" for annual. If NULL, all available data is returned. Default NULL.

end_date

(NULL | character(1) | integer(1))
End date of the data, in the same format as start_date. If NULL, data up to the latest available date is returned. Default NULL.

lang

(character(1))
Language for series names, either "en" or "jp". Default "en".

See Also

Other data: bbk_data(), bbk_series(), bde_data(), bde_latest(), bdf_codelist(), bdf_data(), bdf_dataset(), bdp_data(), bis_data(), boc_data(), boe_data(), cnb_czeonia(), cnb_data(), cnb_fx_other_rates(), cnb_fx_rates(), cnb_pribor(), ecb_data(), nbp_fx_rates(), nbp_gold(), nob_data(), onb_data(), snb_data(), srb_cross_rates(), srb_data()

Examples

Run this code
# \donttest{
# fetch USD/JPY exchange rate
boj_data("FM08", "FXERD01", start_date = "202401")

# fetch multiple exchange rates
boj_data("FM08", c("FXERD01", "FXERD02"), start_date = "202401")
# }

Run the code above in your browser using DataLab