CLI tool for calling API of National Bank of Poland (NBP)
It gets exchange rate for given currency from tables (A, B, C) published by NBP by using NBP Web API.
Download binary from latest release, extract it and add to your $PATH.
To get latest average rate for EUR (table A):
nbp ex eur
To get buy/sell rate for EUR (table C) for given date:
nbp ex eur -t c -d 2020-01-10
NBP does not publish exchange rates every day, only on working days (tables A, C) and on working Wednesdays (table B). If you query for a date when rate was not published in a result you will get latest published rate before given date.
Table format (default):
[kuba@localhost ~]$ nbp ex eur
code EUR
currency euro
effectiveDate 2021-03-04
mid 4.554
no 043/A/NBP/2021
table A
JSON format:
[kuba@localhost ~]$ nbp ex eur -o json
{"code":"EUR","currency":"euro","effectiveDate":"2021-03-04","mid":4.554,"no":"043/A/NBP/2021","table":"A"}
To get single field with jq:
[kuba@localhost ~]$ nbp ex eur -o json | jq .mid
4.554