# currencyiceland.com dataset

All values are sourced (URL) and dated (`retrieved_date`, ISO, Atlantic/Reykjavik day of retrieval). Nothing is invented; unsourced values are left out and listed in `gaps`. Researched independently; prices of venues were re-checked at the venue's own page on the retrieved date (leads only from earlier work; no data merged from other sites).

| File | Rows | What | Key fields |
|---|---|---|---|
| `rates.json` / `rates.csv` | 30 | Every current Seðlabanki Íslands registered mid-rate (miðgengi), ISK per 1 unit (all series are per 1 unit, scale-checked against ECB cross rates; display "per 100" for sub-1 values). Names in EN/IS/ZH, search aliases, main-currency order. Plus Landsbankinn general buy/sell (spread illustration; the full bank tables are in `bank_rates.json`). | `currency, name, name_is, name_zh, aliases, main_order, isk_per_unit, rate_date, source_url, retrieved_date, bank_buy_isk, bank_sell_isk` |
| `currencies.json` | 30+ | Currency metadata (source of truth, `tools/currencies_meta.py`): Seðlabanki TimeSeriesID, EN/IS/ZH names (ZH pending native review), aliases | `code, series_id, name_en, name_is, name_zh, main_order` |
| `bank_rates.json` / `.csv` | 57 | Static fallback for `/api/bank-rates`: Landsbankinn 17 general / 0 banknote (its banknote tab is not server-rendered, so a gap), Arion 16 general / 4 banknote, Íslandsbanki 10 general / 10 banknote. Written by `python3 tools/fetch_bank_rates.py`. Each bank has `stale`, `source_url`, `retrieved_date`. | `bank, kind, currency, buy, sell, rate_date, source_url, retrieved_date` |
| `wise_fees.json` | 29 | Wise card-fees page calculator (wise.com/gb/pricing/card-fees), fee for sending about USD 1,000 equivalent per currency; UK personal profile. Written by `python3 tools/fetch_wise_fees.py` (Playwright). | `currency, source_amount, fixed_fee, variable_fee, fee_pct, separate_tax, source_url, retrieved_date` |
| `card_fees.json` / `.csv` | 7 | Foreign-transaction and cash-withdrawal fee examples from the issuers' own pages (Chase Sapphire Preferred, Capital One Venture, Monzo, Starling, N26 Standard, CMB, UnionPay), EN/IS/ZH texts | `product, purchase_fee, cash_fee, source_url, retrieved_date` |
| `options.json` / `.csv` | 12 | Ways to pay or get ISK with the cost model (`cost_pct`, `fixed_fee_isk`, `min_fee_isk`, `weekend_extra_pct`, `spread_bank`, `cost_pct_by_ccy`), `applies_to` (currency list; null = all), place, how-link, tier, notes. Includes the Íslandsbanki and Arion visitor ATM fees. Prosegur KEF and KEF ATMs: price not published (gap rows). Wise is ranked per currency from `wise_fees.json`. | `id, cost_pct, applies_to, spread_bank, place_id, how_url, source_url, retrieved_date` |
| `places.json` / `.csv` | 11 | Places with coordinates (OpenStreetMap Nominatim geocode), OSM and Google Maps links | `lat, lng, osm_url, google_maps_url, coordinates_source, source_url, retrieved_date` |
| `prices.json` / `.csv` | 44 | Everyday prices in ISK, each its own row (bus, Flybus, hot dog, coffee sizes, beer types, pools, and more), from the venue page or dated press. `featured` rows show by default. `valid_from` / `valid_until` hide a price outside its dates; prices older than 90 days are flagged. | `price_isk, unit, place_id, featured, valid_from, valid_until, source_url, retrieved_date` |
| `facts.json` / `.csv` | 21 | Sourced claims behind the advice cards (cards vs cash, tipping, wallets, DCC, KEF operator and ATMs, visitor ATM fees, banks, Wise/Revolut, VAT, Flybus payment methods) | `topic, claim_en, source_url, retrieved_date` |
| `kef_observations.json` / `.csv` | 2 | The only dated concrete Prosegur Change KEF rates found: one customer's receipt reported by Vísir on 7 May 2025 (USD sale at 114.6601 ISK + 10.94% fee; EUR purchase at 157.9722 ISK). Compared with the banks' own banknote rates quoted by Vísir for that day. The transaction date is not stated, so no spread vs the Seðlabanki mid-rate is computed. | `currency, desk_rate_isk, banks_banknote_rate_low_isk, desk_vs_banks_pct_low, service_fee_pct, article_date, source_url` |
| `map_points.json` / `.csv` | 39 | Places to exchange or withdraw cash on the map (desk, branch, atm) with the operator's address, hours, ATM currency/limit, coordinates and their source | `kind, bank, title, address, lat, lon, hours, hours_flag, atm, cashier, coordinates_source, source_url, retrieved_date` |
| `bank_locations.json` | 25 | Raw Arion and Íslandsbanki branch/ATM records from the banks' own pages | `bank, kind, title, address, lat, lon, opening_hours, atm` |
| `sources.json` / `.csv` | 53 | Every source URL used, number of records relying on it | `source_url, records_using, retrieved_date` |
| `gaps.json` / `.csv` | 10 | Values we could not source: left out on purpose | `gap, source_url, retrieved_date` |

Tier rule (computed in the browser for the amount typed): effective cost over the Seðlabanki mid-rate `<= 1%` Budget, `1-3%` Mid-range, `> 3%` Luxury. Fixed minimums (e.g. 300 ISK) are included, so tier can change with amount.

## Bank rates (live)
`functions/api/bank-rates.js` (`/api/bank-rates`) fetches Landsbankinn (`__NEXT_DATA__` on /markadir/gjaldmidlar), Arion (`/api/currency/bank/exchangerate` and `/noterate`) and Íslandsbanki (`/publicapi/bank/currencies/v2/general` and `/cash`) on request, caches the answer at the edge for 1 h (`X-Rates-Cache` HIT/MISS; cache key carries a shape version), and replaces any bank that fails with its section of `bank_rates.json` marked `stale:true` (then 60 s cache). All three work from a Worker in tests; real Cloudflare-edge egress is confirmed only after deploy. No daily script is required for these; `python3 tools/fetch_bank_rates.py` refreshes the static fallback. Older rows (stale section, or more than 3 days behind the Seðlabanki rate date) are flagged, unranked and never take the best badge.

## Public API v1 (stable; other sites may call it)
Both endpoints are `GET`, JSON, public and read-only. **Shape rule: fields are only ever added, never renamed or removed.** Both bodies carry `"api_version": "v1"`.
CORS: `Access-Control-Allow-Origin: *` on every `/api/*` response, `OPTIONS` preflight answered with 204 (`Allow-Methods: GET, HEAD, OPTIONS`, `Max-Age: 86400`), `Access-Control-Expose-Headers: X-Rates-Cache`; other methods get 405. Implemented once in `functions/api/_middleware.js`.
Why `*` and not an allowlist: the data is public and read-only, no cookies or credentials are involved, CORS does not stop server-side callers anyway, the same files already carry CORS `*` under `/data/`, and a list (currencyiceland.com, 69north.is, app.69north.is, icelandprices.com, experiencesiceland.com, fueliceland.com, forecasticeland.com, rentalsiceland.com, wheretostayiceland.com, whereiswar.com, their www variants and *.pages.dev previews) would need a redeploy every time a site or preview is added. `Vary: Origin` is therefore not sent (a constant `*` does not vary).

`GET /api/rates` (edge-cached 3 h; static `data/rates.json` fallback with `fallback:true`):
`{ api_version, base:"ISK", unit, primary_source:{name,url,url_group7,doc_url,published}, retrieved_date, retrieved_at_utc, currency_count, fallback, rates:[ { currency, name, name_is, name_zh, aliases, main_order, unit:1, isk_per_unit, rate_date, kind, source_url, retrieved_date, bank_buy_isk?, bank_sell_isk?, bank_rate_date?, bank?, bank_source_url? } ] }`
To convert an amount in `currency` to ISK: `amount * isk_per_unit` (every series is per 1 unit; sub-1 values such as KRW 0.0958 are real). `bank_*` fields are Landsbankinn's general rate and are optional.

`GET /api/bank-rates` (edge-cached 1 h, 60 s when any bank fell back):
`{ api_version, shape:"2", retrieved_date, retrieved_at_utc, fallback, errors:{bank:msg}, banks:{ landsbankinn|arion|islandsbanki: { name, source_url, retrieved_date, stale, general:{CODE:{buy,sell,date,registered_at?}}, banknote:{CODE:{...}} } } }`
`stale:true` means that bank could not be fetched and its section is the saved copy: treat its rows as older. Landsbankinn has no banknote section (gap).

## Landsbankinn date finding (3 Dec 2026)
Landsbankinn's rate page is a Next.js ISR page (`cache-control: s-maxage=60, stale-while-revalidate=31535940`, `x-nextjs-cache: HIT/STALE`) served by several origin caches that are not in sync. Fourteen requests in a row at 22:52 UTC returned a mix of the 2 Dec page (USD buy 125.72) and the 3 Dec page (USD buy 126.25); both pages carry their own `date` field, so the 2 Dec rows were the bank's own stale page, not a parsing error. `functions/_lib/landsbankinn.js` and `tools/lb_page.py` now fetch 5 (Worker) or 8 (script) copies with a cache-busting query and keep the page with the newest date.

## Map points
`map_points.json` (39 places, 27 pin positions): exchange desks, bank branches and ATMs for the map section. Arion (13 branches, 11 ATMs, EUR/USD/GBP/PLN dispensers flagged) and Íslandsbanki (12 branches) come from the banks' own pages with their own coordinates (`tools/fetch_bank_locations.py` -> `bank_locations.json`); Landsbankinn Austurstræti 11 and the Prosegur desk and ATMs at KEF use the geocoded `places` coordinates (terminal area for KEF). Basemap: OpenFreeMap "positron" (MIT software; map data OpenStreetMap, ODbL; OpenMapTiles; attribution required and shown by MapLibre's attribution control), vendored MapLibre GL 5.24.1 in `vendor/` (BSD-3), lazy-loaded.

## Shared feed
`python3 tools/export_shared_feed.py` writes `/workspace/shared-feed/currencyiceland.json` for 69north.is (one row per Seðlabanki rate, per bank rate with buy in `price_isk` and sell in `price_max_isk`, per exchange place, and per visitor ATM fee), validated against `/workspace/shared-feed/README.md`. Run after each publish.

## Rate source and update method
Live: the Cloudflare Pages Function `functions/api/rates.js` (`/api/rates`) fetches the same XML on request, caches it at the edge for about 3 hours, and falls back to the static `rates.json` if the fetch fails (then `fallback: true`, 60 s cache). The page calls it first, then the static file, then the Frankfurter relay.
Static: Seðlabanki Íslands XML time-series service, group 9 (official reference rates) and 7 (registered mid-rates): `https://sedlabanki.is/xmltimeseries/Default.aspx?DagsFra=LATEST&GroupID=9&Type=xml` (docs: https://sedlabanki.is/gagnatorg/xml-gogn/). Published each banking day ~16:00 Reykjavik time. The endpoint is not CORS-enabled, so `python3 tools/fetch_rates.py` (stdlib only) fetches at build time and writes `rates.json/csv` with the fetch date. Run it daily (cron or Cloudflare Pages build hook), then redeploy.
Secondary (client-side, optional, labelled on page): `https://api.frankfurter.dev/v2/providers/sbi/rates` (CORS `*`), a relay of the same Seðlabanki rates, used by the "Refresh rate" button and automatically if the saved rate is over 1.5 days old.
Bank spread illustration: Landsbankinn general rate page (HTML), parsed by the same script.

Curated files (`options, places, prices, facts, sources, gaps, card_fees`) are written by `python3 tools/build_dataset.py`; re-verify each source URL before bumping the date.

## Design notes: what was borrowed
- **Wise**: show the mid-market rate as the reference and put every fee in plain numbers before you pay; "you get" amount per option.
- **Revolut**: weekend markup and monthly limits shown as part of the cost, so the ranking changes on Saturday/Sunday.
- **XE**: one big amount + currency picker at the top, rate and date directly under the result.
- **OANDA**: official-style rate table with buy/sell columns and the explanation that mid-rate is a reference, not a retail rate.
Languages: English, Icelandic, Simplified Chinese. IS and ZH are careful translations pending native review.
