TW Market Data LogoTW Market Data

核心資料

市場與價格

TWSE / TPEx 日線、還原價格、指數與市場廣度

財務與成長

月營收、財報三表、財務指標與估值資料

籌碼與資金

三大法人與融資融券資料

公司與結構

公司與事件

公司基本資料、公告、事件、公司行動與股利

分類與結構

主題分類、指數分類與跨資料集 mapping

策略與量化

Features、Factor Data、Time Alignment 與 Screener

平台能力

API 存取

REST API、認證與第一個 request

查詢與工具

Search API、Query API、欄位清單與查詢範例

Tools / MCP

Agent workflow、MCP tools 與 OpenAPI 入口

方案價格文件觀點文章
EN儀表板

TW Market Data(TWMD)提供之歷史資料與統計,非投資建議;投資決策與風險由您自行判斷。

隱私政策|服務條款|幫助中心||EN|TW Market Data © 2026

文件總覽

DASHBOARD

儀表板定價

FOR AI AGENTS

MCP Serverllms.txt工具清單OpenAPI SpecAgent 工作流範例
Webhooks建置中

OVERVIEW

總覽快速開始認證來源政策資料分級資料血緣市場覆蓋

DATA APIS

三大法人買賣借券資料董監持股股權分散法人市場匯總增強融資融券現股當沖暫停融資融券整體融資融券匯總籌碼流向

GUIDES

如何取得財報三表如何查三大法人籌碼如何看市場狀態如何接策略・AI Agent

SDKS

Release StatusPython SDKJavaScript / TypeScript SDK

AI agent?先讀 /llms.txt 取得全站索引。

籌碼與資金

整體融資融券匯總

全市場每交易日融資與融券總餘額,來源為官方 TWSE 信用交易報表。

參考來源: TWSE·方案: starter·計費: 2 點·GET /v2/datasets/total-margin-short

總覽

total-margin-short 以官方 TWSE 信用交易報表為源,每交易日回傳一列全市場資料,含全體上市股票的融資與融券總餘額;每列附來源角色,總額可追溯。此端點為預覽面——目前涵蓋為部分資料,以快照形式提供,尚非完整回補的歷史。

欄位型別說明
datestring交易日。
total_margin_balancenumber全市場融資總餘額(新台幣仟元)。
total_short_balancenumber全市場融券總餘額(仟股)。
margin_changenumber融資總餘額日變動(新台幣仟元)。
source_rolestring正規來源角色(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。

本頁顯示原始中文值;英文頁會以標記取代,以維持全英文。

快速開始

  1. 把你的金鑰放進 X-API-Key 標頭。
  2. 加上查詢參數(symbol、日期區間、limit)。
  3. 送出請求並讀取 rows 陣列。
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回傳筆數上限。

Python 範例

第一個呼叫:

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)

OpenAPI

此端點為 GET /v2/datasets/total-margin-short。完整機器可讀 schema(參數、認證、回應封裝)見 OpenAPI spec。

備註與限制

  • 預覽等級:涵蓋為部分且以快照提供,非完整回補的每日歷史——請勿假設每個交易日皆存在。

請求與回應

請求

curl "https://api.twmarketdata.com/v2/datasets/total-margin-short?symbol=2330&start_date=2026-01-01&end_date=2026-06-30&limit=5" \  -H "X-API-Key: $TWMD_API_KEY"

以 X-API-Key 標頭認證,使用儀表板發放的 sk_live_ 金鑰。

回應

JSON
{  "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  }}

擷取自對此端點的真實呼叫,非手寫。

此資料集的資料列在 "rows" 之下。各資料集的信封不同,請以本頁為準,勿沿用其他頁的形狀。

本頁的分級徽章屬文件分級,並非回應欄位。