BNR exchange rates
v0.1.3Look up the National Bank of Romania's rate for any day, and convert amounts to and from RON.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
annual_average BNR annual average
BNR's annual average rate for a year, as ANAF converts foreign income in the D212 ("cursul de schimb mediu anual comunicat de BNR"): the mean of the twelve monthly averages, each the mean of the month's daily rates, to four places, with the monthly values and their day counts. Not the mean of the daily rates, which differs. A year not over yet answers the months so far with complete: false.
| Parameter | Type | Description |
|---|---|---|
currency * | string | ISO 4217 code: EUR, USD, GBP, CHF, ... (XAU gold, XDR SDR); case ignored. |
year * | integer | The calendar year, e.g. 2023. |
convert Convert to or from RON
An amount converted to or from RON at BNR's reference rate, computed exactly and rounded once: to RON is amount x rate / multiplier, from RON amount x multiplier / rate. rate_rule picks the fixing: in_force (the day's, or the last banking day's before it, as rate answers) or last_before (the last one strictly before the day, the rule for an invoice in a foreign currency). Answers the result with the rate, its multiplier and the date BNR published it, so the conversion can be stated. One side must be RON; for two other currencies, convert twice.
| Parameter | Type | Description |
|---|---|---|
amount * | string | The amount, as a decimal string: "1250.50", "-75". Never a number. |
from * | string | The amount's currency: RON, or the currency to convert to RON. ISO 4217; case ignored. |
to * | string | The currency wanted: RON, or the currency to convert RON to. ISO 4217; case ignored. |
date | string | The day of the conversion, YYYY-MM-DD in Bucharest (an invoice's date, a payment's); default today. |
places | integer | Digits after the point in the result. |
rate_rule | string | in_force: the rate in force on the day; last_before: the last rate published before the day. |
rounding | string | How the result is rounded, once: half-up (halves away from zero, as invoices round) or half-even (banker's). |
health Health
Whether BNR's rates can be read now: the date of its latest fixing and how many currencies it carries.
rate BNR rate on a day
The National Bank of Romania's reference rate in force on a day: RON per `multiplier` units of the currency (1, or 100 for HUF, JPY, KRW and a few others), as the exact text BNR published, with published_on, the date of the fixing it is. A weekend, a holiday, or today before BNR publishes (about 13:00 Bucharest) takes the last banking day's fixing. Use it for any EUR/RON or other conversion stated on a date.
| Parameter | Type | Description |
|---|---|---|
currency * | string | ISO 4217 code: EUR, USD, GBP, CHF, ... (XAU gold, XDR SDR); case ignored. |
date | string | The day, YYYY-MM-DD in Bucharest; default today. |
rates BNR rates: several currencies, or a window
BNR's reference rates as series, the exact text BNR published. With date (default today): each currency's rate in force that day, from the day's fixing or the last banking day's before it. With from (and to, default today): every fixing BNR published in the window, oldest first, at most 366 days and 2000 rates a call. Without currencies, every currency BNR published. Each series carries its multiplier (RON per 1, or per 100 for HUF, JPY, KRW and a few others).
| Parameter | Type | Description |
|---|---|---|
currencies | array | ISO 4217 codes, e.g. ["EUR", "USD"]; default every currency BNR published. |
date | string | One day, YYYY-MM-DD in Bucharest: the rates in force on it. Not with from. |
from | string | A window's first day, YYYY-MM-DD: every fixing from it to `to`. |
to | string | A window's last day, included; default today. Only with from. |