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-05-11 544.92
#>  2: 2026-05-12 540.25
#>  3: 2026-05-13 546.81
#>  4: 2026-05-14 549.04
#>  5: 2026-05-15 546.22
#>  6: 2026-05-18 534.69
#>  7: 2026-05-19 533.10
#>  8: 2026-05-20 532.49
#>  9: 2026-05-21 529.09
#> 10: 2026-05-22 532.19
# }