A nightly job that loads the Central Bank of the Republic of Türkiye's (TCMB) exchange rates looks trivial: fetch once a day, store, done. Three things break it in practice: when TCMB publishes, the days it doesn't, and how some currencies are quoted.
This post uses a year of TCMB publication dates from the AllRatesToday TCMB endpoint (25 November 2025 to 25 November 2026) to show where those traps are.
1. Schedule after the bulletin, not at midnight
TCMB announces its indicative rates once per business day in the afternoon, around 15:30 Istanbul time. The API reports when the table usually lands and when it's safe to fetch:
{ "bank": "tcmb", "rate_date": "2026-11-25", "usually_at_utc": "13:14", "available_by_utc": "13:25", "publisher_timezone": "Europe/Istanbul", "stale": false } So schedule after 13:25 UTC (16:25 Istanbul), not at 00:00. A job that runs at midnight still works, but it's loading yesterday afternoon's table and calling it today's. Use the rate_date from the response, never the job's run date.
2. Thirteen weekdays without a table
Over the year, TCMB published 249 tables. Every weekday without one:
| Date | Day | Why |
|---|---|---|
| 2026-01-01 | Thu | New Year's Day |
| 2026-03-19 | Thu | Eve of Ramazan Bayramı (half day) |
| 2026-03-20 | Fri | Ramazan Bayramı |
| 2026-04-23 | Thu | National Sovereignty and Children's Day |
| 2026-05-01 | Fri | Labour Day |
| 2026-05-19 | Tue | Youth and Sports Day |
| 2026-05-26 | Tue | Eve of Kurban Bayramı (half day) |
| 2026-05-27 | Wed | Kurban Bayramı |
| 2026-05-28 | Thu | Kurban Bayramı |
| 2026-05-29 | Fri | Kurban Bayramı |
| 2026-07-15 | Wed | Democracy and National Unity Day |
| 2026-10-28 | Wed | Eve of Republic Day (half day) |
| 2026-10-29 | Thu | Republic Day |
The half-day eves (arife) are the trap. They're working days for most offices, so a job that only skips official full-day holidays will expect a table, not find one, and either fail or store yesterday's table under today's date. In this archive there was no table dated on any of the three eves.
The religious holidays move about 11 days earlier each year, so don't hard-code them. Two safer patterns:
Ask TCMB's calendar, not yours. The availability endpoint lists the dates TCMB actually published:
import requests H = {"Authorization": "Bearer art_live_your_key"} av = requests.get("https://allratestoday.com/api/v1/central-bank/tcmb/availability", headers=H).json() published = set(av["dates"]) # e.g. 249 dates for the last year Or ask for the date you need and read back the date you got. The dated endpoint returns the table in force on that date. On a holiday, that's the last one published before it, flagged as such:
r = requests.get("https://allratestoday.com/api/v1/central-bank/tcmb/2026-05-27", params={"source": "USD", "target": "TRY", "type": "buy"}, headers=H).json() print(r["requested_date"], r["rate_date"], r["published_on_requested_date"]) # Expected from the publication dates above: 2026-05-27, 2026-05-25, False # (27 May is Kurban Bayramı and the 26th was the eve, so the table in force is the 25th's) For accounting, that carry-forward is usually what you want: the rate in force on a bayram day is the last one published. Just store rate_date next to the amount, so the audit trail shows which table you used.
3. JPY is per 100, and so is anything else TCMB says it is
TCMB's own XML (https://www.tcmb.gov.tr/kurlar/today.xml) quotes some currencies per 100 units. On 25 November 2026:
<Currency Kod="JPY"> <Unit>100</Unit> <ForexBuying>31.6512</ForexBuying> <ForexSelling>31.8607</ForexSelling> </Currency> That's TRY per 100 yen. A parser that ignores <Unit> books JPY a hundred times too expensive. If you parse TCMB directly, divide by Unit every time. Don't special-case JPY; read the unit for each currency.
The API does this for you and always returns per-1 values: JPY/TRY comes back as 0.316512 buying and 0.318607 selling.
4. Buy and sell are separate rows
Each currency has a forex buying and a forex selling rate (TCMB also has banknote columns, which the API doesn't carry). In the API they're separate rows with type: "buy" and type: "sell":
{ "base": "USD", "quote": "TRY", "type": "buy", "value": 50.5531 }, { "base": "USD", "quote": "TRY", "type": "sell", "value": 50.6441 } Store both, or decide up front which one you need. Turkish VAT defaults to the forex buying rate. Ask for a single pair with ?source=USD&target=TRY&type=buy so the code says which one it means.
A job that handles all four
import datetime as dt, requests API = "https://allratestoday.com/api/v1/central-bank/tcmb" H = {"Authorization": "Bearer art_live_your_key"} def load_latest(store): t = requests.get(f"{API}/latest", headers=H, timeout=30).json() if t["stale"]: print("TCMB table older than its usual cadence; check before trusting it") for row in t["rates"]: # per-1 values, buy and sell as separate rows store.upsert(date=t["rate_date"], base=row["base"], quote=row["quote"], kind=row["type"], value=row["value"]) return t["rate_date"] # Run weekdays at 13:30 UTC. On a holiday or bayram eve, /latest still returns the last # table with its own rate_date, and the upsert just rewrites the same rows: no gap, no fake date. Links
- TCMB official rates: https://allratestoday.com/central-bank-rates-api/tcmb/
- Every central bank's publication time: https://allratestoday.com/central-bank-rates-api/institutions/
- Free API key: https://allratestoday.com/register/
TCMB rates are the official indicative rates of the Central Bank of the Republic of Türkiye. Holiday names are our labels for the dates with no table, not TCMB's.
