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-29 514.16
#>  2: 2026-06-01 528.20
#>  3: 2026-06-02 525.10
#>  4: 2026-06-03 529.05
#>  5: 2026-06-05 522.16
#>  6: 2026-06-08 522.08
#>  7: 2026-06-09 508.68
#>  8: 2026-06-10 510.02
#>  9: 2026-06-11 492.71
#> 10: 2026-06-12 484.21
# }