% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/boj.R
\name{boj_data}
\alias{boj_data}
\title{Fetch Bank of Japan (BoJ) data}
\source{
\url{https://www.stat-search.boj.or.jp/index_en.html}
}
\usage{
boj_data(db, code, start_date = NULL, end_date = NULL, lang = "en")
}
\arguments{
\item{db}{(\code{character(1)})\cr
The database code to query (e.g., \code{"FM08"} for foreign exchange rates). See the
\href{https://www.stat-search.boj.or.jp/info/api_manual_en.pdf}{API manual} for available databases.}

\item{code}{(\code{character()})\cr
One or more series codes to query (e.g., \code{"FXERD01"} for USD/JPY spot rate). Maximum 250
codes per request. All codes must have the same frequency. Use \code{\link[=boj_metadata]{boj_metadata()}} to find
available codes.}

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

\item{end_date}{(\code{NULL} | \code{character(1)} | \code{integer(1)})\cr
End date of the data, in the same format as start_date. If \code{NULL}, data up to the latest
available date is returned. Default \code{NULL}.}

\item{lang}{(\code{character(1)})\cr
Language for series names, either \code{"en"} or \code{"jp"}. Default \code{"en"}.}
}
\value{
A \code{\link[data.table:data.table]{data.table::data.table()}} with the requested data.
}
\description{
Retrieve time series data from the Bank of Japan Statistics API.
}
\examples{
\dontshow{if (curl::has_internet()) withAutoprint(\{ # examplesIf}
\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")
}
\dontshow{\}) # examplesIf}
}
\seealso{
Other data:
\code{\link[=bbk_data]{bbk_data()}},
\code{\link[=bbk_series]{bbk_series()}},
\code{\link[=bde_data]{bde_data()}},
\code{\link[=bde_latest]{bde_latest()}},
\code{\link[=bdf_codelist]{bdf_codelist()}},
\code{\link[=bdf_data]{bdf_data()}},
\code{\link[=bdf_dataset]{bdf_dataset()}},
\code{\link[=bdp_data]{bdp_data()}},
\code{\link[=bis_data]{bis_data()}},
\code{\link[=boc_data]{boc_data()}},
\code{\link[=boe_data]{boe_data()}},
\code{\link[=ecb_data]{ecb_data()}},
\code{\link[=nbp_fx_rates]{nbp_fx_rates()}},
\code{\link[=nbp_gold]{nbp_gold()}},
\code{\link[=nob_data]{nob_data()}},
\code{\link[=onb_data]{onb_data()}},
\code{\link[=snb_data]{snb_data()}},
\code{\link[=srb_cross_rates]{srb_cross_rates()}},
\code{\link[=srb_data]{srb_data()}}
}
\concept{data}
