Retrieve the price of gold from the NBP Web API.
Arguments
- start_date
(
NULL|character(1)|Date(1))
Start date of the data. Ifend_dateis omitted, onlystart_dateis returned. The API limits the range to 367 days.- end_date
(
NULL|character(1)|Date(1))
End date of the data. Requiresstart_date. IfNULL, defaults tostart_date.- last_n
(
NULL|integer(1))
Return only the lastnquotations.
Value
A data.table::data.table() with gold prices.
See also
Other data:
banxico_data(),
bbk_data(),
bbk_series(),
bcb_data(),
bcb_expectations(),
bcb_fx_rates(),
bcb_inflation(),
bcb_selic(),
bcb_top5(),
bde_data(),
bde_latest(),
bdf_codelist(),
bdf_data(),
bdf_dataset(),
bdp_data(),
bis_data(),
boc_data(),
boe_data(),
boi_data(),
boj_data(),
cnb_czeonia(),
cnb_data(),
cnb_fx_other_rates(),
cnb_fx_rates(),
cnb_pribor(),
ecb_data(),
nbb_data(),
nbp_fx_rates(),
nob_data(),
onb_data(),
snb_data(),
srb_cross_rates(),
srb_data()
Examples
# \donttest{
nbp_gold(last_n = 10L)
#> date price
#> <Date> <num>
#> 1: 2026-09-28 530.05
#> 2: 2026-09-29 512.64
#> 3: 2026-09-30 512.85
#> 4: 2026-10-01 518.14
#> 5: 2026-10-02 517.55
#> 6: 2026-10-05 523.03
#> 7: 2026-10-06 523.96
#> 8: 2026-10-07 519.24
#> 9: 2026-10-08 518.49
#> 10: 2026-10-09 519.09
# }