Skip to contents

Retrieve the price of gold from the NBP Web API.

Usage

nbp_gold(start_date = NULL, end_date = NULL, last_n = NULL)

Arguments

start_date

(NULL | character(1) | Date(1))
Start date of the data.

end_date

(NULL | character(1) | Date(1))
End date of the data.

last_n

(NULL | integer(1))
Return only the last n quotations.

Value

A data.table::data.table() with gold prices.

Examples

# \donttest{
nbp_gold(last_n = 10L)
#>           date  price
#>         <Date>  <num>
#>  1: 2026-04-17 556.80
#>  2: 2026-04-20 553.66
#>  3: 2026-04-21 555.09
#>  4: 2026-04-22 553.40
#>  5: 2026-04-23 551.74
#>  6: 2026-04-24 549.14
#>  7: 2026-04-27 547.28
#>  8: 2026-04-28 546.61
#>  9: 2026-04-29 540.11
#> 10: 2026-04-30 534.43
# }