npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sbv-exchange-rate

v1.3.7

Published

Official State Bank of Vietnam (Vietnam) daily exchange rates — 28 currencies vs VND, history since 2009. Zero-dependency Node.js/TypeScript client.

Readme

State Bank of Vietnam Exchange Rates API — sbv-exchange-rate

npm version license zero dependencies TypeScript USD/VND today rate date

Official State Bank of Vietnam (Vietnam) 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 State Bank of Vietnam itself prints, every business day.

🚀 Why this client?

  • 🏛️ Official published rates — State Bank of Vietnam's own table, with the publisher's own rate_date on every response
  • 📅 History back to 2009 — point-in-time tables and daily series for any past date
  • 🔀 Published 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 State Bank of Vietnam 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 or @allratestoday/sdk. The two can diverge by several percent.

⚡ Try it without a key

The latest State Bank of Vietnam table is also served keyless, CORS-open and edge-cached, for evaluation, embeds and AI agents:

curl "https://allratestoday.com/api/open/central-bank/sbv?source=USD&target=VND"
const r = await fetch('https://allratestoday.com/api/open/central-bank/sbv').then((x) => x.json());
console.log(r.rate_date, r.rates.length); // the central bank's latest published table, no key

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.

📈 Latest published table

Today's full State Bank of Vietnam table, straight from the central bank's latest publication. On GitHub it is refreshed by a daily Action that reads the keyless endpoint above and commits only when the central bank publishes a new table; the copy on npm is as of the package's publish date.

Published 2026-10-09 by State Bank of Vietnam — 42 rates. Updated 2026-10-09.

| Base | Quote | Type | Rate | | --- | --- | --- | ---: | | AED | VND | reference | 6980.7 | | AUD | VND | buy | 16962 | | AUD | VND | reference | 17869.69 | | AUD | VND | sell | 18747 | | BRL | VND | reference | 5145.3 | | CAD | VND | buy | 17127 | | CAD | VND | reference | 18030.8 | | CAD | VND | sell | 18930 | | CHF | VND | buy | 29294 | | CHF | VND | reference | 30789 | | CHF | VND | sell | 32377 | | CNY | VND | reference | 3824 | | DKK | VND | reference | 3850.71 | | EUR | VND | buy | 27318 | | EUR | VND | reference | 28778.66 | | EUR | VND | sell | 30194 | | GBP | VND | buy | 32231 | | GBP | VND | reference | 33960.09 | | GBP | VND | sell | 35624 | | HKD | VND | reference | 3267.03 | | IDR | VND | reference | 1.43 | | INR | VND | reference | 265.17 | | JPY | VND | buy | 154 | | JPY | VND | reference | 161.97 | | JPY | VND | sell | 170 | | KHR | VND | reference | 6.34 | | KRW | VND | reference | 19.13 | | LAK | VND | reference | 1.15 | | MOP | VND | reference | 3171.84 | | MYR | VND | reference | 6276.9 | | NOK | VND | reference | 2680.26 | | NZD | VND | reference | 14372.66 | | PLN | VND | reference | 6576.04 | | RUB | VND | reference | 300.25 | | SEK | VND | reference | 2555.98 | | SGD | VND | reference | 20043.78 | | THB | VND | reference | 761.45 | | TRY | VND | reference | 521.18 | | TWD | VND | reference | 804.78 | | USD | VND | buy | 24398 | | USD | VND | reference | 25629 | | USD | VND | sell | 26860 |

Source: Official rates published by SBV, served by AllRatesToday. Rates are as printed by the central bank; AllRatesToday is not affiliated with it.

🔑 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.

📦 Installation

npm install sbv-exchange-rate
yarn add sbv-exchange-rate
pnpm add sbv-exchange-rate

Requires Node 18+ (global fetch); also runs on Bun, Deno and edge runtimes. Also published under the org scope as @allratestoday/sbv-exchange-rate — same code, same versions.

🏁 Quick start

import { getRate } from 'sbv-exchange-rate';

const pair = await getRate('USD', 'VND', { apiKey: 'art_live_...' });
console.log(pair.rate, pair.rate_date); // the official State Bank of Vietnam rate, on the central bank's own date

📚 API reference


Latest pair rate

Free plan and up. Pairs the central bank does not print directly are resolved from its table and flagged (see Published vs derived rates below).

const pair = await getRate('USD', 'VND', { apiKey: 'art_live_...' });

Response:

{
  bank: 'sbv',
  name: 'State Bank of Vietnam',
  rate_date: '2026-10-08',   // State Bank of Vietnam's own publication date
  source: 'USD',
  target: 'VND',
  rate: 25634,
  rate_type: 'reference',
  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 published table

Free plan and up. The complete table for the latest publication date.

import { getLatestRates } from 'sbv-exchange-rate';

const table = await getLatestRates({ apiKey: 'art_live_...' });
console.log(table.rate_date, table.rates.length);

Response:

{
  bank: 'sbv',
  name: 'State Bank of Vietnam',
  rate_date: '2026-10-08',
  rates: [
    { "base": "USD", "quote": "VND", "type": "reference", "value": 25634 },
    { "base": "USD", "quote": "VND", "type": "sell", "value": 26869 },
    { "base": "USD", "quote": "VND", "type": "buy", "value": 24407 },
    // … the rest of the published table (28 currencies vs VND)
  ],
  disclaimer: '…'
}

Table for a date

Paid plans. The official table for any date since 2009 — 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 'sbv-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: 'VND' });

Response:

{
  bank: 'sbv',
  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 'sbv-exchange-rate';

const series = await getHistory(
  { source: 'USD', target: 'VND', from: '2026-01-01', to: '2026-10-08' },
  { apiKey: 'art_live_...' }
);

Response:

{
  bank: 'sbv',
  source: 'USD',
  target: 'VND',
  from: '2026-01-01',
  to: '2026-10-08',
  count: 152,
  rates: [
    // one entry per publication date
    { date: '2026-10-08', rate: 25634, rate_type: 'reference', 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

State Bank of Vietnam currently publishes rates covering 28 currencies against the VND (as of the latest table):

🇦🇪 AED · 🇦🇺 AUD · 🇧🇷 BRL · 🇨🇦 CAD · 🇨🇭 CHF · 🇨🇳 CNY · 🇩🇰 DKK · 🇪🇺 EUR · 🇬🇧 GBP · 🇭🇰 HKD · 🇮🇩 IDR · 🇮🇳 INR · 🇯🇵 JPY · 🇰🇭 KHR · 🇰🇷 KRW · 🇱🇦 LAK · 🇲🇴 MOP · 🇲🇾 MYR · 🇳🇴 NOK · 🇳🇿 NZD · 🇵🇱 PLN · 🇷🇺 RUB · 🇸🇪 SEK · 🇸🇬 SGD · 🇹🇭 THB · 🇹🇷 TRY · 🇹🇼 TWD · 🇺🇸 USD

🏛️ Source

The State Bank of Vietnam announces a daily USD/VND central rate — each announcement carrying its own decree number — around which banks may trade within a band, plus reference buying and selling rates for seven currencies and a weekly 27-currency cross-rate table used for customs and tax valuation. The central-rate series reaches back to 2009.

🧭 Reading the numbers

  • value is always quote currency per 1 unit of base currency (base: "EUR", quote: "USD", value: 1.15 means 1 EUR = 1.15 USD).
  • State Bank of Vietnam quotes VND per 1 unit of foreign currency (e.g. base: "USD", quote: "VND" means VND per one US dollar).
  • 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.
  • 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.

🧩 ERP & accounting systems

Loading the official State Bank of Vietnam rate into an accounting system is a supported workflow, not a hack. Step-by-step guides with the direction each system expects:

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/sbv/latest?format=xml&api_key=art_live_..."

🤖 AI agents

  • 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
  • Already using the general SDK or MCP server? Since 2026-10-01 @allratestoday/sdk 1.4+ has officialRates('sbv') and @allratestoday/mcp-server 0.6+ has a get_official_rates tool — 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-plugin then /plugin install allratestoday@allratestoday — bundles both MCP servers plus an /official-rate sbv ... command
  • Machine-readable site guide: llms.txt · for-ai-agents

⚖️ Published vs derived rates

If State Bank of Vietnam 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:

| method | derived | Meaning | | --- | --- | --- | | published | false | The central bank printed this pair directly | | inverse | true | Computed as 1 ÷ the published opposite direction | | cross | true | Computed via VND 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 State Bank of Vietnam | | 429 | Monthly quota exceeded |

🔷 TypeScript

Full definitions ship with the package — no @types install:

import type { LatestRates, PairRate, DatedRates, RateEntry, HistoryQuery, RequestOptions } from 'sbv-exchange-rate';

📦 CommonJS

const { getRate } = require('sbv-exchange-rate');

getRate('USD', 'VND', { apiKey: 'art_live_...' }).then((pair) => console.log(pair.rate));

💡 Quota tips

  • Rates change once per business day — cache the published 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 published table | | getLatestRates({ apiKey }) | Free | The central bank's full latest published 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 2009 |

📥 Bulk data (no key)

Need the whole archive rather than an API call? The same published tables are mirrored daily as open data:

🔗 Links

📜 License

MIT