snb-exchange-rate 1.3.19 → 1.3.22
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 +22 -15
- package/package.json +2 -2
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
|
|
|
@@ -47,7 +47,7 @@ The image is rendered live from the keyless endpoint above, so it follows the ce
|
|
|
47
47
|
|
|
48
48
|
<!-- daily-table:start -->
|
|
49
49
|
<details>
|
|
50
|
-
<summary>Table as text: published 2026-
|
|
50
|
+
<summary>Table as text: published 2026-10-28 by Swiss National Bank — 30 rates. Updated 2026-10-29.</summary>
|
|
51
51
|
|
|
52
52
|
| Base | Quote | Type | Rate |
|
|
53
53
|
| --- | --- | --- | ---: |
|
|
@@ -59,10 +59,13 @@ The image is rendered live from the keyless endpoint above, so it follows the ce
|
|
|
59
59
|
| CZK | CHF | monthly_average | 0.0388224 |
|
|
60
60
|
| DKK | CHF | monthly_average | 0.1261671 |
|
|
61
61
|
| EUR | CHF | monthly_average | 0.94312 |
|
|
62
|
+
| EUR | CHF | reference | 0.9239 |
|
|
62
63
|
| GBP | CHF | monthly_average | 1.0993 |
|
|
64
|
+
| GBP | CHF | reference | 1.1032 |
|
|
63
65
|
| HKD | CHF | monthly_average | 0.1044552 |
|
|
64
66
|
| HUF | CHF | monthly_average | 0.0025839 |
|
|
65
67
|
| JPY | CHF | monthly_average | 0.0052383 |
|
|
68
|
+
| JPY | CHF | reference | 0.005261 |
|
|
66
69
|
| KRW | CHF | monthly_average | 0.0006029 |
|
|
67
70
|
| MXN | CHF | monthly_average | 0.0475407 |
|
|
68
71
|
| MYR | CHF | monthly_average | 0.2013008 |
|
|
@@ -75,6 +78,7 @@ The image is rendered live from the keyless endpoint above, so it follows the ce
|
|
|
75
78
|
| THB | CHF | monthly_average | 0.0246599 |
|
|
76
79
|
| TRY | CHF | monthly_average | 0.0168369 |
|
|
77
80
|
| USD | CHF | monthly_average | 0.81926 |
|
|
81
|
+
| USD | CHF | reference | 0.8304 |
|
|
78
82
|
| XDR | CHF | monthly_average | 1.11928 |
|
|
79
83
|
| ZAR | CHF | monthly_average | 0.05052 |
|
|
80
84
|
|
|
@@ -131,11 +135,11 @@ const pair = await getRate('EUR', 'CHF', { apiKey: 'art_live_...' });
|
|
|
131
135
|
{
|
|
132
136
|
bank: 'snb',
|
|
133
137
|
name: 'Swiss National Bank',
|
|
134
|
-
rate_date: '2026-
|
|
138
|
+
rate_date: '2026-10-27', // Swiss National Bank's own publication date
|
|
135
139
|
source: 'EUR',
|
|
136
140
|
target: 'CHF',
|
|
137
|
-
rate: 0.
|
|
138
|
-
rate_type: '
|
|
141
|
+
rate: 0.9233,
|
|
142
|
+
rate_type: 'reference',
|
|
139
143
|
derived: false,
|
|
140
144
|
method: 'published',
|
|
141
145
|
disclaimer: 'Official rates as published by the named central bank. On weekends/holidays the most recent published rate_date is returned.'
|
|
@@ -159,8 +163,10 @@ console.log(table.rate_date, table.rates.length);
|
|
|
159
163
|
{
|
|
160
164
|
bank: 'snb',
|
|
161
165
|
name: 'Swiss National Bank',
|
|
162
|
-
rate_date: '2026-
|
|
166
|
+
rate_date: '2026-10-27',
|
|
163
167
|
rates: [
|
|
168
|
+
{ "base": "EUR", "quote": "CHF", "type": "reference", "value": 0.9233 },
|
|
169
|
+
{ "base": "USD", "quote": "CHF", "type": "reference", "value": 0.8285 },
|
|
164
170
|
{ "base": "EUR", "quote": "CHF", "type": "monthly_average", "value": 0.94312 },
|
|
165
171
|
// … the rest of the published table (26 currencies vs CHF)
|
|
166
172
|
],
|
|
@@ -201,7 +207,7 @@ Paid plans. One resolved rate per publication date — ready for charting, reval
|
|
|
201
207
|
import { getHistory } from 'snb-exchange-rate';
|
|
202
208
|
|
|
203
209
|
const series = await getHistory(
|
|
204
|
-
{ source: 'EUR', target: 'CHF', from: '2026-01-01', to: '2026-
|
|
210
|
+
{ source: 'EUR', target: 'CHF', from: '2026-01-01', to: '2026-10-27' },
|
|
205
211
|
{ apiKey: 'art_live_...' }
|
|
206
212
|
);
|
|
207
213
|
```
|
|
@@ -214,11 +220,11 @@ const series = await getHistory(
|
|
|
214
220
|
source: 'EUR',
|
|
215
221
|
target: 'CHF',
|
|
216
222
|
from: '2026-01-01',
|
|
217
|
-
to: '2026-
|
|
223
|
+
to: '2026-10-27',
|
|
218
224
|
count: 152,
|
|
219
225
|
rates: [
|
|
220
226
|
// one entry per publication date
|
|
221
|
-
{ date: '2026-
|
|
227
|
+
{ date: '2026-10-27', rate: 0.9233, rate_type: 'reference', derived: false, method: 'published' },
|
|
222
228
|
// …
|
|
223
229
|
],
|
|
224
230
|
disclaimer: '…'
|
|
@@ -237,18 +243,19 @@ Swiss National Bank currently publishes rates covering **26 currencies** against
|
|
|
237
243
|
|
|
238
244
|
## 🏛️ Source
|
|
239
245
|
|
|
240
|
-
The Swiss National Bank publishes
|
|
246
|
+
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
247
|
|
|
242
|
-
- Publisher's own page: [
|
|
243
|
-
- Publication: every
|
|
248
|
+
- 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)
|
|
249
|
+
- 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/)
|
|
250
|
+
- In the API: usually by **12:20 UTC** (measured over the last 10 publications). Schedule a sync at or after that time and retry hourly until `rate_date` moves; every response carries the same figure as `available_by_utc` — see [when to poll](https://allratestoday.com/docs/#when-to-poll)
|
|
244
251
|
- Values are stored unmodified, with the publisher's own `rate_date` on every row — see the [methodology](https://allratestoday.com/official-rates-methodology/)
|
|
245
252
|
|
|
246
253
|
## 🧭 Reading the numbers
|
|
247
254
|
|
|
248
255
|
- `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** (
|
|
256
|
+
- 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
257
|
- 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 (`
|
|
258
|
+
- `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
259
|
|
|
253
260
|
## 🧩 ERP & accounting systems
|
|
254
261
|
|
|
@@ -321,7 +328,7 @@ getRate('EUR', 'CHF', { apiKey: 'art_live_...' }).then((pair) => console.log(pai
|
|
|
321
328
|
|
|
322
329
|
## 💡 Quota tips
|
|
323
330
|
|
|
324
|
-
- Rates change once
|
|
331
|
+
- Rates change once per business day — cache the published table locally and a small monthly quota goes a long way.
|
|
325
332
|
- Every request counts toward your AllRatesToday quota, shared across all AllRatesToday endpoints on your key.
|
|
326
333
|
|
|
327
334
|
## 📖 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.22",
|
|
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",
|