Building an AI agent? Start with /llms.txt for the full site index.
Docs
Building a verifiable view of Taiwan capital flow from institutional trading and margin/short data.
Researchers and developers tracking foreign institutions, investment trusts, dealers and credit-trading activity.
If you want capital flow inside a strategy or an agent research process, the minimal query flow on this page is the place to start.
Python 3.9+, requests, an X-API-Key, and a symbol such as 2330.
import requests
BASE_URL = "https://api.twmarketdata.com"
HEADERS = {
"X-API-Key": "your_api_key_here",
}
def get_dataset(path, params):
response = requests.get(
f"{BASE_URL}{path}",
headers=HEADERS,
params=params,
)
response.raise_for_status()
return response.json()Institutional net buy/sell shows where money is moving and how holdings are shifting. Quantities are in shares; the API documentation and the response itself govern the exact fields.
flow = get_dataset(
"/v2/datasets/institutional-flow",
{
"symbol": "2330",
"limit": 10,
},
)Margin and short balances add the leverage and credit-sentiment dimension, and are best read alongside institutional flow rather than on their own.
margin = get_dataset(
"/v2/datasets/margin-short",
{
"symbol": "2330",
"limit": 10,
},
)announcements = get_dataset(
"/v2/datasets/issuer-announcements",
{
"symbol": "2330",
"limit": 5,
},
)events = get_dataset(
"/v2/datasets/events",
{
"symbol": "2330",
"limit": 5,
},
)
structured_events = get_dataset(
"/v2/datasets/structured-events",
{
"symbol": "2330",
"limit": 5,
},
)result = {
"institutional_flow": flow.get("rows", []),
"margin_short": margin.get("rows", []),
"announcements": announcements.get("rows", []),
"events": events.get("rows", []),
"structured_events": structured_events.get("rows", []),
}
print(result)Coverage of the institutional-flow dataset is still being filled in. Keep data_gaps and missing-value handling inside the workflow, and do not read a gap as a zero.
Once flow and events are combined, the natural extensions are: