Building an AI agent? Start with /llms.txt for the full site index.
Guide
Get one stock's daily foreign / investment-trust / dealer net buy-sell, then count a buying streak.
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.
Issue an API key in the dashboard and send it in the X-API-Key header on every request.
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"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" } } ]}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.