cbn-exchange-rate 1.2.0 β 1.3.0
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 +21 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
- π· **Type-safe** β full TypeScript definitions shipped with the package
|
|
17
17
|
- π§Ύ **Compliance-grade metadata** β `rate_type`, publication date, and source disclaimer on every response
|
|
18
18
|
|
|
19
|
+
> **Official rate, not mid-market:** every value here is a number Central Bank of Nigeria 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
|
+
|
|
19
21
|
## π Get your API key
|
|
20
22
|
|
|
21
23
|
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.
|
|
@@ -68,10 +70,10 @@ const pair = await getRate('USD', 'NGN', { apiKey: 'art_live_...' });
|
|
|
68
70
|
{
|
|
69
71
|
bank: 'cbn',
|
|
70
72
|
name: 'Central Bank of Nigeria',
|
|
71
|
-
rate_date: '2026-
|
|
73
|
+
rate_date: '2026-09-09', // Central Bank of Nigeria's own publication date
|
|
72
74
|
source: 'USD',
|
|
73
75
|
target: 'NGN',
|
|
74
|
-
rate:
|
|
76
|
+
rate: 1328.7129,
|
|
75
77
|
rate_type: 'middle',
|
|
76
78
|
derived: false,
|
|
77
79
|
method: 'published',
|
|
@@ -96,11 +98,11 @@ console.log(table.rate_date, table.rates.length);
|
|
|
96
98
|
{
|
|
97
99
|
bank: 'cbn',
|
|
98
100
|
name: 'Central Bank of Nigeria',
|
|
99
|
-
rate_date: '2026-
|
|
101
|
+
rate_date: '2026-09-09',
|
|
100
102
|
rates: [
|
|
101
|
-
{ "base": "USD", "quote": "NGN", "type": "middle", "value":
|
|
102
|
-
{ "base": "USD", "quote": "NGN", "type": "sell", "value":
|
|
103
|
-
{ "base": "USD", "quote": "NGN", "type": "buy", "value":
|
|
103
|
+
{ "base": "USD", "quote": "NGN", "type": "middle", "value": 1328.7129 },
|
|
104
|
+
{ "base": "USD", "quote": "NGN", "type": "sell", "value": 1329.2129 },
|
|
105
|
+
{ "base": "USD", "quote": "NGN", "type": "buy", "value": 1328.2129 },
|
|
104
106
|
// β¦ the rest of the published table (13 currencies vs NGN)
|
|
105
107
|
],
|
|
106
108
|
disclaimer: 'β¦'
|
|
@@ -140,7 +142,7 @@ Paid plans. One resolved rate per publication date β ready for charting, reval
|
|
|
140
142
|
import { getHistory } from 'cbn-exchange-rate';
|
|
141
143
|
|
|
142
144
|
const series = await getHistory(
|
|
143
|
-
{ source: 'USD', target: 'NGN', from: '2026-01-01', to: '2026-
|
|
145
|
+
{ source: 'USD', target: 'NGN', from: '2026-01-01', to: '2026-09-09' },
|
|
144
146
|
{ apiKey: 'art_live_...' }
|
|
145
147
|
);
|
|
146
148
|
```
|
|
@@ -153,11 +155,11 @@ const series = await getHistory(
|
|
|
153
155
|
source: 'USD',
|
|
154
156
|
target: 'NGN',
|
|
155
157
|
from: '2026-01-01',
|
|
156
|
-
to: '2026-
|
|
158
|
+
to: '2026-09-09',
|
|
157
159
|
count: 152,
|
|
158
160
|
rates: [
|
|
159
161
|
// one entry per publication date
|
|
160
|
-
{ date: '2026-
|
|
162
|
+
{ date: '2026-09-09', rate: 1328.7129, rate_type: 'middle', derived: false, method: 'published' },
|
|
161
163
|
// β¦
|
|
162
164
|
],
|
|
163
165
|
disclaimer: 'β¦'
|
|
@@ -170,9 +172,9 @@ Pass `{ symbol: 'USD' }` instead of `source`/`target` to get the raw published r
|
|
|
170
172
|
|
|
171
173
|
## πΊοΈ Currencies covered
|
|
172
174
|
|
|
173
|
-
Central Bank of Nigeria currently publishes rates covering **
|
|
175
|
+
Central Bank of Nigeria currently publishes rates covering **13 currencies** against the NGN (as of the latest table):
|
|
174
176
|
|
|
175
|
-
`AED` Β· `CHF` Β· `CNY` Β· `DKK` Β· `EUR` Β· `GBP` Β· `JPY` Β·
|
|
177
|
+
π¦πͺ `AED` Β· π¨π `CHF` Β· π¨π³ `CNY` Β· π©π° `DKK` Β· πͺπΊ `EUR` Β· π¬π§ `GBP` Β· π―π΅ `JPY` Β· πΈπ¦ `SAR` Β· πΊπΈ `USD` Β· `XDR` Β· `XOF` Β· `XUA` Β· πΏπ¦ `ZAR`
|
|
176
178
|
|
|
177
179
|
## βοΈ Published vs derived rates
|
|
178
180
|
|
|
@@ -236,6 +238,14 @@ getRate('USD', 'NGN', { apiKey: 'art_live_...' }).then((pair) => console.log(pai
|
|
|
236
238
|
| `getRatesForDate(date, { apiKey, source?, target? })` | Paid | The official table (or one pair) for a YYYY-MM-DD date |
|
|
237
239
|
| `getHistory({ symbol \| source+target, from?, to? }, { apiKey })` | Paid | Daily series since 2001 |
|
|
238
240
|
|
|
241
|
+
## π₯ Bulk data (no key)
|
|
242
|
+
|
|
243
|
+
Need the whole archive rather than an API call? The same published tables are mirrored daily as open data:
|
|
244
|
+
|
|
245
|
+
- Hugging Face: [AllRates/central-bank-exchange-rates](https://huggingface.co/datasets/AllRates/central-bank-exchange-rates) β one CSV per institution (`rates/cbn.csv`)
|
|
246
|
+
- Kaggle: [allratestoday/central-bank-exchange-rates](https://www.kaggle.com/datasets/allratestoday/central-bank-exchange-rates)
|
|
247
|
+
- CDN JSON: `https://cdn.jsdelivr.net/gh/AllRates-Today/central-bank-exchange-rates@main/data/cbn/latest.json`
|
|
248
|
+
|
|
239
249
|
## π Links
|
|
240
250
|
|
|
241
251
|
- [Central Bank of Nigeria rates page](https://allratestoday.com/central-bank-rates-api/cbn/) β live table, publication cadence, FAQ
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cbn-exchange-rate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Official Central Bank of Nigeria (Nigeria) daily exchange rates β 13 currencies vs NGN, history since 2001. Zero-dependency Node.js/TypeScript client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cbn",
|