Every audit season someone in a Saudi finance team needs a year of official riyal exchange rates in a spreadsheet. The Saudi Central Bank (SAMA) shows them on its website one date at a time, which is fine for checking a single invoice and painful for anything else.
This post covers what history exists, the difference between the series (they're not interchangeable), and how to pull it into pandas or Excel.
Three series, not one
SAMA's figures come in two shapes, and a dataset that mixes them up will give you wrong answers.
| Series | What it is | Coverage |
|---|---|---|
Daily table (reference) |
SAMA's daily rate for 66 currencies, one table per calendar day | 10 April 2021 to today |
Monthly average (monthly_average) |
Average for the month, as SAMA reports it | January 2009 to July 2026, 12 currencies |
End of period (close) |
Month-end value, as SAMA reports it | January 2009 to July 2026, 12 currencies |
The 12 currencies in the monthly series are USD, EUR, GBP, JPY, CHF, CNY, INR, KRW, AUD, BRL, THB and TRY.
Here's why the distinction matters. Euro against the riyal at the end of 2025:
| Series | 31 Dec 2025 |
|---|---|
| Daily table | 4.40943 |
End of period (close) |
4.40626 |
| December average | 4.39063 |
Three different "official SAMA rates for 31 December", all legitimately SAMA's. If your policy says "the SAMA rate on the reporting date", you want the daily table. If it says "the average rate for the period", you want the monthly average. Write down which one and stick with it, because the auditor will recompute with whichever series your policy names.
Getting the daily series through the API
The history endpoint takes one currency pair and a date range and returns every row in it. It's on paid plans and counted as one call per month of data:
curl -H "Authorization: Bearer YOUR_KEY" \
"https://allratestoday.com/api/v1/central-bank/sama/history?source=EUR&target=SAR&from=2026-01-01&to=2026-11-26"
Add &format=csv (or xlsx) and the same call gives you a file you can open directly.
pandas
import io, os, requests
import pandas as pd
KEY = os.environ["ALLRATES_KEY"]
def sama_history(ccy, start, end):
r = requests.get(
"https://allratestoday.com/api/v1/central-bank/sama/history",
params={"source": ccy, "target": "SAR", "from": start, "to": end, "format": "csv"},
headers={"Authorization": f"Bearer {KEY}"},
timeout=30,
)
r.raise_for_status()
return pd.read_csv(io.StringIO(r.text))
eur = sama_history("EUR", "2025-01-01", "2025-12-31")
# columns: rate_date, source, target, rate, rate_type, derived, method
daily = (eur[eur.rate_type == "reference"]
.assign(rate_date=lambda d: pd.to_datetime(d.rate_date))
.set_index("rate_date")["rate"])
print(daily["2025-12-31"]) # 4.40943
Filter on rate_type first: a range that crosses month-ends can carry SAMA's monthly rows alongside the daily ones. From there the usual moves are a month-end pick (daily.resample("ME").last()) or a period average (daily.resample("ME").mean()). Note that your own average of the daily table will not exactly match SAMA's monthly_average, since SAMA computes its own. If the policy says "SAMA's monthly average", use SAMA's figure rather than computing one.
Because SAMA dates a table for every calendar day, including weekends, you don't need asof() tricks to fill gaps. The row for 31 October 2026 (a Saturday) exists: EUR → SAR 4.18612.
Excel
Download the CSV from the call above and use Data > Get Data > From Text/CSV. Power Query loads it as a table; filter rate_type to reference, then XLOOKUP the invoice date:
=XLOOKUP(A2, sama[rate_date], sama[rate])
Save a newer download over the same file and Refresh picks it up.
A free copy for research
If you're doing research rather than running a business system, the same history is in the open central-bank-exchange-rates dataset on Hugging Face as rates/sama.csv. It's gated: request access with a free AllRatesToday API key and it's approved in a few minutes. The licence is CC BY-NC 4.0, so commercial systems should use the API.
Sanity checks before you hand it to the auditor
- USD should be 3.75 on every row. The riyal has been pegged there since 1986. Anything else means a column got shifted.
- Count the rows. A full year of the daily series has 365 (or 366) rows per currency. Fewer means a gap in your pull, not in SAMA's table.
- Check one date by hand against SAMA's website. One matching spot check saves a long conversation later.
The current table, the npm package and the endpoint list are on the SAMA exchange rate API page.
Top comments (0)