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-03-27 525.40
#>  2: 2026-03-30 529.66
#>  3: 2026-03-31 543.51
#>  4: 2026-04-01 549.34
#>  5: 2026-04-02 561.97
#>  6: 2026-04-03 552.46
#>  7: 2026-04-07 557.13
#>  8: 2026-04-08 555.24
#>  9: 2026-04-09 562.26
#> 10: 2026-04-10 554.60
# }