レンジエンドポイントを使う start_date と end_date は両端を含みます。base は USD が既定、symbols はカンマ区切りです。日本語の履歴ツールも使えます。
data は保存された行です。has_more と next_cursor を使い、CSV と Parquet なら対応期間全体を取得できます。
GET /v1/range copy
$ curl -G "https://api.exchangerate.dev/v1/range" \
-H "Authorization: Bearer exr_live_..." \
--data-urlencode "base=USD" \
--data-urlencode "symbols=EUR,GBP" \
--data-urlencode "start_date=2026-06-10" \
--data-urlencode "end_date=2026-06-13" レスポンスを読む data は保存された行です。has_more と next_cursor を使い、CSV と Parquet なら対応期間全体を取得できます。
JSON copy
{
"result": "success",
"base": "USD",
"start_date": "2026-06-10",
"end_date": "2026-06-13",
"data": [
{ "date": "2026-06-10", "rates": { "EUR": 0.86663, "GBP": 0.74727 },
"source": "ecb_daily", "is_forward_filled": false },
{ "date": "2026-06-11", "rates": { "EUR": 0.86678, "GBP": 0.74829 },
"source": "ecb_daily", "is_forward_filled": false },
{ "date": "2026-06-12", "rates": { "EUR": 0.86453, "GBP": 0.74613 },
"source": "ecb_daily", "is_forward_filled": false }
],
"has_more": false,
"next_cursor": null
} 暦日にない日付 2026 年 6 月 13 日(土)がないのは、レンジが暦日ごとの行を作らず保存観測だけを返すためです。
Python でページングする このループで各カーソルを最後まで取得します。
Python · requests copy
import requests
API = "https://api.exchangerate.dev/v1"
KEY = "exr_live_..." # free key at https://exchangerate.dev/signup
params = {
"base": "USD",
"symbols": "EUR,GBP",
"start_date": "2026-06-10",
"end_date": "2026-06-13",
}
rows = []
while True:
resp = requests.get(
f"{API}/range",
headers={"Authorization": f"Bearer {KEY}"},
params=params,
timeout=10,
)
resp.raise_for_status()
data = resp.json()
rows.extend(data["data"])
if not data["has_more"]:
break
cursor = data.get("next_cursor")
if not cursor or cursor <= params.get("cursor", ""):
raise RuntimeError("Incomplete historical response")
params["cursor"] = cursor
for row in rows:
filled = row["is_forward_filled"]
print(row["date"], row["rates"]["EUR"], row["rates"]["GBP"], "filled" if filled else "") 保存値と繰り越し値 レンジ観測の is_forward_filled は false です。日付指定では直前値を返して true になる場合があります。
週末は観測値ではありません
レンジは 2026 年 6 月 13 日(土)を省略します。直接検索では直前値と is_forward_filled true が返る場合があります。
日付指定とレンジの選択 単日は日付指定、グラフやバックフィルはレンジが適しています。
項目 日付指定 レンジ
リクエスト 1 日 1 回+ページ
レスポンス 1 日分 data 配列
カバレッジを確認する 1,830 日は上限で、すべての通貨ペアの深さを保証しません。source、行、data: [] を確認してください。
pandas pandas に読み込み、日付順に並べてから繰り越し値を除外します。
Python · pandas copy
import pandas as pd
# rows contains every page from the loop above
df = pd.json_normalize(rows)
df["date"] = pd.to_datetime(df["date"])
df = df.set_index("date").sort_index()
# keep only rows that were actually published that day
df = df[~df["is_forward_filled"]]
print(df[["rates.EUR", "rates.GBP"]].tail()) pandas は任意で、同じ行を別のツールでも扱えます。
日本語の過去レート検索で日付を調べる