Foreign Flows Methodology
What "foreign net buy/sell" actually means, where each country's data comes from, and what the Beta status is hiding behind.
What "foreign net" measures
Each listed Asian exchange publishes a daily breakdown of turnover by investor type — typically: local institutional, local retail, foreign institutional. We pull the foreign institutional net figure, i.e. total foreign buys minus total foreign sells that day, in the local currency.
This is not a per-stock figure (except Taiwan, which also publishes top-20 stocks by foreign net). It's a market-wide aggregate.
Per-country sources
Taiwan — TWSE
Daily · Aggregate + per-stock top-20- BFI82U: three-investor summary (Dealers / Investment Trust / Foreign Investors).
- TWT38U: top-20 stocks by foreign net buy/sell.
- Public JSON, no auth, ~1s response.
India — NSE
Daily · Aggregate FII + DII- Returns both FII (Foreign Institutional Investors) and DII figures.
- Cookie-gated: the collector primes a session on nseindia.com first.
- Values in INR crore (1 crore = 10,000,000 INR).
Japan — JPX
Weekly (Thursday release) · TSE Prime aggregate- Weekly XLS (legacy .xls format) with investor-type Sales/Purchases rows.
- We parse the Foreigners row from the TSE Prime section file.
- Values in JPY thousands; we store in JPY.
Hong Kong — HKEX
Daily · Turnover-only proxy (Beta)- HKEX's public ASMX endpoint Highlightsearch returns daily main-board turnover but NOT per-stock Stock Connect flows.
- Per-stock northbound/southbound data is JS-rendered behind the Stock Connect portal and will land in a later phase via Playwright.
Malaysia — Bursa
Daily · Aggregate by investor type- Cloudflare blocks our datacenter IP for plain HTTP; we use Playwright to fetch the fully-rendered page.
- Parse the Daily Trading Participation HTML table directly.
- Rows: Foreign Institution / Local Institution / Retail, Bought / Sold / Net in RM Mil.
Philippines — PSE
Monthly (3rd of month) · Monthly net-foreign- PDF monthly report — we pull the most recent month-<year> slug, download the PDF, and extract the 'net foreign (in)flow of P<X> billion' sentence.
- Regex covers both old ('net buy of P4.30 billion') and new ('netted an inflow of P9.66 billion') phrasings.
- Monthly cadence — so no daily signal for PH yet.
Beta: derived metrics not yet active
The following signals require 6–8 weeks of accumulated daily data before they produce honest output:
- Pan-Asian Flow Index — weighted composite of the 6 tracked countries' net flows, normalised and indexed.
- Smart Money Score (0–100) per Taiwan ticker (the only market with per-stock detail so far) — consistency of foreign buying, volume share, trend duration, retail/ institutional divergence.
- Divergence alerts — flag when retail is buying heavily into foreign-institution selling (or vice versa). Historical accuracy is attached once we have 6+ months of data.
The underlying tables (pan_asian_flow_index, flow_smart_money_scores, flow_alerts) are provisioned but empty until the history accrues. The collectors themselves run daily and build that history.
Phase-2 markets (not yet covered)
Four more markets are speced but currently blocked at our IP by Cloudflare or auth walls:
- Singapore (SGX)
- Thailand (SET)
- South Korea (KRX) — OTP-based session wall
- Indonesia (IDX)
These unlock when a residential proxy ($30–50/mo) is added or an alternative aggregator is procured. Collectors are skeletoned — only the endpoint swap is missing.
Limitations
- "Foreign" is as defined by each exchange. Definitions differ — some count "foreign dealers" separately, some combine mainland Chinese investors with foreigners (Taiwan does).
- Net figures are cash-equity-market only unless noted. Block trades and derivatives aren't included.
- A single day's net flow is noise. Weekly/monthly aggregates are more interpretable — those are available once enough history accrues.