AI agent?先讀 /llms.txt 取得全站索引。
市場結構與參考
交易日曆
交易日曆
參考來源: TWSE / TPEx·方案: free·計費: 1 點·
GET /v2/datasets/trading-calendar交易日曆是台灣市場資料集,來源為 TWSE / TPEx,由 TW Market Data 以 GET /v2/datasets/trading-calendar 提供。
總覽
交易日曆——每列粒度:trade_date / market。
| 欄位 | 型別 | 說明 |
|---|---|---|
trade_date | string | |
market | string | |
is_trading_day | boolean | |
calendar_source | string | |
derived_from_price | boolean | |
price_coverage_count | number | |
source_confidence | string | |
data_gap_reason | string | |
closure_reason | null |
範例回應
此為本端點的真實回應。資料列位於 "data" 之下,來源資訊如下方所示;各資料集形狀不盡相同,請以本頁為準。
{ "dataset_id": "trading_calendar", "request_context": { "scope": "twse_tpex_trading_day_calendar", "coverage_type": "daily", "filters": { "market": null, "trade_date": "2026-08-05", "date_from": null, "date_to": null, "limit": 50 }, "min_trade_date": "2026-08-05", "max_trade_date": "2026-08-05" }, "quality": { "row_count": 2, "trading_day_count": 2, "non_trading_day_count": 0, "derived_from_price_count": 2, "markets_present": [ "TPEx", "TWSE" ], "sensitive_fields_exposed": false }, "lineage": { "calendar_sources": [ "derived_from_price_observations" ], "semantics": "One row per (trade_date, market) recording whether the market traded. DERIVED from observed price rows; price_coverage_count is how many securities were seen trading that day, which is the evidence behind is_trading_day." }, "error": null, "data": [ { "trade_date": "2026-08-05", "market": "TPEx", "is_trading_day": true, "calendar_source": "derived_from_price_observations", "derived_from_price": true, "price_coverage_count": 1012, "source_confidence": "high", "data_gap_reason": "official_calendar_not_integrated;derived_from_observed_price_rows", "closure_reason": null }, { "trade_date": "2026-08-05", "market": "TWSE", "is_trading_day": true, "calendar_source": "derived_from_price_observations", "derived_from_price": true, "price_coverage_count": 1377, "source_confidence": "high", "data_gap_reason": "official_calendar_not_integrated;derived_from_observed_price_rows", "closure_reason": null } ], "data_count": 2, "known_gaps": [ "derived_from_observed_price_rows_not_an_official_exchange_calendar", "future_dates_have_no_row_absence_is_not_a_declared_holiday", "closure_reason_is_populated_only_where_a_reason_was_recoverable" ], "warnings": [ "not_investment_advice" ], "envelope": { "dataset_id": "trading_calendar", "scope": "twse_tpex_trading_day_calendar", "row_count": 2 }}擷取自 2026-07-20 的線上 API。
快速開始
- 把你的金鑰放進 X-API-Key 標頭。
- 加上查詢參數(symbol、日期區間、limit)。
- 送出請求並讀取 data 陣列。
curl "https://api.twmarketdata.com/v2/datasets/trading-calendar?symbol=2330" \ -H "X-API-Key: sk_live_..."篩選參數
| 參數 | 必填 | 型別 | 說明 |
|---|---|---|---|
symbol | 否 | string | 以股票代碼篩選單一標的。 |
limit | 否 | integer | 回傳筆數上限。 |
Python 範例
第一個呼叫:
import requests resp = requests.get( "https://api.twmarketdata.com/v2/datasets/trading-calendar", params={"symbol": "2330"}, headers={"X-API-Key": "sk_live_..."},)resp.raise_for_status()print(resp.json()["data"])帶日期區間篩選:
import requests # The full verified example — the same call with every supported filter set.resp = requests.get( "https://api.twmarketdata.com/v2/datasets/trading-calendar", params={"symbol": "2330"}, headers={"X-API-Key": "sk_live_..."},)resp.raise_for_status()for row in resp.json()["data"]: print(row)OpenAPI
此端點為 GET /v2/datasets/trading-calendar。完整機器可讀 schema(參數、認證、回應封裝)見 OpenAPI spec。
備註與限制
- 未來交易日為官方已公告行事曆,事前即為已知,故 PIT-safe。但本表由實際價格列推導:未來日期沒有列代表『尚無證據』,不等於『宣告休市』。max(trade_date) 不可當 staleness。