TW Market Data LogoTW Market Data

Core data

Market & prices

TWSE / TPEx daily bars, adjusted prices, indices, and market breadth

Financials & growth

Monthly revenue, the three financial statements, financial metrics, and valuation data

Flows & positioning

Institutional investors and margin & short-selling data

Company & structure

Company & events

Company profiles, disclosures, events, corporate actions, and dividends

Taxonomy & structure

Theme taxonomy, index classification, and cross-dataset mapping

Strategy & quant

Features, factor data, time alignment, and screener

Platform capabilities

API access

REST API, authentication, and your first request

Query & tools

Search API, Query API, field lists, and query examples

Tools / MCP

Agent workflows, MCP tools, and the OpenAPI entry point

PricingDocsBlog
中文Dashboard

TW Market Data (TWMD) provides historical data and statistics, not investment advice; investment decisions and their risks are your own.

Privacy Policy|Terms of Service|Help Center||中文|TW Market Data © 2026

Documentation

DASHBOARD

DashboardPricing

FOR AI AGENTS

MCP Serverllms.txtTool manifestOpenAPI SpecAgent workflow examples
WebhooksBuilding

OVERVIEW

OverviewQuick startAuthenticationSource policyData gradesData lineageMarket coverage

DATA APIS

Institutional flowSecurities lendingInsider & director holdingsOwnership distributionInstitutional flow (market aggregate)Enhanced margin & shortDay-trading suspensionMargin & shortTotal margin & shortChip flows

GUIDES

How to get the 3 financial statementsHow to read institutional flowsHow to check market statusHow to wire a strategy / AI agent

SDKS

Release statusPython SDKJavaScript / TypeScript SDK

Building an AI agent? Start with /llms.txt for the full site index.

Capital Flows

Enhanced margin & short

Margin and short balances with utilization and day-over-day change pre-computed on top of the official TWSE margin trading figures.

DerivedSource: TWSE·Plan: pro·Cost: 3 credits·GET /v2/datasets/margin-short-enhanced

Overview

margin-short-enhanced is a derived dataset: it starts from the official TWSE margin-purchase and short-sale balances and adds the utilization ratios and day-over-day changes an agent would otherwise compute itself. The lineage block points back to the underlying margin report so the base balances stay auditable.

FieldTypeDescription
symbolstringTicker.
datestringTrading date.
margin_balancenumberMargin-purchase balance (shares).
margin_utilizationnumberMargin balance as a ratio of its quota (0-1).
margin_changenumberDay-over-day change in margin balance (shares).
short_margin_rationumberShort balance as a ratio of margin balance.
source_rolestringCanonical source role (derived_twse_margin_enhanced).

Coverage

Rows7,798,493
Window2000-11-28 – 2026-07-09
GradeDerived

Example response

A real response from this endpoint. Rows are returned under "envelope.data", 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.

{  "api_version": "v2",  "endpoint": "/v2/datasets/margin-short-enhanced",  "request_id": "req_36b76b1d40b7",  "plan_id": "enterprise",  "dataset": "margin_short",  "query": {    "ticker": "2330",    "date_from": null,    "date_to": null,    "limit": 50,    "offset": 0,    "sort_by": "trade_date",    "sort_order": "desc"  },  "meta": {    "rows_returned": 50,    "mandatory_contract_fields_present": [      "api_version",      "data",      "data_as_of"    ],    "plan": "enterprise",    "row_limit": 100000,    "is_limited": false  },  "envelope": {    "api_version": "v2",    "dataset": "margin_short",    "dataset_version": "v2.0.0-preview",    "release_version": "v2.2026-07-09.preview",    "release_date": "2026-07-09",    "data_as_of": "2026-07-09",    "request_context": {      "ticker": "2330",      "as_of_date": "2026-07-09",      "family": "chip_deep",      "field_group_type": "derived",      "dataset_view": "margin_short_enhanced_v1",      "supported_sort_by": [        "trade_date"      ],      "supported_filter_fields": [        "ticker",        "date_from",        "date_to"      ]    },    "data": [      {        "ticker": "2330",        "market": "TWSE",        "trade_date": "2026-07-09",        "margin_balance": 33061,        "short_balance": 71,        "margin_balance_change": 778,        "short_balance_change": -14,        "margin_usage_ratio": 0.997857,        "short_usage_ratio": 0.002143,        "margin_buy": 1064,        "margin_sell": 272,        "short_sell": 14,        "short_cover": 0,        "securities_lending_balance": null,        "securities_lending_change": null,        "provider": "twse_official",        "source_role": "official_twse_mi_margn",        "lineage": {          "feeds": [            "margin_trading_daily",            "short_selling_daily"          ],          "merged_from": "margin_short_daily",          "transformation_version": "margin_short_deep_merge_v1"        },        "data_gaps": [],        "updated_at": "2026-07-14T14:03:17.715986"      },      {        "ticker": "2330",        "market": "TWSE",        "trade_date": "2026-07-08",        "margin_balance": 32283,        "short_balance": 85,        "margin_balance_change": -259,        "short_balance_change": -4,        "margin_usage_ratio": 0.997374,        "short_usage_ratio": 0.002626,        "margin_buy": 807,        "margin_sell": 829,        "short_sell": 8,        "short_cover": 4,        "securities_lending_balance": null,        "securities_lending_change": null,        "provider": "twse_official",        "source_role": "official_twse_mi_margn",        "lineage": {          "feeds": [            "margin_trading_daily",            "short_selling_daily"          ],          "merged_from": "margin_short_daily",          "transformation_version": "margin_short_deep_merge_v1"        },        "data_gaps": [],        "updated_at": "2026-07-14T14:03:17.715986"      }    ],    "quality": {      "freshness_state": "fresh",      "freshness_as_of": "2026-07-09",      "completeness_ratio": 1,      "quality_status": "ready"    },    "lineage": {      "source_role": "canonical",      "selected_source": "twse_official",      "fallback_chain": [        "tpex_official",        "data_gov_mirror"      ],      "policy_notes": [        "official/public-first canonical",        "margin_short enhanced product rows derived from chip_deep margin/short/lending canonical payloads",        "unstable fields excluded from public contract (scores/signals/custom factors)"      ]    },    "error": {      "error_code": null,      "error_message": null,      "dataset": "margin_short",      "request_id": "read-api-d78cfcbeec22",      "blocking_gate": null    }  }}

Captured from the live API on 2026-07-20.

Getting started

  1. Put your key in the X-API-Key header.
  2. Add query parameters (symbol, date range, limit).
  3. Send the request and read the envelope.data array.
curl "https://api.twmarketdata.com/v2/datasets/margin-short-enhanced?symbol=2330" \  -H "X-API-Key: sk_live_..."

Filtering

ParameterRequiredTypeDescription
symbolYesstringTicker, e.g. 2330.
start_dateNostring (YYYY-MM-DD)Start of the query range.
end_dateNostring (YYYY-MM-DD)End of the query range.
limitNointegerMaximum rows to return.

Python

A first call:

import requests resp = requests.get(    "https://api.twmarketdata.com/v2/datasets/margin-short-enhanced",    params={"symbol": "2330"},    headers={"X-API-Key": "sk_live_..."},)resp.raise_for_status()print(resp.json()["envelope"]["data"])

With a date-range filter:

import requests # The full verified example — the same call with every supported filter set.resp = requests.get(    "https://api.twmarketdata.com/v2/datasets/margin-short-enhanced",    params={"symbol": "2330"},    headers={"X-API-Key": "sk_live_..."},)resp.raise_for_status()for row in resp.json()["envelope"]["data"]:    print(row)

OpenAPI

This endpoint is GET /v2/datasets/margin-short-enhanced. The full machine-readable schema (parameters, security, response envelope) lives in the OpenAPI spec.

Notes & limitations

  • Derived, not disclosed: utilization and change are computed from the official TWSE margin balances, so they inherit the base report's partial coverage — a metric is only present where the underlying balance exists.

Request & Response

Request

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

Authenticate with the X-API-Key header, using a sk_live_ key issued in the dashboard.

Response

JSON
{  "api_version": "v2",  "endpoint": "/v2/datasets/margin-short-enhanced",  "request_id": "req_36b76b1d40b7",  "plan_id": "enterprise",  "dataset": "margin_short",  "query": {    "ticker": "2330",    "date_from": null,    "date_to": null,    "limit": 50,    "offset": 0,    "sort_by": "trade_date",    "sort_order": "desc"  },  "meta": {    "rows_returned": 50,    "mandatory_contract_fields_present": [      "api_version",      "data",      "data_as_of"    ],    "plan": "enterprise",    "row_limit": 100000,    "is_limited": false  },  "envelope": {    "api_version": "v2",    "dataset": "margin_short",    "dataset_version": "v2.0.0-preview",    "release_version": "v2.2026-07-09.preview",    "release_date": "2026-07-09",    "data_as_of": "2026-07-09",    "request_context": {      "ticker": "2330",      "as_of_date": "2026-07-09",      "family": "chip_deep",      "field_group_type": "derived",      "dataset_view": "margin_short_enhanced_v1",      "supported_sort_by": [        "trade_date"      ],      "supported_filter_fields": [        "ticker",        "date_from",        "date_to"      ]    },    "data": [      {        "ticker": "2330",        "market": "TWSE",        "trade_date": "2026-07-09",        "margin_balance": 33061,        "short_balance": 71,        "margin_balance_change": 778,        "short_balance_change": -14,        "margin_usage_ratio": 0.997857,        "short_usage_ratio": 0.002143,        "margin_buy": 1064,        "margin_sell": 272,        "short_sell": 14,        "short_cover": 0,        "securities_lending_balance": null,        "securities_lending_change": null,        "provider": "twse_official",        "source_role": "official_twse_mi_margn",        "lineage": {          "feeds": [            "margin_trading_daily",            "short_selling_daily"          ],          "merged_from": "margin_short_daily",          "transformation_version": "margin_short_deep_merge_v1"        },        "data_gaps": [],        "updated_at": "2026-07-14T14:03:17.715986"      },      {        "ticker": "2330",        "market": "TWSE",        "trade_date": "2026-07-08",        "margin_balance": 32283,        "short_balance": 85,        "margin_balance_change": -259,        "short_balance_change": -4,        "margin_usage_ratio": 0.997374,        "short_usage_ratio": 0.002626,        "margin_buy": 807,        "margin_sell": 829,        "short_sell": 8,        "short_cover": 4,        "securities_lending_balance": null,        "securities_lending_change": null,        "provider": "twse_official",        "source_role": "official_twse_mi_margn",        "lineage": {          "feeds": [            "margin_trading_daily",            "short_selling_daily"          ],          "merged_from": "margin_short_daily",          "transformation_version": "margin_short_deep_merge_v1"        },        "data_gaps": [],        "updated_at": "2026-07-14T14:03:17.715986"      }    ],    "quality": {      "freshness_state": "fresh",      "freshness_as_of": "2026-07-09",      "completeness_ratio": 1,      "quality_status": "ready"    },    "lineage": {      "source_role": "canonical",      "selected_source": "twse_official",      "fallback_chain": [        "tpex_official",        "data_gov_mirror"      ],      "policy_notes": [        "official/public-first canonical",        "margin_short enhanced product rows derived from chip_deep margin/short/lending canonical payloads",        "unstable fields excluded from public contract (scores/signals/custom factors)"      ]    },    "error": {      "error_code": null,      "error_message": null,      "dataset": "margin_short",      "request_id": "read-api-d78cfcbeec22",      "blocking_gate": null    }  }}

Captured from a real call to this endpoint — not written by hand.

This dataset returns its rows under "envelope.data". The envelope differs between datasets, so read this one rather than reusing another page's shape.

The grade badge on this page is a documentation classification, not a response field.