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-06-16 509.74
#>  2: 2026-06-17 511.22
#>  3: 2026-06-18 507.97
#>  4: 2026-06-19 508.44
#>  5: 2026-06-22 498.01
#>  6: 2026-06-23 503.01
#>  7: 2026-06-24 495.56
#>  8: 2026-06-25 494.72
#>  9: 2026-06-26 483.68
#> 10: 2026-06-29 487.17
# }