AI agent?先讀 /llms.txt 取得全站索引。
籌碼與資金
全市場每交易日融資與融券總餘額,來源為官方 TWSE 信用交易報表。
GET /v2/datasets/total-margin-shorttotal-margin-short 以官方 TWSE 信用交易報表為源,每交易日回傳一列全市場資料,含全體上市股票的融資與融券總餘額;每列附來源角色,總額可追溯。此端點為預覽面——目前涵蓋為部分資料,以快照形式提供,尚非完整回補的歷史。
| 欄位 | 型別 | 說明 |
|---|---|---|
date | string | 交易日。 |
total_margin_balance | number | 全市場融資總餘額(新台幣仟元)。 |
total_short_balance | number | 全市場融券總餘額(仟股)。 |
margin_change | number | 融資總餘額日變動(新台幣仟元)。 |
source_role | string | 正規來源角色(official_twse_margin_total)。 |
| 列數 | 9,936 |
| 涵蓋起訖 | 2000-11-28 至 2026-07-09 |
| 分級 | 參考 |
此為本端點的真實回應。資料列位於 "rows" 之下,來源資訊如下方所示;各資料集形狀不盡相同,請以本頁為準。
{ "dataset": "total_margin_short", "dataset_id": "total_margin_short", "rows": [ { "market": "TWSE", "trade_date": "2026-07-09", "margin_purchase_balance_total": 9614955, "short_sale_balance_total": 203714, "margin_purchase_buy_total": 372813, "margin_purchase_sell_total": 342105, "short_sale_buy_total": 24248, "short_sale_sell_total": 24111, "margin_purchase_amount_total": null, "currency": "TWD", "market_scope": "TWSE", "source_provider": "derived_twmd", "source_role": "derived_market_total_from_margin_short_enhanced", "source_lineage": { "derivation": "sum per-ticker margin_short_enhanced by (market,trade_date)", "verified_vs": "total_margin_short_daily_items official overlap 100%" }, "data_gaps": [ "margin_purchase_amount_total=金額不在逐檔源→NULL" ], "not_investment_advice": true }, { "market": "TWSE", "trade_date": "2026-07-08", "margin_purchase_balance_total": 9590605, "short_sale_balance_total": 205830, "margin_purchase_buy_total": 406961, "margin_purchase_sell_total": 340331, "short_sale_buy_total": 29930, "short_sale_sell_total": 25013, "margin_purchase_amount_total": null, "currency": "TWD", "market_scope": "TWSE", "source_provider": "derived_twmd", "source_role": "derived_market_total_from_margin_short_enhanced", "source_lineage": { "derivation": "sum per-ticker margin_short_enhanced by (market,trade_date)", "verified_vs": "total_margin_short_daily_items official overlap 100%" }, "data_gaps": [ "margin_purchase_amount_total=金額不在逐檔源→NULL" ], "not_investment_advice": true } ], "count": 50, "plan_id": "enterprise", "meta": { "plan": "enterprise", "row_limit": 100000, "market": "TWSE", "start_date": null, "end_date": "2026-07-20", "private_beta_contract": true, "twse_only_scope": true, "is_limited": false }}擷取自 2026-07-20 的線上 API。
本頁顯示原始中文值;英文頁會以標記取代,以維持全英文。
curl "https://api.twmarketdata.com/v2/datasets/total-margin-short?symbol=2330" \ -H "X-API-Key: sk_live_..."| 參數 | 必填 | 型別 | 說明 |
|---|---|---|---|
symbol | 是 | string | 股票代碼,例如 2330。 |
start_date | 否 | string (YYYY-MM-DD) | 查詢起始日期。 |
end_date | 否 | string (YYYY-MM-DD) | 查詢結束日期。 |
limit | 否 | integer | 回傳筆數上限。 |
第一個呼叫:
import requests resp = requests.get( "https://api.twmarketdata.com/v2/datasets/total-margin-short", params={"symbol": "2330"}, headers={"X-API-Key": "sk_live_..."},)resp.raise_for_status()print(resp.json()["rows"])帶日期區間篩選:
import requests # The full verified example — the same call with every supported filter set.resp = requests.get( "https://api.twmarketdata.com/v2/datasets/total-margin-short", params={"symbol": "2330"}, headers={"X-API-Key": "sk_live_..."},)resp.raise_for_status()for row in resp.json()["rows"]: print(row)此端點為 GET /v2/datasets/total-margin-short。完整機器可讀 schema(參數、認證、回應封裝)見 OpenAPI spec。