tcmb-exchange-rate
v1.0.1
Published
Official Central Bank of Türkiye (Türkiye) daily exchange rates — ~20 currencies vs TRY, history since 2020. Zero-dependency Node.js/TypeScript client.
Downloads
127
Maintainers
Readme
Central Bank of Türkiye Exchange Rate API client
Official Central Bank of Türkiye (Türkiye) daily exchange rates in Node.js / TypeScript — ~20 currencies against the TRY, with history back to 2020. Zero dependencies, works in Node 18+, Bun, Deno, and edge runtimes (uses global fetch).
These are the published central bank rates required for tax filings, customs valuations, audits, and compliant invoicing — not moving market rates. Every response carries the bank's own publication date.
Powered by AllRatesToday. Get a free API key at allratestoday.com/register — 300 requests/month, no credit card.
Install
npm install tcmb-exchange-rateQuick start
import { getRate, getLatestRates } from 'tcmb-exchange-rate';
// One pair at the official Central Bank of Türkiye rate
const pair = await getRate('USD', 'TRY', { apiKey: 'art_live_...' });
console.log(pair.rate, pair.rate_date); // e.g. USD -> TRY on the bank's own date
// The bank's full published table
const table = await getLatestRates({ apiKey: 'art_live_...' });
console.log(table.rate_date, table.rates.length);Historical data (paid plans)
import { getRatesForDate, getHistory } from 'tcmb-exchange-rate';
// The official table for an invoice date — weekends/holidays return the
// most recent published date, flagged via published_on_requested_date.
const day = await getRatesForDate('2026-06-30', { apiKey: 'art_live_...' });
// Daily series for one pair
const series = await getHistory(
{ source: 'USD', target: 'TRY', from: '2026-01-01' },
{ apiKey: 'art_live_...' }
);Published vs derived rates
If Central Bank of Türkiye does not print a pair directly, the API resolves it from the bank's table (inverse, or a cross rate via TRY) and flags it derived: true with the method — so official and computed values are never confused.
Notes
- Every request counts toward your AllRatesToday monthly quota. Rates change once per business day — cache a day's table locally and a small quota goes a long way.
- Latest rates are on every plan (including free); historical dates and time series need a paid plan.
- Full API reference: allratestoday.com/docs#central-bank · All covered banks: central bank rates API
License
MIT
