snb-exchange-rate 1.3.18 → 1.3.20
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 +17 -49
- package/package.json +13 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://allratestoday.com/central-bank-rates-api/snb/)
|
|
8
8
|
[](https://allratestoday.com/central-bank-rates-api/snb/)
|
|
9
9
|
|
|
10
|
-
**Official Swiss National Bank (Switzerland)
|
|
10
|
+
**Official Swiss National Bank (Switzerland) daily exchange rates for Node.js and TypeScript. The published central bank rates behind tax filings, customs valuations, audits, and compliant invoicing — not market estimates, but the numbers Swiss National Bank itself prints, every business day.**
|
|
11
11
|
|
|
12
12
|
## 🚀 Why this client?
|
|
13
13
|
|
|
@@ -46,41 +46,7 @@ The open endpoint serves the *latest* table only (JSON by default; add `?format=
|
|
|
46
46
|
The image is rendered live from the keyless endpoint above, so it follows the central bank's publications on npm and on GitHub alike without a new release. The same table as text is folded below for search and copy-paste: on GitHub [a daily Action](.github/workflows/daily-table.yml) refreshes it whenever the central bank publishes a new table; on npm it is as of the package's publish date.
|
|
47
47
|
|
|
48
48
|
<!-- daily-table:start -->
|
|
49
|
-
|
|
50
|
-
<summary>Table as text: published 2026-09-30 by Swiss National Bank — 26 rates. Updated 2026-10-26.</summary>
|
|
51
|
-
|
|
52
|
-
| Base | Quote | Type | Rate |
|
|
53
|
-
| --- | --- | --- | ---: |
|
|
54
|
-
| ARS | CHF | monthly_average | 0.00054 |
|
|
55
|
-
| AUD | CHF | monthly_average | 0.58343 |
|
|
56
|
-
| BRL | CHF | monthly_average | 0.1593254 |
|
|
57
|
-
| CAD | CHF | monthly_average | 0.58688 |
|
|
58
|
-
| CNY | CHF | monthly_average | 0.1221011 |
|
|
59
|
-
| CZK | CHF | monthly_average | 0.0388224 |
|
|
60
|
-
| DKK | CHF | monthly_average | 0.1261671 |
|
|
61
|
-
| EUR | CHF | monthly_average | 0.94312 |
|
|
62
|
-
| GBP | CHF | monthly_average | 1.0993 |
|
|
63
|
-
| HKD | CHF | monthly_average | 0.1044552 |
|
|
64
|
-
| HUF | CHF | monthly_average | 0.0025839 |
|
|
65
|
-
| JPY | CHF | monthly_average | 0.0052383 |
|
|
66
|
-
| KRW | CHF | monthly_average | 0.0006029 |
|
|
67
|
-
| MXN | CHF | monthly_average | 0.0475407 |
|
|
68
|
-
| MYR | CHF | monthly_average | 0.2013008 |
|
|
69
|
-
| NOK | CHF | monthly_average | 0.0873072 |
|
|
70
|
-
| NZD | CHF | monthly_average | 0.47256 |
|
|
71
|
-
| PLN | CHF | monthly_average | 0.2170834 |
|
|
72
|
-
| RUB | CHF | monthly_average | 0.00964 |
|
|
73
|
-
| SEK | CHF | monthly_average | 0.0839625 |
|
|
74
|
-
| SGD | CHF | monthly_average | 0.64366 |
|
|
75
|
-
| THB | CHF | monthly_average | 0.0246599 |
|
|
76
|
-
| TRY | CHF | monthly_average | 0.0168369 |
|
|
77
|
-
| USD | CHF | monthly_average | 0.81926 |
|
|
78
|
-
| XDR | CHF | monthly_average | 1.11928 |
|
|
79
|
-
| ZAR | CHF | monthly_average | 0.05052 |
|
|
80
|
-
|
|
81
|
-
</details>
|
|
82
|
-
|
|
83
|
-
Source: [Official rates published by SNB, served by AllRatesToday](https://allratestoday.com/central-bank-rates-api/snb/). Rates are as printed by the central bank; AllRatesToday is not affiliated with it.
|
|
49
|
+
_The table is filled in by the daily workflow._
|
|
84
50
|
<!-- daily-table:end -->
|
|
85
51
|
|
|
86
52
|
## 📦 Installation
|
|
@@ -131,11 +97,11 @@ const pair = await getRate('EUR', 'CHF', { apiKey: 'art_live_...' });
|
|
|
131
97
|
{
|
|
132
98
|
bank: 'snb',
|
|
133
99
|
name: 'Swiss National Bank',
|
|
134
|
-
rate_date: '2026-
|
|
100
|
+
rate_date: '2026-10-27', // Swiss National Bank's own publication date
|
|
135
101
|
source: 'EUR',
|
|
136
102
|
target: 'CHF',
|
|
137
|
-
rate: 0.
|
|
138
|
-
rate_type: '
|
|
103
|
+
rate: 0.9233,
|
|
104
|
+
rate_type: 'reference',
|
|
139
105
|
derived: false,
|
|
140
106
|
method: 'published',
|
|
141
107
|
disclaimer: 'Official rates as published by the named central bank. On weekends/holidays the most recent published rate_date is returned.'
|
|
@@ -159,8 +125,10 @@ console.log(table.rate_date, table.rates.length);
|
|
|
159
125
|
{
|
|
160
126
|
bank: 'snb',
|
|
161
127
|
name: 'Swiss National Bank',
|
|
162
|
-
rate_date: '2026-
|
|
128
|
+
rate_date: '2026-10-27',
|
|
163
129
|
rates: [
|
|
130
|
+
{ "base": "EUR", "quote": "CHF", "type": "reference", "value": 0.9233 },
|
|
131
|
+
{ "base": "USD", "quote": "CHF", "type": "reference", "value": 0.8285 },
|
|
164
132
|
{ "base": "EUR", "quote": "CHF", "type": "monthly_average", "value": 0.94312 },
|
|
165
133
|
// … the rest of the published table (26 currencies vs CHF)
|
|
166
134
|
],
|
|
@@ -201,7 +169,7 @@ Paid plans. One resolved rate per publication date — ready for charting, reval
|
|
|
201
169
|
import { getHistory } from 'snb-exchange-rate';
|
|
202
170
|
|
|
203
171
|
const series = await getHistory(
|
|
204
|
-
{ source: 'EUR', target: 'CHF', from: '2026-01-01', to: '2026-
|
|
172
|
+
{ source: 'EUR', target: 'CHF', from: '2026-01-01', to: '2026-10-27' },
|
|
205
173
|
{ apiKey: 'art_live_...' }
|
|
206
174
|
);
|
|
207
175
|
```
|
|
@@ -214,11 +182,11 @@ const series = await getHistory(
|
|
|
214
182
|
source: 'EUR',
|
|
215
183
|
target: 'CHF',
|
|
216
184
|
from: '2026-01-01',
|
|
217
|
-
to: '2026-
|
|
185
|
+
to: '2026-10-27',
|
|
218
186
|
count: 152,
|
|
219
187
|
rates: [
|
|
220
188
|
// one entry per publication date
|
|
221
|
-
{ date: '2026-
|
|
189
|
+
{ date: '2026-10-27', rate: 0.9233, rate_type: 'reference', derived: false, method: 'published' },
|
|
222
190
|
// …
|
|
223
191
|
],
|
|
224
192
|
disclaimer: '…'
|
|
@@ -237,18 +205,18 @@ Swiss National Bank currently publishes rates covering **26 currencies** against
|
|
|
237
205
|
|
|
238
206
|
## 🏛️ Source
|
|
239
207
|
|
|
240
|
-
The Swiss National Bank publishes
|
|
208
|
+
The Swiss National Bank publishes 11am franc exchange rates every business day for the euro, US dollar, pound sterling and yen (SNB computed rates based on Bloomberg BFIX rates), and monthly averages for about 25 currencies through its data portal, with history reaching back to 1914 — one of the longest official exchange rate records anywhere.
|
|
241
209
|
|
|
242
|
-
- Publisher's own page: [
|
|
243
|
-
- Publication: every
|
|
210
|
+
- Publisher's own page: [Current interest rates and exchange rates](https://www.snb.ch/en/the-snb/mandates-goals/statistics/statistics-pub/current_interest_exchange_rates) · [www.snb.ch](https://www.snb.ch)
|
|
211
|
+
- Publication: every business day; the exact schedule, freshness status and any current delay are on the [Swiss National Bank rates page](https://allratestoday.com/central-bank-rates-api/snb/)
|
|
244
212
|
- Values are stored unmodified, with the publisher's own `rate_date` on every row — see the [methodology](https://allratestoday.com/official-rates-methodology/)
|
|
245
213
|
|
|
246
214
|
## 🧭 Reading the numbers
|
|
247
215
|
|
|
248
216
|
- `value` is always **quote currency per 1 unit of base currency** (`base: "EUR", quote: "USD", value: 1.15` means 1 EUR = 1.15 USD).
|
|
249
|
-
- Swiss National Bank quotes **CHF per 1 unit of foreign currency** (
|
|
217
|
+
- The Swiss National Bank quotes **CHF per 1 unit of foreign currency** (`base: "EUR", quote: "CHF"`). Two series share the table: daily 11am rates for EUR, USD, GBP and JPY (`rate_type: "reference"`, every business day) and monthly averages for about 25 currencies (`rate_type: "monthly_average"`, dated the last day of the month). Check `rate_type` on every row.
|
|
250
218
|
- 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.
|
|
251
|
-
- `rate_type` tells you which of the central bank's series a row belongs to (`
|
|
219
|
+
- `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.
|
|
252
220
|
|
|
253
221
|
## 🧩 ERP & accounting systems
|
|
254
222
|
|
|
@@ -321,7 +289,7 @@ getRate('EUR', 'CHF', { apiKey: 'art_live_...' }).then((pair) => console.log(pai
|
|
|
321
289
|
|
|
322
290
|
## 💡 Quota tips
|
|
323
291
|
|
|
324
|
-
- Rates change once
|
|
292
|
+
- Rates change once per business day — cache the published table locally and a small monthly quota goes a long way.
|
|
325
293
|
- Every request counts toward your AllRatesToday quota, shared across all AllRatesToday endpoints on your key.
|
|
326
294
|
|
|
327
295
|
## 📖 Methods reference
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snb-exchange-rate",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "Official Swiss National Bank (Switzerland)
|
|
3
|
+
"version": "1.3.20",
|
|
4
|
+
"description": "Official Swiss National Bank (Switzerland) daily exchange rates — 26 currencies vs CHF, history since 1914. Zero-dependency Node.js/TypeScript client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"snb",
|
|
7
7
|
"swiss-national-bank",
|
|
@@ -28,7 +28,17 @@
|
|
|
28
28
|
"official-rates",
|
|
29
29
|
"switzerland",
|
|
30
30
|
"api",
|
|
31
|
-
"typescript"
|
|
31
|
+
"typescript",
|
|
32
|
+
"money",
|
|
33
|
+
"convert",
|
|
34
|
+
"conversion",
|
|
35
|
+
"exchange",
|
|
36
|
+
"rate",
|
|
37
|
+
"accounting",
|
|
38
|
+
"utilities",
|
|
39
|
+
"number",
|
|
40
|
+
"cart",
|
|
41
|
+
"ecommerce"
|
|
32
42
|
],
|
|
33
43
|
"homepage": "https://allratestoday.com/central-bank-rates-api/snb/",
|
|
34
44
|
"repository": {
|