bnr-exchange-rate 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# National Bank of Romania Exchange
|
|
1
|
+
# National Bank of Romania Exchange Rates API — bnr-exchange-rate
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/bnr-exchange-rate)
|
|
4
4
|
[](https://github.com/AllRates-Today/bnr-exchange-rate/blob/main/LICENSE)
|
|
@@ -18,6 +18,21 @@
|
|
|
18
18
|
|
|
19
19
|
> **Official rate, not mid-market:** every value here is a number National Bank of Romania itself published, fixed once printed and carrying the central bank's own `rate_date` — what filings and audits require. Need the live interbank midpoint for pricing or display instead? Use the [mid-market API](https://allratestoday.com/docs/) or [`@allratestoday/sdk`](https://www.npmjs.com/package/@allratestoday/sdk). The two can diverge by several percent.
|
|
20
20
|
|
|
21
|
+
## ⚡ Try it without a key
|
|
22
|
+
|
|
23
|
+
The latest National Bank of Romania table is also served keyless, CORS-open and edge-cached, for evaluation, embeds and AI agents:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
curl "https://allratestoday.com/api/open/central-bank/bnr?source=EUR&target=RON"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const r = await fetch('https://allratestoday.com/api/open/central-bank/bnr').then((x) => x.json());
|
|
31
|
+
console.log(r.rate_date, r.rates.length); // the central bank's latest published table, no key
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The open endpoint serves the *latest* table only and asks for a visible attribution link. The client below uses the keyed API, which adds point-in-time tables, history, and CSV/XML/Excel output.
|
|
35
|
+
|
|
21
36
|
## 🔑 Get your API key
|
|
22
37
|
|
|
23
38
|
Get a free API key at [allratestoday.com/register](https://allratestoday.com/register) — no credit card required. Latest rates are on every plan, including free.
|
|
@@ -36,7 +51,7 @@ yarn add bnr-exchange-rate
|
|
|
36
51
|
pnpm add bnr-exchange-rate
|
|
37
52
|
```
|
|
38
53
|
|
|
39
|
-
Also published under the org scope as [`@allratestoday/bnr-exchange-rate`](https://www.npmjs.com/package/@allratestoday/bnr-exchange-rate) — same code, same versions.
|
|
54
|
+
Requires Node 18+ (global `fetch`); also runs on Bun, Deno and edge runtimes. Also published under the org scope as [`@allratestoday/bnr-exchange-rate`](https://www.npmjs.com/package/@allratestoday/bnr-exchange-rate) — same code, same versions.
|
|
40
55
|
|
|
41
56
|
## 🏁 Quick start
|
|
42
57
|
|
|
@@ -70,14 +85,14 @@ const pair = await getRate('EUR', 'RON', { apiKey: 'art_live_...' });
|
|
|
70
85
|
{
|
|
71
86
|
bank: 'bnr',
|
|
72
87
|
name: 'National Bank of Romania',
|
|
73
|
-
rate_date: '2026-
|
|
88
|
+
rate_date: '2026-09-09', // National Bank of Romania's own publication date
|
|
74
89
|
source: 'EUR',
|
|
75
90
|
target: 'RON',
|
|
76
|
-
rate: 5.
|
|
91
|
+
rate: 5.2542,
|
|
77
92
|
rate_type: 'reference',
|
|
78
93
|
derived: false,
|
|
79
94
|
method: 'published',
|
|
80
|
-
disclaimer: '
|
|
95
|
+
disclaimer: 'Official rates as published by the named central bank. On weekends/holidays the most recent published rate_date is returned.'
|
|
81
96
|
}
|
|
82
97
|
```
|
|
83
98
|
|
|
@@ -98,9 +113,9 @@ console.log(table.rate_date, table.rates.length);
|
|
|
98
113
|
{
|
|
99
114
|
bank: 'bnr',
|
|
100
115
|
name: 'National Bank of Romania',
|
|
101
|
-
rate_date: '2026-
|
|
116
|
+
rate_date: '2026-09-09',
|
|
102
117
|
rates: [
|
|
103
|
-
{ "base": "EUR", "quote": "RON", "type": "reference", "value": 5.
|
|
118
|
+
{ "base": "EUR", "quote": "RON", "type": "reference", "value": 5.2542 },
|
|
104
119
|
// … the rest of the published table (37 currencies vs RON)
|
|
105
120
|
],
|
|
106
121
|
disclaimer: '…'
|
|
@@ -140,7 +155,7 @@ Paid plans. One resolved rate per publication date — ready for charting, reval
|
|
|
140
155
|
import { getHistory } from 'bnr-exchange-rate';
|
|
141
156
|
|
|
142
157
|
const series = await getHistory(
|
|
143
|
-
{ source: 'EUR', target: 'RON', from: '2026-01-01', to: '2026-
|
|
158
|
+
{ source: 'EUR', target: 'RON', from: '2026-01-01', to: '2026-09-09' },
|
|
144
159
|
{ apiKey: 'art_live_...' }
|
|
145
160
|
);
|
|
146
161
|
```
|
|
@@ -153,11 +168,11 @@ const series = await getHistory(
|
|
|
153
168
|
source: 'EUR',
|
|
154
169
|
target: 'RON',
|
|
155
170
|
from: '2026-01-01',
|
|
156
|
-
to: '2026-
|
|
171
|
+
to: '2026-09-09',
|
|
157
172
|
count: 152,
|
|
158
173
|
rates: [
|
|
159
174
|
// one entry per publication date
|
|
160
|
-
{ date: '2026-
|
|
175
|
+
{ date: '2026-09-09', rate: 5.2542, rate_type: 'reference', derived: false, method: 'published' },
|
|
161
176
|
// …
|
|
162
177
|
],
|
|
163
178
|
disclaimer: '…'
|
|
@@ -170,9 +185,43 @@ Pass `{ symbol: 'EUR' }` instead of `source`/`target` to get the raw published r
|
|
|
170
185
|
|
|
171
186
|
## 🗺️ Currencies covered
|
|
172
187
|
|
|
173
|
-
National Bank of Romania currently publishes rates covering **
|
|
188
|
+
National Bank of Romania currently publishes rates covering **37 currencies** against the RON (as of the latest table):
|
|
189
|
+
|
|
190
|
+
🇦🇪 `AED` · 🇦🇺 `AUD` · 🇧🇷 `BRL` · 🇨🇦 `CAD` · 🇨🇭 `CHF` · 🇨🇳 `CNY` · 🇨🇿 `CZK` · 🇩🇰 `DKK` · 🇪🇬 `EGP` · 🇪🇺 `EUR` · 🇬🇧 `GBP` · 🇭🇰 `HKD` · 🇭🇺 `HUF` · 🇮🇩 `IDR` · 🇮🇱 `ILS` · 🇮🇳 `INR` · 🇮🇸 `ISK` · 🇯🇵 `JPY` · 🇰🇷 `KRW` · 🇲🇩 `MDL` · 🇲🇽 `MXN` · 🇲🇾 `MYR` · 🇳🇴 `NOK` · 🇳🇿 `NZD` · 🇵🇭 `PHP` · 🇵🇱 `PLN` · 🇷🇸 `RSD` · 🇷🇺 `RUB` · 🇸🇪 `SEK` · 🇸🇬 `SGD` · 🇹🇭 `THB` · 🇹🇷 `TRY` · 🇺🇦 `UAH` · 🇺🇸 `USD` · `XAU` · `XDR` · 🇿🇦 `ZAR`
|
|
191
|
+
|
|
192
|
+
## 🏛️ Source
|
|
193
|
+
|
|
194
|
+
The National Bank of Romania announces the leu's official reference rates for around 37 currencies each business day at about 13:00 Bucharest time — the rate Romanian accounting, tax, and customs rules reference for leu conversion.
|
|
195
|
+
|
|
196
|
+
- Publisher's own page: [Exchange rates — XML feeds](https://www.bnr.ro/en/24006-exchange-rate-list-in-xml-format) · [www.bnr.ro/en](https://www.bnr.ro/en)
|
|
197
|
+
- Publication: every business day; the exact schedule, freshness status and any current delay are on the [National Bank of Romania rates page](https://allratestoday.com/central-bank-rates-api/bnr/)
|
|
198
|
+
- Values are stored unmodified, with the publisher's own `rate_date` on every row — see the [methodology](https://allratestoday.com/official-rates-methodology/)
|
|
174
199
|
|
|
175
|
-
|
|
200
|
+
## 🧭 Reading the numbers
|
|
201
|
+
|
|
202
|
+
- `value` is always **quote currency per 1 unit of base currency** (`base: "EUR", quote: "USD", value: 1.15` means 1 EUR = 1.15 USD).
|
|
203
|
+
- National Bank of Romania quotes **RON per 1 unit of foreign currency** (e.g. `base: "USD", quote: "RON"` means RON per one US dollar).
|
|
204
|
+
- Need the other way round? Ask `getRate(target, source)` and the API inverts or crosses for you, flagged `derived: true` — never divide a published rate yourself in a compliance workflow.
|
|
205
|
+
- Precious-metal codes (`XAU`, `XAG`, `XPT`, `XPD`) are quoted **per troy ounce**.
|
|
206
|
+
- `rate_type` tells you which of the central bank's series a row belongs to (`reference` here); some publishers print buy/sell or several fixings for the same pair.
|
|
207
|
+
|
|
208
|
+
## 🧩 ERP & accounting systems
|
|
209
|
+
|
|
210
|
+
Loading the official National Bank of Romania rate into an accounting system is a supported workflow, not a hack. Step-by-step guides with the direction each system expects:
|
|
211
|
+
|
|
212
|
+
- [Dynamics 365 Business Central](https://allratestoday.com/docs/integrations/business-central/) — built-in Currency Exchange Rate Service, no code
|
|
213
|
+
- [Xero](https://allratestoday.com/docs/integrations/xero/) · [QuickBooks Online](https://allratestoday.com/docs/integrations/quickbooks/) · [SAP S/4HANA and ECC](https://allratestoday.com/docs/integrations/sap/) · [Odoo](https://allratestoday.com/docs/integrations/odoo/)
|
|
214
|
+
|
|
215
|
+
The same keyed endpoints return `?format=csv`, `?format=xml` and `?format=xlsx`, and accept the key as `?api_key=` on the URL for importers that cannot send headers:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
curl "https://allratestoday.com/api/v1/central-bank/bnr/latest?format=xml&api_key=art_live_..."
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## 🤖 AI agents
|
|
222
|
+
|
|
223
|
+
- MCP server: `npx -y @allratestoday/central-bank-mcp` (stdio) or the hosted endpoint `https://allratestoday.com/api/mcp` — tools for official rates, history, cross-bank comparison and publication calendars
|
|
224
|
+
- Machine-readable site guide: [llms.txt](https://allratestoday.com/llms.txt) · [for-ai-agents](https://allratestoday.com/for-ai-agents/)
|
|
176
225
|
|
|
177
226
|
## ⚖️ Published vs derived rates
|
|
178
227
|
|
|
@@ -236,11 +285,20 @@ getRate('EUR', 'RON', { apiKey: 'art_live_...' }).then((pair) => console.log(pai
|
|
|
236
285
|
| `getRatesForDate(date, { apiKey, source?, target? })` | Paid | The official table (or one pair) for a YYYY-MM-DD date |
|
|
237
286
|
| `getHistory({ symbol \| source+target, from?, to? }, { apiKey })` | Paid | Daily series since 2005 |
|
|
238
287
|
|
|
288
|
+
## 📥 Bulk data (no key)
|
|
289
|
+
|
|
290
|
+
Need the whole archive rather than an API call? The same published tables are mirrored daily as open data:
|
|
291
|
+
|
|
292
|
+
- Hugging Face: [AllRates/central-bank-exchange-rates](https://huggingface.co/datasets/AllRates/central-bank-exchange-rates) — one CSV per institution (`rates/bnr.csv`)
|
|
293
|
+
- Kaggle: [allratestoday/central-bank-exchange-rates](https://www.kaggle.com/datasets/allratestoday/central-bank-exchange-rates)
|
|
294
|
+
- CDN JSON: `https://cdn.jsdelivr.net/gh/AllRates-Today/central-bank-exchange-rates@main/data/bnr/latest.json`
|
|
295
|
+
|
|
239
296
|
## 🔗 Links
|
|
240
297
|
|
|
241
298
|
- [National Bank of Romania rates page](https://allratestoday.com/central-bank-rates-api/bnr/) — live table, publication cadence, FAQ
|
|
242
299
|
- [All central bank sources](https://allratestoday.com/central-bank-rates-api/)
|
|
243
|
-
- [
|
|
300
|
+
- [Package docs on the site](https://allratestoday.com/docs/sdk/bnr-exchange-rate/) · [ERP integration guides](https://allratestoday.com/docs/integrations/)
|
|
301
|
+
- [API documentation](https://allratestoday.com/docs/#central-bank) · [Interactive reference](https://allratestoday.com/api-reference/) · [Methodology](https://allratestoday.com/official-rates-methodology/)
|
|
244
302
|
- [Register (free)](https://allratestoday.com/register) · [Pricing](https://allratestoday.com/pricing/)
|
|
245
303
|
- [GitHub](https://github.com/AllRates-Today/bnr-exchange-rate)
|
|
246
304
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bnr-exchange-rate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Official National Bank of Romania (Romania) daily exchange rates — 37 currencies vs RON, history since 2005. Zero-dependency Node.js/TypeScript client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bnr",
|