boz-exchange-rate 1.3.0 → 1.3.3
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 +63 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Bank of Zambia Exchange
|
|
1
|
+
# Bank of Zambia Exchange Rates API — boz-exchange-rate
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/boz-exchange-rate)
|
|
4
4
|
[](https://github.com/AllRates-Today/boz-exchange-rate/blob/main/LICENSE)
|
|
@@ -16,7 +16,22 @@
|
|
|
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 Bank of Zambia itself published, fixed once printed and carrying the central bank's own `rate_date` — what filings and audits require. Need the live
|
|
19
|
+
> **Official rate, not mid-market:** every value here is a number Bank of Zambia itself published, fixed once printed and carrying the central bank's own `rate_date` — what filings and audits require. Need the live mid-market rate 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
|
+
|
|
21
|
+
## ⚡ Try it without a key
|
|
22
|
+
|
|
23
|
+
The latest Bank of Zambia 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/boz?source=USD&target=ZMW"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const r = await fetch('https://allratestoday.com/api/open/central-bank/boz').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.
|
|
20
35
|
|
|
21
36
|
## 🔑 Get your API key
|
|
22
37
|
|
|
@@ -36,7 +51,7 @@ yarn add boz-exchange-rate
|
|
|
36
51
|
pnpm add boz-exchange-rate
|
|
37
52
|
```
|
|
38
53
|
|
|
39
|
-
Also published under the org scope as [`@allratestoday/boz-exchange-rate`](https://www.npmjs.com/package/@allratestoday/boz-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/boz-exchange-rate`](https://www.npmjs.com/package/@allratestoday/boz-exchange-rate) — same code, same versions.
|
|
40
55
|
|
|
41
56
|
## 🏁 Quick start
|
|
42
57
|
|
|
@@ -70,14 +85,14 @@ const pair = await getRate('USD', 'ZMW', { apiKey: 'art_live_...' });
|
|
|
70
85
|
{
|
|
71
86
|
bank: 'boz',
|
|
72
87
|
name: 'Bank of Zambia',
|
|
73
|
-
rate_date: '2026-09-
|
|
88
|
+
rate_date: '2026-09-25', // Bank of Zambia's own publication date
|
|
74
89
|
source: 'USD',
|
|
75
90
|
target: 'ZMW',
|
|
76
|
-
rate: 19.
|
|
91
|
+
rate: 19.5,
|
|
77
92
|
rate_type: 'middle',
|
|
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,11 +113,11 @@ console.log(table.rate_date, table.rates.length);
|
|
|
98
113
|
{
|
|
99
114
|
bank: 'boz',
|
|
100
115
|
name: 'Bank of Zambia',
|
|
101
|
-
rate_date: '2026-09-
|
|
116
|
+
rate_date: '2026-09-25',
|
|
102
117
|
rates: [
|
|
103
|
-
{ "base": "USD", "quote": "ZMW", "type": "middle", "value": 19.
|
|
104
|
-
{ "base": "USD", "quote": "ZMW", "type": "sell", "value": 19.
|
|
105
|
-
{ "base": "USD", "quote": "ZMW", "type": "buy", "value": 19.
|
|
118
|
+
{ "base": "USD", "quote": "ZMW", "type": "middle", "value": 19.5 },
|
|
119
|
+
{ "base": "USD", "quote": "ZMW", "type": "sell", "value": 19.525 },
|
|
120
|
+
{ "base": "USD", "quote": "ZMW", "type": "buy", "value": 19.475 },
|
|
106
121
|
// … the rest of the published table (2 currencies vs ZMW)
|
|
107
122
|
],
|
|
108
123
|
disclaimer: '…'
|
|
@@ -142,7 +157,7 @@ Paid plans. One resolved rate per publication date — ready for charting, reval
|
|
|
142
157
|
import { getHistory } from 'boz-exchange-rate';
|
|
143
158
|
|
|
144
159
|
const series = await getHistory(
|
|
145
|
-
{ source: 'USD', target: 'ZMW', from: '2026-01-01', to: '2026-09-
|
|
160
|
+
{ source: 'USD', target: 'ZMW', from: '2026-01-01', to: '2026-09-25' },
|
|
146
161
|
{ apiKey: 'art_live_...' }
|
|
147
162
|
);
|
|
148
163
|
```
|
|
@@ -155,11 +170,11 @@ const series = await getHistory(
|
|
|
155
170
|
source: 'USD',
|
|
156
171
|
target: 'ZMW',
|
|
157
172
|
from: '2026-01-01',
|
|
158
|
-
to: '2026-09-
|
|
173
|
+
to: '2026-09-25',
|
|
159
174
|
count: 152,
|
|
160
175
|
rates: [
|
|
161
176
|
// one entry per publication date
|
|
162
|
-
{ date: '2026-09-
|
|
177
|
+
{ date: '2026-09-25', rate: 19.5, rate_type: 'middle', derived: false, method: 'published' },
|
|
163
178
|
// …
|
|
164
179
|
],
|
|
165
180
|
disclaimer: '…'
|
|
@@ -176,6 +191,39 @@ Bank of Zambia currently publishes rates covering **2 currencies** against the Z
|
|
|
176
191
|
|
|
177
192
|
🇨🇳 `CNY` · 🇺🇸 `USD`
|
|
178
193
|
|
|
194
|
+
## 🏛️ Source
|
|
195
|
+
|
|
196
|
+
The Bank of Zambia publishes buying, middle and selling rates for the kwacha against the major currencies, updated across trading sessions during each business day; this feed stores the day's final print. As the central bank of one of the world's largest copper exporters, its kwacha reference anchors Zambian banking, mining-revenue conversion and customs valuation.
|
|
197
|
+
|
|
198
|
+
- Publisher's own page: [Daily FX rates](https://www.boz.zm) · [www.boz.zm](https://www.boz.zm)
|
|
199
|
+
- Publication: every business day; the exact schedule, freshness status and any current delay are on the [Bank of Zambia rates page](https://allratestoday.com/central-bank-rates-api/boz/)
|
|
200
|
+
- Values are stored unmodified, with the publisher's own `rate_date` on every row — see the [methodology](https://allratestoday.com/official-rates-methodology/)
|
|
201
|
+
|
|
202
|
+
## 🧭 Reading the numbers
|
|
203
|
+
|
|
204
|
+
- `value` is always **quote currency per 1 unit of base currency** (`base: "EUR", quote: "USD", value: 1.15` means 1 EUR = 1.15 USD).
|
|
205
|
+
- Bank of Zambia quotes **ZMW per 1 unit of foreign currency** (e.g. `base: "USD", quote: "ZMW"` means ZMW per one US dollar).
|
|
206
|
+
- 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.
|
|
207
|
+
- `rate_type` tells you which of the central bank's series a row belongs to (`middle` here); some publishers print buy/sell or several fixings for the same pair.
|
|
208
|
+
|
|
209
|
+
## 🧩 ERP & accounting systems
|
|
210
|
+
|
|
211
|
+
Loading the official Bank of Zambia rate into an accounting system is a supported workflow, not a hack. Step-by-step guides with the direction each system expects:
|
|
212
|
+
|
|
213
|
+
- [Dynamics 365 Business Central](https://allratestoday.com/docs/integrations/business-central/) — built-in Currency Exchange Rate Service, no code
|
|
214
|
+
- [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/)
|
|
215
|
+
|
|
216
|
+
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:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
curl "https://allratestoday.com/api/v1/central-bank/boz/latest?format=xml&api_key=art_live_..."
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## 🤖 AI agents
|
|
223
|
+
|
|
224
|
+
- 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
|
|
225
|
+
- Machine-readable site guide: [llms.txt](https://allratestoday.com/llms.txt) · [for-ai-agents](https://allratestoday.com/for-ai-agents/)
|
|
226
|
+
|
|
179
227
|
## ⚖️ Published vs derived rates
|
|
180
228
|
|
|
181
229
|
If Bank of Zambia does not print a pair directly, the API resolves it from the central bank's own table and says so — official and computed values are never confused:
|
|
@@ -250,7 +298,8 @@ Need the whole archive rather than an API call? The same published tables are mi
|
|
|
250
298
|
|
|
251
299
|
- [Bank of Zambia rates page](https://allratestoday.com/central-bank-rates-api/boz/) — live table, publication cadence, FAQ
|
|
252
300
|
- [All central bank sources](https://allratestoday.com/central-bank-rates-api/)
|
|
253
|
-
- [
|
|
301
|
+
- [Package docs on the site](https://allratestoday.com/docs/sdk/boz-exchange-rate/) · [ERP integration guides](https://allratestoday.com/docs/integrations/)
|
|
302
|
+
- [API documentation](https://allratestoday.com/docs/#central-bank) · [Interactive reference](https://allratestoday.com/api-reference/) · [Methodology](https://allratestoday.com/official-rates-methodology/)
|
|
254
303
|
- [Register (free)](https://allratestoday.com/register) · [Pricing](https://allratestoday.com/pricing/)
|
|
255
304
|
- [GitHub](https://github.com/AllRates-Today/boz-exchange-rate)
|
|
256
305
|
|
package/package.json
CHANGED