hkab-exchange-rate
v1.3.32
Published
Official Hong Kong Association of Banks (Hong Kong) daily exchange rates — 22 currencies vs HKD, current table, archive from 2026. Zero-dependency Node.js/TypeScript client.
Maintainers
Keywords
Readme
Hong Kong Association of Banks Exchange Rates API — hkab-exchange-rate
Official Hong Kong Association of Banks (Hong Kong) daily exchange rates for Node.js and TypeScript. The published bank association rates behind tax filings, customs valuations, audits, and compliant invoicing — not market estimates, but the numbers Hong Kong Association of Banks itself prints, every business day.
🚀 Why this client?
- 🏛️ Official rates — Hong Kong Association of Banks's own table, with the publisher's own
rate_dateon every response - 📅 History from 2026 — this source publishes only its current table, so the archive builds forward from the day we started collecting
- 🔀 Official vs derived, always flagged — computed inverse/cross pairs carry
derived: true, never mixed with official prints - ⚡ Zero dependencies — pure ESM + CJS over global
fetch; Node 18+, Bun, Deno, and edge runtimes - 🔷 Type-safe — full TypeScript definitions shipped with the package
- 🧾 Compliance-grade metadata —
rate_type, publication date, and source disclaimer on every response
Official rate, not mid-market: every value here is a number Hong Kong Association of Banks itself published, fixed once printed and carrying the bank association'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 or@allratestoday/sdk. The two can diverge by several percent.
🔑 Get your API key
Get a free API key at allratestoday.com/register — no credit card required. Latest rates are on every plan, including free.
📈 Latest official table
The image is rendered live from the keyless endpoint, so it follows the bank association'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 refreshes it whenever the bank association publishes a new table; on npm it is as of the package's publish date.
| Base | Quote | Type | Rate | | --- | --- | --- | ---: | | AUD | HKD | middle | 5.19875 | | AUD | HKD | sell | 5.279 | | AUD | HKD | tt_buy | 5.1185 | | BND | HKD | middle | 6.07625 | | BND | HKD | sell | 6.141 | | BND | HKD | tt_buy | 6.0115 | | CAD | HKD | middle | 5.46575 | | CAD | HKD | sell | 5.547 | | CAD | HKD | tt_buy | 5.3845 | | CHF | HKD | middle | 9.32625 | | CHF | HKD | sell | 9.409 | | CHF | HKD | tt_buy | 9.2435 | | CNY | HKD | middle | 1.17375 | | CNY | HKD | sell | 1.1865 | | CNY | HKD | tt_buy | 1.161 | | DKK | HKD | middle | 1.15075 | | DKK | HKD | sell | 1.1655 | | DKK | HKD | tt_buy | 1.136 | | EUR | HKD | middle | 8.60175 | | EUR | HKD | sell | 8.7095 | | EUR | HKD | tt_buy | 8.494 | | GBP | HKD | middle | 10.2625 | | GBP | HKD | sell | 10.345 | | GBP | HKD | tt_buy | 10.18 | | INR | HKD | middle | 0.08475 | | INR | HKD | sell | 0.0915 | | INR | HKD | tt_buy | 0.078 | | JPY | HKD | middle | 0.0493875 | | JPY | HKD | sell | 0.05039 | | JPY | HKD | tt_buy | 0.048385 | | KRW | HKD | middle | 0.0058225 | | KRW | HKD | sell | 0.006075 | | KRW | HKD | tt_buy | 0.00557 | | MYR | HKD | middle | 1.90575 | | MYR | HKD | sell | 1.932 | | MYR | HKD | tt_buy | 1.8795 | | NOK | HKD | middle | 0.80275 | | NOK | HKD | sell | 0.8165 | | NOK | HKD | tt_buy | 0.789 | | NZD | HKD | middle | 4.29125 | | NZD | HKD | sell | 4.3545 | | NZD | HKD | tt_buy | 4.228 | | PHP | HKD | middle | 0.12275 | | PHP | HKD | sell | 0.127 | | PHP | HKD | tt_buy | 0.1185 | | PKR | HKD | middle | 0.02825 | | PKR | HKD | sell | 0.031 | | PKR | HKD | tt_buy | 0.0255 | | SEK | HKD | middle | 0.76675 | | SEK | HKD | sell | 0.7795 | | SEK | HKD | tt_buy | 0.754 | | SGD | HKD | middle | 6.07625 | | SGD | HKD | sell | 6.1385 | | SGD | HKD | tt_buy | 6.014 | | THB | HKD | middle | 0.2305 | | THB | HKD | sell | 0.234 | | THB | HKD | tt_buy | 0.227 | | TWD | HKD | middle | 0.23775 | | TWD | HKD | sell | 0.2415 | | TWD | HKD | tt_buy | 0.234 |
Full table on the Hong Kong Association of Banks rates page · Source: Official rates published by HKAB, served by AllRatesToday. Rates are as printed by the bank association; AllRatesToday is not affiliated with it.
📦 Installation
npm install hkab-exchange-rateyarn add hkab-exchange-ratepnpm add hkab-exchange-rateRequires Node 18+ (global fetch); also runs on Bun, Deno and edge runtimes. Also published under the org scope as @allratestoday/hkab-exchange-rate — same code, same versions.
🏁 Quick start
import { getRate } from 'hkab-exchange-rate';
const pair = await getRate('USD', 'HKD', { apiKey: 'art_live_...' });
console.log(pair.rate, pair.rate_date); // the official Hong Kong Association of Banks rate, on the bank association's own date📚 API reference
- Latest pair rate — one pair from the latest official table
- Full official table — everything the bank association printed, in one call
- Table for a date — the official table for an invoice or filing date
- Daily time series — one pair across a date range
Latest pair rate
Free plan and up. Pairs the bank association does not print directly are resolved from its table and flagged (see Official vs derived rates below).
const pair = await getRate('USD', 'HKD', { apiKey: 'art_live_...' });Response:
{
bank: 'hkab',
name: 'Hong Kong Association of Banks',
rate_date: '2026-11-11', // Hong Kong Association of Banks's own publication date
source: 'USD',
target: 'HKD',
rate: 7.84475,
rate_type: 'middle',
derived: false,
method: 'published',
disclaimer: 'Official rates as published by the named central bank. On weekends/holidays the most recent published rate_date is returned.'
}Full official table
Free plan and up. The complete table for the latest publication date.
import { getLatestRates } from 'hkab-exchange-rate';
const table = await getLatestRates({ apiKey: 'art_live_...' });
console.log(table.rate_date, table.rates.length);Response:
{
bank: 'hkab',
name: 'Hong Kong Association of Banks',
rate_date: '2026-11-11',
rates: [
{ "base": "USD", "quote": "HKD", "type": "middle", "value": 7.84475 },
{ "base": "USD", "quote": "HKD", "type": "sell", "value": 7.875 },
{ "base": "USD", "quote": "HKD", "type": "tt_buy", "value": 7.8145 },
// … the rest of the official table (22 currencies vs HKD)
],
disclaimer: '…'
}Table for a date
Paid plans. The official table for any date since 2026 — weekends and holidays return the most recent published date, flagged via published_on_requested_date, which is exactly the in-force rate a filing needs.
import { getRatesForDate } from 'hkab-exchange-rate';
const day = await getRatesForDate('2026-06-30', { apiKey: 'art_live_...' });
// Optionally narrow to one pair:
const one = await getRatesForDate('2026-06-30', { apiKey: 'art_live_...', source: 'USD', target: 'HKD' });Response:
{
bank: 'hkab',
requested_date: '2026-06-30',
rate_date: '2026-06-30', // the date actually published
published_on_requested_date: true, // false when a weekend/holiday fell back
rates: [ /* the full table for that date */ ],
disclaimer: '…'
}Daily time series
Paid plans. One resolved rate per publication date — ready for charting, revaluation runs, or audit workpapers.
import { getHistory } from 'hkab-exchange-rate';
const series = await getHistory(
{ source: 'USD', target: 'HKD', from: '2026-01-01', to: '2026-11-11' },
{ apiKey: 'art_live_...' }
);Response:
{
bank: 'hkab',
source: 'USD',
target: 'HKD',
from: '2026-01-01',
to: '2026-11-11',
count: 152,
rates: [
// one entry per publication date
{ date: '2026-11-11', rate: 7.84475, rate_type: 'middle', derived: false, method: 'published' },
// …
],
disclaimer: '…'
}Pass { symbol: 'USD' } instead of source/target to get the raw published rows for one currency (all rate types, no pair resolution).
🗺️ Currencies covered
Hong Kong Association of Banks currently publishes rates covering 22 currencies against the HKD (as of the latest table):
🇦🇺 AUD · 🇧🇳 BND · 🇨🇦 CAD · 🇨🇭 CHF · 🇨🇳 CNY · 🇩🇰 DKK · 🇪🇺 EUR · 🇬🇧 GBP · 🇮🇳 INR · 🇯🇵 JPY · 🇰🇷 KRW · 🇲🇾 MYR · 🇳🇴 NOK · 🇳🇿 NZD · 🇵🇭 PHP · 🇵🇰 PKR · 🇸🇪 SEK · 🇸🇬 SGD · 🇹🇭 THB · 🇹🇼 TWD · 🇺🇸 USD · 🇿🇦 ZAR
🏛️ Source
The Hong Kong Association of Banks is a statutory body created by the Hong Kong Association of Banks Ordinance (Cap. 364). It sets official Hong Kong dollar exchange rates at the opening of business each day, with a selling rate and a telegraphic transfer buying rate for each currency. Its selling rate is the conversion rate named in the Dutiable Commodities Ordinance and in the rules for cross-boundary cash declarations.
- Publisher's own page: HKAB exchange rates · www.hkab.org.hk
- Publication: every business day; the exact schedule, freshness status and any current delay are on the Hong Kong Association of Banks rates page
- Values are stored unmodified, with the publisher's own
rate_dateon every row — see the methodology
🧭 Reading the numbers
valueis always quote currency per 1 unit of base currency (base: "EUR", quote: "USD", value: 1.15means 1 EUR = 1.15 USD).- HKAB prints Hong Kong dollars per 1 unit of foreign currency (
base: "USD", quote: "HKD"), withsellandtt_buyopening counter rates and a computedmiddleof the two. - Need the other way round? Ask
getRate(target, source)and the API inverts or crosses for you, flaggedderived: true— never divide a published rate yourself in a compliance workflow. rate_typetells you which of the bank association's series a row belongs to (middlehere); some publishers print buy/sell or several fixings for the same pair.
🧩 ERP & accounting systems
Loading the official Hong Kong Association of Banks rate into an accounting system is a supported workflow, not a hack. Step-by-step guides with the direction each system expects:
- Dynamics 365 Business Central — built-in Currency Exchange Rate Service, no code
- Xero · QuickBooks Online · SAP S/4HANA and ECC · Odoo
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:
curl "https://allratestoday.com/api/v1/central-bank/hkab/latest?format=xml&api_key=art_live_..."🤖 AI agents
- MCP server:
npx -y @allratestoday/central-bank-mcp(stdio) or the hosted endpointhttps://allratestoday.com/api/mcp— tools for official rates, history, cross-bank comparison and publication calendars - Already using the general SDK or MCP server? Since 2026-10-01
@allratestoday/sdk1.4+ hasofficialRates('hkab')and@allratestoday/mcp-server0.6+ has aget_official_ratestool — both return this source's latest table with no key, so you can add it without a second dependency - Claude Code plugin (no key):
/plugin marketplace add AllRates-Today/claude-code-pluginthen/plugin install allratestoday@allratestoday— bundles both MCP servers plus an/official-rate hkab ...command - Evaluating? Agents can self-issue a trial key with no signup:
POST https://allratestoday.com/api/agent/keys(sendContent-Type: application/json) returns a 100-call key valid 7 days that covers the free-plan methods (latest table, pairs); dated tables and history need a paid plan. The MCP servers expose it asrequest_trial_key - Machine-readable site guide: llms.txt · for-ai-agents
⚖️ Official vs derived rates
If Hong Kong Association of Banks does not print a pair directly, the API resolves it from the bank association's own table and says so — official and computed values are never confused:
| method | derived | Meaning |
| --- | --- | --- |
| published | false | The bank association printed this pair directly |
| inverse | true | Computed as 1 ÷ the published opposite direction |
| cross | true | Computed via HKD from two published rates |
🛡️ Error handling
Errors are thrown as Error with status (HTTP code) and body (the API's JSON error) attached:
try {
const pair = await getRate('USD', 'XXX', { apiKey: 'art_live_...' });
} catch (err) {
console.log(err.message); // human-readable reason
console.log(err.status); // e.g. 404
}| Status | Meaning |
| ------ | ------- |
| — | Missing apiKey (thrown before any request) |
| 400 | Malformed date or parameters |
| 401 | Invalid API key |
| 403 | Endpoint needs a paid plan (historical dates & series) |
| 404 | Pair or date range not covered by Hong Kong Association of Banks |
| 429 | Monthly quota exceeded |
🔷 TypeScript
Full definitions ship with the package — no @types install:
import type { LatestRates, PairRate, DatedRates, RateEntry, HistoryQuery, RequestOptions } from 'hkab-exchange-rate';📦 CommonJS
const { getRate } = require('hkab-exchange-rate');
getRate('USD', 'HKD', { apiKey: 'art_live_...' }).then((pair) => console.log(pair.rate));💡 Quota tips
- Rates change once per business day — cache the official table locally and a small monthly quota goes a long way.
- Every request counts toward your AllRatesToday quota, shared across all AllRatesToday endpoints on your key.
📖 Methods reference
| Method | Plan | Description |
| ------ | ---- | ----------- |
| getRate(source, target, { apiKey }) | Free | Latest rate for one pair, resolved from the official table |
| getLatestRates({ apiKey }) | Free | The bank association's full latest official table |
| getRatesForDate(date, { apiKey, source?, target? }) | Paid | The official table (or one pair) for a YYYY-MM-DD date |
| getHistory({ symbol \| source+target, from?, to? }, { apiKey }) | Paid | Daily series since 2026 |
📥 Bulk data (no key)
Need the whole archive rather than an API call? The same official tables are mirrored daily as open data:
- Hugging Face: AllRatesToday/central-bank-exchange-rates — one CSV per institution (
rates/hkab.csv) - Kaggle: allratestoday/central-bank-exchange-rates
- Raw JSON on GitHub:
https://raw.githubusercontent.com/AllRates-Today/central-bank-exchange-rates/main/data/hkab/latest.json
🔗 Links
- Website: allratestoday.com
- Hong Kong Association of Banks rates page — live table, publication cadence, FAQ
- All central bank sources · Full list of 120+ central banks and 50+ tax authorities — one API, the same response shape for every source
- Download central bank rates — every bank's latest table and history as Excel, CSV or JSON
- Bank Exchange Rate API — live buy and sell rates from 1,200+ commercial banks in 120+ countries · npm · GitHub
- Package docs on the site · ERP integration guides
- API documentation · Interactive reference · Methodology
- Register (Free) · Dashboard · Pricing
- Status
- Postman collection
- ChatGPT app — ask ChatGPT for live and official central bank rates
- OpenAPI reference on Bump.sh — also on SwaggerHub
- GitHub
📜 License
MIT
