Building an AI agent? Start with /llms.txt for the full site index.
Capital Flows
Market-wide total margin-purchase and short-sale balances per trading day from the official TWSE margin trading report.
← Total margin & short overview
GET /v2/datasets/total-margin-shortTotal margin & short is a Taiwan market dataset sourced from TWSE, served by TW Market Data as GET /v2/datasets/total-margin-short.
total-margin-short returns one market-wide row per trading day with the total margin-purchase and short-sale balances across all listed stocks, sourced from the official TWSE margin trading report. Each row carries its source role so the totals are traceable. This endpoint is a preview surface — coverage is currently partial and served as a snapshot rather than a fully backfilled history.
| Field | Type | Description |
|---|---|---|
market | string | |
trade_date | string | |
margin_purchase_balance_total | number | |
short_sale_balance_total | number | |
margin_purchase_buy_total | number | |
margin_purchase_sell_total | number | |
short_sale_buy_total | number | |
short_sale_sell_total | number | |
margin_purchase_amount_total | null | |
currency | string | |
market_scope | string |
| Rows | 9,971 |
| Window | 2000-11-28 – 2026-09-02 |
| Grade | Reference |
| Measured | 2026-09-03from the dataset registry |
A real response from this endpoint. Rows are returned under "rows", and provenance is carried in the shape shown below — it is not identical across datasets, so read this page's rather than assuming another's.
{
"dataset": "total_margin_short",
"dataset_id": "total_margin_short",
"rows": [
{
"market": "TWSE",
"trade_date": "2026-08-03",
"margin_purchase_balance_total": 9120700,
"short_sale_balance_total": 185322,
"margin_purchase_buy_total": 490794,
"margin_purchase_sell_total": 510139,
"short_sale_buy_total": 35122,
"short_sale_sell_total": 32051,
"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": {
"emitter": "build_margin_short_total_candidates",
"derivation": "sum per-ticker margin_short_enhanced by (market,trade_date)",
"verified_vs": "total_margin_short_daily_items official overlap (n6, 1551/1551)"
},
"data_gaps": [
"<Chinese value - see the zh page>"
],
"not_investment_advice": true
}
],
"count": 1,
"plan_id": "enterprise",
"meta": {
"plan": "enterprise",
"row_limit": 100000,
"market": "TWSE",
"start_date": "2026-08-03",
"end_date": "2026-08-03",
"private_beta_contract": true,
"twse_only_scope": true,
"is_limited": false
}
}Captured from the live API on 2026-07-20.
Chinese data values are shown as a marker here so this page stays in English; the /zh page shows them verbatim.
These columns are returned alongside the data and record where the row came from. They are provenance, not the dataset's subject matter, so they are listed here rather than in the field table.
source_providersource_rolesource_lineagedata_gapsnot_investment_advicePart of the data in this service is obtained from the Government Open Data Platform (data.gov.tw) and used under the Open Government Data License, version 1.0. Providing agencies: Taiwan Stock Exchange, Taipei Exchange, Taiwan Futures Exchange, Taiwan Depository & Clearing Corporation, National Development Council, Central Bank of the Republic of China (Taiwan), Department of Statistics of the Ministry of Economic Affairs, and Customs Administration of the Ministry of Finance. The value-added processing, derived calculations and presentation in this service are the responsibility of TWMD and are not associated with the providing agencies.
TW Market Data. (n.d.). Total margin & short [Data set]. TW Market Data. Retrieved 2026-09-05, from https://twmarketdata.com/en/docs/api/capital-flows/total-margin-short
The version is the dataset's own as_of, not the date this page was built. Where we have no as_of the field is left out rather than filled in. Check a signature
Datasets that join with this one. The key each pair aligns on is shown, so you can plan a multi-table query without guessing.
Joins on market + trade_date
Joins on market + trade_date
Joins on market + trade_date
Joins on market + trade_date
Joins on market + trade_date
curl "https://api.twmarketdata.com/v2/datasets/total-margin-short?start_date=2026-08-03&end_date=2026-08-03" \
-H "X-API-Key: sk_live_..."| Parameter | Required | Type | Description |
|---|---|---|---|
symbol | Yes | string | Ticker, e.g. 2330. |
start_date | No | string (YYYY-MM-DD) | Start of the query range. |
end_date | No | string (YYYY-MM-DD) | End of the query range. |
limit | No | integer | Maximum rows to return. |
import requests
resp = requests.get(
"https://api.twmarketdata.com/v2/datasets/total-margin-short",
params={},
headers={"X-API-Key": "sk_live_..."},
)
resp.raise_for_status()
print(resp.json()["rows"])This endpoint is GET /v2/datasets/total-margin-short. The full machine-readable schema (parameters, security, response envelope) lives in the OpenAPI spec.