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

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.

Guide

How to read institutional flows

Get one stock's daily foreign / investment-trust / dealer net buy-sell, then count a buying streak.

Goal

Pull the daily institutional flow for one stock — how many shares foreign investors, investment trusts and dealers each net-bought or net-sold. The source is the official TWSE T86 report; it is on the Starter plan.

Step 1 — Get a key

Issue an API key in the dashboard and send it in the X-API-Key header on every request.

Step 2 — Request one stock's flow

Filter by symbol and a date range. This is a real request for TSMC (2330):

curl -H "X-API-Key: sk_live_..." \  "https://api.twmarketdata.com/v2/datasets/institutional-flow?symbol=2330&start_date=2026-07-14&end_date=2026-07-18"

Step 3 — Read the response

A real 200 response (one row shown, 2330 on 2026-07-17). The envelope is { dataset, count, rows }:

{  "dataset": "institutional_flow",  "count": 4,  "rows": [    {      "symbol": "2330",      "date": "2026-07-17",      "foreign_net_buy_sell": -44183964.0,      "investment_trust_net_buy_sell": 1488520.0,      "dealer_net_buy_sell": 2759348.0,      "total_institutional_net_buy_sell": -39936096.0,      "source_role": "official_twse_t86",      "lineage": { "endpoint_name": "T86", "source_authority": "TWSE T86", "payload_date": "20260717" }    }  ]}

The fields you want

  • foreign_net_buy_sell — foreign investors' net buy/sell (negative = net sell). On 2026-07-17 this was -44,183,964.
  • investment_trust_net_buy_sell — investment trusts' net (here +1,488,520, a net buy).
  • dealer_net_buy_sell — dealers' net (here +2,759,348).
  • total_institutional_net_buy_sell — the three summed (-39,936,096). source_role + lineage trace every row back to the TWSE T86 report.

Use it — a foreign buying streak

Sort rows by date and count consecutive days where foreign_net_buy_sell > 0. A break resets the count.

import requests rows = requests.get(    "https://api.twmarketdata.com/v2/datasets/institutional-flow",    params={"symbol": "2330", "start_date": "2026-06-01", "end_date": "2026-07-18"},    headers={"X-API-Key": "sk_live_..."},).json()["rows"] streak = 0for r in sorted(rows, key=lambda x: x["date"]):    streak = streak + 1 if r["foreign_net_buy_sell"] > 0 else 0print("current foreign buying streak:", streak, "days")

English is a semantic rewrite, not a machine translation.

On this page

  • Goal
  • Step 1 — Get a key
  • Step 2 — Request one stock's flow
  • Step 3 — Read the response
  • The fields you want
  • Use it — a foreign buying streak