從 economics 端點讀取每家央行的目前政策利率及其變動歷史,再從 predictions API 加入市場隱含路徑。利率說明目前政策所處的位置,路徑則給出未來每次會議降息、維持或升息的機率。
讀取目前政策利率
GET /v1/economics/{country}/central-bank/policy-rate 回傳一個國家目前生效的利率。這個請求查詢的是美國。
curl -s -H "Authorization: Bearer $NARWHAL_API_KEY" \
"https://api.narwhalapi.com/v1/economics/USA/central-bank/policy-rate"{
"country": "USA",
"authority": "federal_reserve",
"currency": "USD",
"instrument": "federal_funds_target_range",
"unit": "percent",
"effective_on": "2026-09-17",
"observed_on": null,
"announced_on": null,
"rate_type": "range",
"lower_bound": "3.75",
"upper_bound": "4.00"
}聯準會設定的是目標區間,因此 rate_type 為 range,回應包含 lower_bound 3.75 和 upper_bound 4.00(百分比)。該區間於 effective_on 2026-09-17 生效。設定單一利率的銀行,rate_type 為 point,並只有一個 rate 欄位,而不是兩個邊界。
| 國家 | instrument | 利率 | 日期欄位 |
|---|---|---|---|
| USA | federal_funds_target_range | 3.75 至 4.00 | effective_on 2026-09-17 |
| GBR | bank_rate | 3.75 | effective_on 2025-12-18 |
| JPN | overnight_call_rate_target | 1.25 | observed_on 2026-10-27 |
查看利率是如何走到現在的
加上 /history 可讀取利率觀測序列。start 參數設定起始日期,limit 和 cursor 用於對較長的歷史分頁。這個請求從 2025 年 9 月開始。
curl -s -H "Authorization: Bearer $NARWHAL_API_KEY" \
"https://api.narwhalapi.com/v1/economics/USA/central-bank/policy-rate/history?start=2025-09-01"{
"country": "USA",
"observations": [
{
"country": "USA",
"authority": "federal_reserve",
"currency": "USD",
"instrument": "federal_funds_target_range",
"unit": "percent",
"effective_on": "2025-09-18",
"observed_on": null,
"announced_on": null,
"rate_type": "range",
"lower_bound": "4.00",
"upper_bound": "4.25"
},
{
"country": "USA",
"authority": "federal_reserve",
"currency": "USD",
"instrument": "federal_funds_target_range",
"unit": "percent",
"effective_on": "2025-10-30",
"observed_on": null,
"announced_on": null,
"rate_type": "range",
"lower_bound": "3.75",
"upper_bound": "4.00"
}
],
"next_cursor": null
}完整回應依由舊到新共有四列,程式碼區塊裡顯示了兩列。用每一列的上限減去前一列的上限,就得到變動幅度:2025-10-30 為 -25 個基點,2025-12-11 為 -25,2026-09-17 為 +25。下面的腳本用 Decimal 做這個減法,因此利率不會引入浮點誤差。對於較長的歷史,請同時傳入 end,或持續跟隨 next_cursor 直到它為 null。
讀取市場隱含路徑
GET /v1/predictions/policy-paths/federal-reserve 回傳未來每次會議的機率。路徑只包含變動,不包含目前利率,所以請從上面的端點讀取利率。
curl -s -H "Authorization: Bearer $NARWHAL_API_KEY" \
"https://api.narwhalapi.com/v1/predictions/policy-paths/federal-reserve"{
"as_of": "2026-11-03T02:34:00Z",
"meetings": [
{
"event_id": "usa-fed-2026-12",
"p_cut": "0.0096",
"p_hold": "0.2533",
"p_hike": "0.7371",
"expected_change_bps": "18.6",
"cumulative_change_bps": "18.6",
"resolves_at": "2026-12-09T19:00:00Z"
},
{
"event_id": "usa-fed-2027-01",
"p_cut": "0.0280",
"p_hold": "0.7055",
"p_hike": "0.2665",
"expected_change_bps": "6.0",
"cumulative_change_bps": "24.6",
"resolves_at": "2027-01-27T19:00:00Z"
}
]
}as_of 標明機率的日期。對每次會議,resolves_at 是決議時間,p_cut、p_hold 和 p_hike 是總和為 1 的機率。第一次會議的升息機率為 73.7%,expected_change_bps 為 18.6。cumulative_change_bps 把各次會議累加起來:18.6 加 6.0 等於第二次會議後的 24.6。
要查看其他銀行,請更換路徑中的 authority,例如 bank-of-japan。meetings 清單為空的回應表示該 authority 沒有列出會議,撰寫本頁時 bank-of-england 就是這種情況。
在一張表中比較三家銀行
觀察清單需要為每家銀行提供相同的欄位。利率取自利率端點,第一次會議取自該銀行 authority 名稱對應的路徑:federal-reserve、bank-of-england 或 bank-of-japan。
| 國家 | Authority | 目前利率 | 路徑中的第一次會議 | 升息機率 |
|---|---|---|---|---|
| USA | federal-reserve | 3.75 至 4.00 | 2026-12-09 | 百分之73.7 |
| GBR | bank-of-england | 3.75 | 未列出 | 不可用 |
| JPN | bank-of-japan | 1.25 | 2026-12-18 | 百分之83.6 |
英國這一列保持為空,因為撰寫本頁時其路徑沒有會議,而它的利率依然是最新的。即便如此,也請在表中保留這家銀行的一列。路徑為空時仍顯示利率,比把這家銀行拿掉更有用。使用前請重新讀取各路徑,因為 as_of 會隨機率更新而變化。
把利率和路徑放進一個腳本
- 取得 API 金鑰 在註冊頁取得 API 金鑰,並儲存在
NARWHAL_API_KEY中。 - 讀取每個國家的利率 腳本會印出 instrument、利率和日期。它使用
effective_on,當effective_on為 null 時退回使用observed_on。 - 計算變動幅度與機率 相鄰上限之間的差值給出以基點計的變動幅度,前兩次會議則以百分比印出升息和維持機率。
import os from decimal import Decimal import requests BASE = "https://api.narwhalapi.com" HEADERS = {"Authorization": f"Bearer {os.environ['NARWHAL_API_KEY']}"} def get(path, **params): r = requests.get(f"{BASE}{path}", headers=HEADERS, params=params, timeout=10) r.raise_for_status() return r.json() def text(o): if o["rate_type"] == "range": return f"{o['lower_bound']} to {o['upper_bound']}" return o["rate"] def top(o): return Decimal(o["upper_bound"] if o["rate_type"] == "range" else o["rate"]) for country in ("USA", "GBR", "JPN"): o = get(f"/v1/economics/{country}/central-bank/policy-rate") print(country, o["instrument"], text(o), "since", o["effective_on"] or o["observed_on"]) rows = get("/v1/economics/USA/central-bank/policy-rate/history", start="2025-09-01")["observations"] for before, now in zip(rows, rows[1:]): print(now["effective_on"], int((top(now) - top(before)) * 100), "bp") for m in get("/v1/predictions/policy-paths/federal-reserve")["meetings"][:2]: print(m["resolves_at"][:10], "hike", f"{Decimal(m['p_hike']) * 100:.1f}%", "hold", f"{Decimal(m['p_hold']) * 100:.1f}%", "expected", m["expected_change_bps"], "bp")
USA federal_funds_target_range 3.75 to 4.00 since 2026-09-17
GBR bank_rate 3.75 since 2025-12-18
JPN overnight_call_rate_target 1.25 since 2026-10-27
2025-10-30 -25 bp
2025-12-11 -25 bp
2026-09-17 25 bp
2026-12-09 hike 73.7% hold 25.3% expected 18.6 bp
2027-01-27 hike 26.6% hold 70.6% expected 6.0 bp哪個日期表示利率發生了變化?
有值時使用 effective_on,否則使用 observed_on。美國和英國回傳了 effective_on。日本回傳了 observed_on,其 effective_on 為 null。三份回應中的 announced_on 均為 null。
可以讀取過去某天的利率嗎?
可以。向政策利率端點傳入 date。對美國請求 date=2025-11-15,回傳了 3.75 至 4.00 的區間,effective_on 為 2025-10-30,即該區間開始的日期。
路徑中包含目前利率嗎?
不包含。它只提供每次會議的機率和以基點計的預期變動幅度,所以請把變動幅度加到你從政策利率端點讀到的利率上。把基點除以 100 就得到百分點:第一次會議的 18.6 個基點等於 0.186 個百分點。
這是對降息、維持、升息各種結果依機率加權的平均值,是各種結果的混合,並不是央行將要宣布的某個變動幅度。
發布於 。