Skip to main content
Glama

Taiwan Stocks

Get institutional and broker flows

get_trading_flows
Read-onlyIdempotent

Buying and selling by the three major institutional investors (foreign investors, investment trusts, dealers), margin trading and short selling, securities lending, broker branch activity, day trading, block trades and trading restrictions. Data comes from the CubeLV Market Data API (https://cubelv.com/en/mcp/taiwan-stocks/): pick a method and pass its arguments in args. US markets are available only for the ADRs of Taiwan companies.

Methods:

  • chips (Positioning overview): One call for a Taiwan stock's daily net buying/selling by the three major institutional investors (foreign investors, investment trusts, dealers), margin purchases and short sales, the latest day's top broker branches, and securities lending short-sale balance. Up to 400 trading days per series. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); symbol (required): Security symbol, e.g. 2330; from: Start date (inclusive) for institutional and margin data, YYYYMMDD; to: End date (inclusive) for institutional and margin data, YYYYMMDD; limit: Most recent N trading days per series (1-400, default 30); use from and to to page further back.

  • fundFlow (Market-wide institutional buy/sell amounts): Daily buy, sell and net amounts (TWD) of the three major institutional investors for the whole TWSE or TPEx market. The exchanges may revise published amounts the same evening: each row has the time it was fetched and a status, preliminary figures may still change, and revisions lists the investor types whose values were revised with old and new values. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); limit: About the most recent N trading days (1-400, default 30); returns the latest limit x 8 rows (TWSE has 6 rows per day, TPEx 8).

  • sectorPositions (Sector positioning and institutional flows): For TWSE's 34 sector indices on a trading day: percent change, distance from the 20-day moving average, and from similar historical setups (past 6 years, quintiles of daily change and distance from the 20-day MA) the share of cases that rose 5/10/20 trading days later, average return and excess return over TAIEX, with a 20-day verdict (continuation, rotation only, weak, or no edge). Sector institutional amounts are estimated from each stock's net lots times its average price that day (TWSE and TPEx sectors of the same name combined); margin changes are in lots. These are historical statistics, not forecasts. Four sectors created in 2023 have no historical daily data. Args: market (required): TWSE only (sector indices are TWSE's; TPEx stocks are merged into the sector of the same name); date: Trading day, YYYYMMDD; default is the latest trading day with stock closing data.

  • brokers (Top broker branches over a period): For one Taiwan stock over a period: top net-buying and net-selling broker branches, major-trader net buying and concentration. Broker branch data starts 2025-01-02. At most 250 trading days. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); symbol (required): Security symbol, e.g. 2330; days: Most recent N trading days with data (1-250, default 1); cannot be combined with from, can be combined with to (counting back from to); from: Start date (inclusive), YYYYMMDD; replaces days; at most 250 trading days with data in the range; to: End date (inclusive), YYYYMMDD; top: Number of branches on each of the buy and sell side (1-50, default 15).

  • brokerSeries (Daily major-trader net buying): Daily major-trader net buying/selling, number of net buying and net selling broker branches, and concentration for one Taiwan stock, suited for charting trends. Broker branch data starts 2025-01-02. At most 250 trading days. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); symbol (required): Security symbol, e.g. 2330; days: Most recent N trading days with data (1-250, default 20); cannot be combined with from, can be combined with to (counting back from to); from: Start date (inclusive), YYYYMMDD; replaces days; at most 250 trading days with data in the range; to: End date (inclusive), YYYYMMDD; top: Number of branches on each of the buy and sell side (1-50, default 15).

  • brokerPrices (Broker branch trades by price): For one Taiwan stock on one day: shares bought and sold by each broker branch at each price, plus totals per price. Per-price branch data starts 2021-06-30 (aggregated branch rankings start 2025-01-02). Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); symbol (required): Security symbol, e.g. 2330; date: Trading day, YYYYMMDD; default is the latest day with data; broker: Only one broker branch (4-character branch code, case-sensitive).

  • brokerBranchTrades (Broker branch activity by stock): With market and symbol: one broker branch's daily trading in that stock. Without symbol: the stocks the branch net bought and net sold the most over the period. Broker branch data starts 2025-01-02. Args: code (required): Broker branch code (4 characters; the case of the 4th character distinguishes branches, e.g. 9200, 592a); market: TWSE or TPEX; required with symbol, otherwise limits the reverse lookup to that market; symbol: Security symbol; with it daily rows are returned, without it the top buys and sells; days: Most recent N trading days with data (default 20; max 250 with symbol, 120 for the reverse lookup); cannot be combined with from; from: Start date (inclusive), YYYYMMDD; to: End date (inclusive), YYYYMMDD; limit: Number of stocks on each of the buy and sell side in the reverse lookup (1-100, default 20).

  • governmentBanks (Government-linked banks' trading in a stock): Daily shares and amounts bought and sold in one stock by each of Taiwan's eight government-linked banks, with daily totals and per-bank totals over the period. At most 250 trading days. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC), ESB = emerging stock market (no amounts); symbol (required): Security symbol, e.g. 2330; days: Most recent N trading days with data (1-250, default 20); cannot be combined with from, can be combined with to (counting back from to); from: Start date (inclusive), YYYYMMDD; replaces days; at most 250 trading days with data in the range; to: End date (inclusive), YYYYMMDD.

  • localBrokers (Local broker branch net buying): Net buying/selling over a period by broker branches located in the same city or county as the company's registered address (same district scores higher). Broker branch data starts 2025-01-02. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); symbol (required): Security symbol, e.g. 2330; days: Most recent N trading days with branch data (1-250, default 20); from: Start date (inclusive), YYYYMMDD; must be given with to, at most 366 days; to: End date (inclusive), YYYYMMDD; must be given with from.

  • foreignHolding (Foreign ownership and investment limit): Daily shares and percentage held by foreign and mainland Chinese investors in one stock, remaining investable room, the foreign ownership limit and reasons for changes. Up to 2500 trading days. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC), ESB = emerging stock market; symbol (required): Security symbol, e.g. 2330; from: Start date (inclusive), YYYYMMDD; to: End date (inclusive), YYYYMMDD; limit: Most recent N trading days (1-2500, default 60).

  • institutionalHolding (Institutional holdings): Daily actual foreign holdings of one stock, plus investment trust and dealer holdings and percentages estimated by accumulating their daily net buying. Up to 2500 trading days. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC), ESB = emerging stock market; symbol (required): Security symbol, e.g. 2330; from: Start date (inclusive), YYYYMMDD; to: End date (inclusive), YYYYMMDD; limit: Most recent N trading days (1-2500, default 60).

  • dayTrade (Day trading): Daily day-trading shares, buy and sell amounts, day-trading ratio, and flags for suspension of sell-first day trading for one stock. Up to 2500 trading days. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); symbol (required): Security symbol, e.g. 2330; from: Start date (inclusive), YYYYMMDD; to: End date (inclusive), YYYYMMDD; limit: Most recent N trading days (1-2500, default 60).

  • marginMaintenance (Estimated margin maintenance ratio): Daily margin purchase balance, estimated margin cost basis, margin financing ratio and estimated maintenance ratio for one stock; the cost and maintenance ratio are estimates. Up to 2500 trading days. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); symbol (required): Security symbol, e.g. 2330; from: Start date (inclusive), YYYYMMDD; to: End date (inclusive), YYYYMMDD; limit: Most recent N trading days (1-2500, default 60).

  • blockTrades (Block trades): Each block trade in one stock with trade type, price, shares, amount and premium/discount rate. Up to 1000 trades. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC); symbol (required): Security symbol, e.g. 2330; from: Start date (inclusive), YYYYMMDD; to: End date (inclusive), YYYYMMDD; limit: Most recent N trades (1-1000, default 50).

  • tradingStatus (Trading status and restrictions): Current status of one stock: attention stock and disposition (trading restrictions), short-sale suspension and suspension of sell-first day trading, trading halts, day-trading eligibility, limit-up/limit-down prices and the opening auction reference price. Args: market (required): TWSE = TWSE-listed, TPEX = TPEx-listed (OTC), ESB = emerging stock market; symbol (required): Security symbol, e.g. 2330.

  • brokerBranches (Broker branch directory): Brokerage head offices and broker branches, filterable by code, name, address, or type (foreign, local, proprietary trading desk, government-linked bank). Up to 2000 rows. Args: q: Keyword, up to 64 characters: matches the start of the code (case-insensitive) or is contained in the name, head office name or address; kind: Type (case-insensitive): foreign = foreign brokers, local = domestic brokers, proprietary = proprietary trading desks, government-bank = the eight government-linked banks; omit for all; limit: Maximum rows (1-2000, default 100); out of range returns 400.

  • brokerBranch (Broker branch profile and tags): Profile of one broker branch, tags such as foreign or local, recent trading and its tendency to flip positions the next day. Args: code (required): Broker branch code, 4 letters/digits (^[0-9A-Za-z]{4}$), case-sensitive (592a and 592A are different branches); days: Trading days for recent trading and next-day flipping tendency (1-60, default 20); out of range returns 400.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "method": "<method>"
    },
    "name": "get_trading_flows"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoArguments of the method, as listed in the tool description
langNoLanguage for data labels (industries, statement items, categories) and links: en, ja, ko or vi; default en
methodYesMethod from the list in the tool description

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnly/idempotent annotations, the description discloses data provenance, revision behavior for fundFlow, estimates for marginMaintenance and sector institutional flows, and that sector statistics are historical rather than forecasts. It also documents data start dates and row limits, which are essential for interpreting results correctly.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but structured as a front-loaded summary followed by a method-by-method list. Given the 17-method surface, most detail is necessary, though some repetition across method entries could be tightened.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex multi-method tool with no output schema, the description provides enough context to choose a method, construct arguments, and understand caveats. It covers date formats, data availability, limits, defaults, incompatible arguments, and interpretive warnings such as estimates versus actual holdings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is high, the description is the only place that explains method-specific arguments in detail: market enum meanings, symbol examples, date formats, limit ranges, defaults, and interaction rules between days/from/to. That adds substantial meaning beyond the generic args object in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific scope: institutional investor buying/selling, margin trading, short selling, securities lending, broker branch activity, day trading, block trades, and trading restrictions. It clearly distinguishes this data from sibling tools such as get_shareholders or get_company_fundamentals by focusing on trading flows and positioning.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The method list is effectively a selection guide: each method states what it returns and what arguments it requires. Important usage constraints are explicit, including incompatible combinations such as 'cannot be combined with from' and market limitations such as sectorPositions being TWSE only.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources