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

Margin & short

Daily margin-purchase and short-sale balances per listed stock from the official TWSE margin trading report.

ReferenceSource: TWSE·Plan: starter·Cost: 2 credits·GET /v2/datasets/margin-short

Overview

margin-short returns one row per stock per trading day with the margin-purchase and short-sale balances from the official TWSE margin trading report. Each row carries its source role so a balance is traceable to the official report. This endpoint is a preview surface — coverage is currently partial and served as a snapshot rather than a fully backfilled history.

FieldTypeDescription
symbolstringTicker.
datestringTrading date.
margin_balancenumberMargin-purchase balance (shares).
short_balancenumberShort-sale balance (shares).
margin_quotanumberMargin balance limit for the stock (shares).
source_rolestringCanonical source role (official_twse_margin).

Coverage

TODO — exact row / symbol counts and the coverage window are pending a measured snapshot; the source is the official TWSE margin trading report. This is a preview surface with partial, snapshot-only coverage, so no counts are shown rather than fabricated ones.

Example response

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": "margin_short",  "dataset_id": "margin_short",  "rows": [    {      "ticker": "2330",      "market": "TWSE",      "trade_date": "2026-07-09",      "margin_purchase_buy": 1064,      "margin_purchase_sell": 272,      "margin_purchase_balance": 33061,      "short_sale_buy": 0,      "short_sale_sell": 14,      "short_sale_balance": 71,      "data_gaps": [],      "source_provider": "twse_official",      "source_role": "official_twse_mi_margn",      "source_lineage": {        "feeds": [          "margin_trading_daily",          "short_selling_daily"        ],        "merged_from": "margin_short_daily",        "transformation_version": "margin_short_deep_merge_v1"      },      "not_investment_advice": true,      "symbol": "2330",      "as_of_date": "2026-07-09",      "margin_balance": 33061,      "short_balance": 71,      "margin_purchase": 1064,      "short_sale": 14,      "margin_utilization_ratio": 0.0021475454462962403    },    {      "ticker": "2330",      "market": "TWSE",      "trade_date": "2026-07-08",      "margin_purchase_buy": 807,      "margin_purchase_sell": 829,      "margin_purchase_balance": 32283,      "short_sale_buy": 4,      "short_sale_sell": 8,      "short_sale_balance": 85,      "data_gaps": [],      "source_provider": "twse_official",      "source_role": "official_twse_mi_margn",      "source_lineage": {        "feeds": [          "margin_trading_daily",          "short_selling_daily"        ],        "merged_from": "margin_short_daily",        "transformation_version": "margin_short_deep_merge_v1"      },      "not_investment_advice": true,      "symbol": "2330",      "as_of_date": "2026-07-08",      "margin_balance": 32283,      "short_balance": 85,      "margin_purchase": 807,      "short_sale": 8,      "margin_utilization_ratio": 0.0026329647182727752    }  ],  "count": 50,  "plan_id": "enterprise",  "meta": {    "plan": "enterprise",    "row_limit": 100000,    "market": "TWSE",    "private_beta_contract": true,    "is_limited": false  }}

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 rows array.
curl "https://api.twmarketdata.com/v2/datasets/margin-short?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",    params={"symbol": "2330"},    headers={"X-API-Key": "sk_live_..."},)resp.raise_for_status()print(resp.json()["rows"])

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",    params={"symbol": "2330"},    headers={"X-API-Key": "sk_live_..."},)resp.raise_for_status()for row in resp.json()["rows"]:    print(row)

OpenAPI

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

Notes & limitations

  • Preview grade: coverage is partial and served as a snapshot, not a fully backfilled daily history — do not assume every stock or every trading day is present.

Request & Response

Request

curl "https://api.twmarketdata.com/v2/datasets/margin-short?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
{  "dataset": "margin_short",  "dataset_id": "margin_short",  "rows": [    {      "ticker": "2330",      "market": "TWSE",      "trade_date": "2026-07-09",      "margin_purchase_buy": 1064,      "margin_purchase_sell": 272,      "margin_purchase_balance": 33061,      "short_sale_buy": 0,      "short_sale_sell": 14,      "short_sale_balance": 71,      "data_gaps": [],      "source_provider": "twse_official",      "source_role": "official_twse_mi_margn",      "source_lineage": {        "feeds": [          "margin_trading_daily",          "short_selling_daily"        ],        "merged_from": "margin_short_daily",        "transformation_version": "margin_short_deep_merge_v1"      },      "not_investment_advice": true,      "symbol": "2330",      "as_of_date": "2026-07-09",      "margin_balance": 33061,      "short_balance": 71,      "margin_purchase": 1064,      "short_sale": 14,      "margin_utilization_ratio": 0.0021475454462962403    },    {      "ticker": "2330",      "market": "TWSE",      "trade_date": "2026-07-08",      "margin_purchase_buy": 807,      "margin_purchase_sell": 829,      "margin_purchase_balance": 32283,      "short_sale_buy": 4,      "short_sale_sell": 8,      "short_sale_balance": 85,      "data_gaps": [],      "source_provider": "twse_official",      "source_role": "official_twse_mi_margn",      "source_lineage": {        "feeds": [          "margin_trading_daily",          "short_selling_daily"        ],        "merged_from": "margin_short_daily",        "transformation_version": "margin_short_deep_merge_v1"      },      "not_investment_advice": true,      "symbol": "2330",      "as_of_date": "2026-07-08",      "margin_balance": 32283,      "short_balance": 85,      "margin_purchase": 807,      "short_sale": 8,      "margin_utilization_ratio": 0.0026329647182727752    }  ],  "count": 50,  "plan_id": "enterprise",  "meta": {    "plan": "enterprise",    "row_limit": 100000,    "market": "TWSE",    "private_beta_contract": true,    "is_limited": false  }}

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

This dataset returns its rows under "rows". 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.