TSMC, Hon Hai (Foxconn), MediaTek, Delta Electronics: some of the most important companies in the global semiconductor and electronics supply chain trade in Taiwan. If you’re building a Taiwan stock app, a quant strategy, or a market monitor, the first thing you need is a reliable source of real-time data.
Infoway API now supports Taiwan stocks, covering about 2,350 stocks listed on the Taiwan Stock Exchange (TWSE) and traded on the Taipei Exchange (TPEx). This guide walks through the market rules that matter for developers, then shows you how to pull real-time trades, candlesticks, and order book data with Python, and how to stream live quotes over WebSocket.
1. Taiwan Market Rules to Know Before You Start
Taiwan’s market works differently from the US market in a few ways that directly affect how you handle the data:
| Item | Rule |
|---|---|
| Exchanges | Taiwan Stock Exchange (TWSE, listed stocks) and Taipei Exchange (TPEx, OTC stocks) |
| Regular session | Monday to Friday, 09:00–13:30 (UTC+8), with no lunch break |
| Call auctions | Opening 08:30–09:00, closing 13:25–13:30 |
| Daily price limit | ±10% |
| Trading unit | 1 board lot = 1,000 shares; anything under 1,000 shares is an odd lot |
| Currency | New Taiwan dollar (TWD) |
These rules come from TWSE’s trading system overview. The one that trips people up most is the trading unit. Local investors usually quote volume in lots, but Infoway API reports volume in shares, so convert as needed when you display it.
2. Two Ways to Get Real-Time Taiwan Stock Data
2.1 License the Data Directly from the Exchange
Anyone can view basic quotes on TWSE’s website for free, but putting real-time data into your own product requires a license. Under TWSE’s latest fee schedule (in Chinese), these are the main costs for applicants that aren’t securities or futures firms:
| Fee | Amount (TWD) |
|---|---|
| Transmission license fee | 60,000 per month |
| Information fee (internet delivery with auto-refreshing quotes, 0–5,000 users) | 100,000 per month |
| Information fee (above 5,000 users) | 12 per additional user per month |
| Non-display use license fee (trading, risk management, portfolio management, etc.) | Announced separately |
Take an app with auto-refreshing quotes as an example. These two fees alone come to NT$160,000 a month before you’ve built anything. That covers TWSE only. It doesn’t include TPEx data for OTC stocks, development, or dedicated lines, and you still have to sign a contract with the exchange. This route makes sense for larger institutions, but it’s out of reach for most individual developers and small teams.
2.2 Use a Third-Party Data Provider
TWSE also points users to a second option: getting real-time data through contracted information vendors. You don’t have to deal with the exchange yourself, and you can go live much faster.
Infoway API is a third-party data provider. A single API key gives you data for both TWSE and TPEx stocks, and the endpoints work the same way as they do for US, Hong Kong, and China A-shares. Paid plans start at 99 USDT a month, and there’s a 7-day free trial with no credit card required.
3. What Taiwan Stock Data Infoway API Provides
| Data | What’s included | HTTP | WebSocket |
|---|---|---|---|
| Real-time trades | Price, volume, turnover, trade direction | Yes | Yes |
| Candlesticks | 1-minute to yearly bars with OHLC, volume, turnover, change, and percent change | Yes | Yes |
| Order book (level 1) | Best bid and best ask price and size | Yes | Yes |
| Company profile | Company name, exchange, currency, EPS, dividend yield, sector, and more | Yes | No |
| Trading calendar and hours | Taiwan trading days and session times | Yes | No |
| Financial statements | Quarterly and annual statements, revenue breakdown, dividend history, and more | Yes | No |
Every Taiwan ticker uses the code.TW format, whether it’s listed on TWSE or TPEx:
| Company | Ticker | Market |
|---|---|---|
| TSMC | 2330.TW | TWSE |
| Hon Hai (Foxconn) | 2317.TW | TWSE |
| MediaTek | 2454.TW | TWSE |
| Delta Electronics | 2308.TW | TWSE |
| GlobalWafers | 6488.TW | TPEx |
To tell TWSE and TPEx stocks apart, check the exchange field in the company profile endpoint (see section 4.6).
4. How to Use the Taiwan Stock API
First, sign up on the Infoway website to get your API key. Every HTTP request needs this key in the request header. The examples below use Python, so install the dependencies first:
pip install requests websocketsThe examples use 2330.TW (TSMC), which is included in the free trial, so you can run them as soon as you sign up.
4.1 Get the List of Taiwan Tickers
You can download the ticker list from your account dashboard, or pull it from the API with the product type set to STOCK_TW:
import requests
url = "https://data.infoway.io/common/basic/symbols"
headers = {"apiKey": "YOUR_API_KEY"}
response = requests.get(url, headers=headers, params={"type": "STOCK_TW"})
symbols = response.json()["data"]
print(f"{len(symbols)} tickers")
print(symbols[:3])The list is updated regularly as companies list and delist, so it’s a good idea to sync it on a schedule.
4.2 Get Real-Time Trades
Endpoint:
GET https://data.infoway.io/taiwan/batch_trade/{codes}
codes is the ticker. To query several stocks at once, separate them with commas, up to 100 per request.
import requests
url = "https://data.infoway.io/taiwan/batch_trade/2330.TW"
headers = {"apiKey": "YOUR_API_KEY"}
response = requests.get(url, headers=headers)
print(response.json())Sample response:
{
"ret": 200,
"msg": "success",
"traceId": "5817b491-36aa-4fd6-8725-d6371206e4da",
"data": [
{
"s": "2330.TW",
"t": 1793847506767,
"p": "2265.00",
"v": "1000.00",
"vw": "2265000.00",
"td": 0
}
]
}| Field | Description |
|---|---|
s | Ticker |
t | Trade time, Unix timestamp in milliseconds |
p | Trade price |
v | Volume (shares) |
vw | Turnover (not the average price) |
td | Trade direction: 0 = default, 1 = buy, 2 = sell |
4.3 Get Candlestick Data
Endpoint:
POST https://data.infoway.io/taiwan/v2/batch_kline
Taiwan candlesticks are only available through POST, with the parameters in a JSON request body:
| Parameter | Required | Description |
|---|---|---|
klineType | Yes | Candle interval (see the table below) |
klineNum | Yes | Number of candles. Up to 500 for a single stock, or 2 per stock when you query several |
codes | Yes | Tickers as a comma-separated string, up to 100 |
timestamp | No | End time in seconds. If omitted, you get the latest data |
| klineType | Interval | klineType | Interval |
|---|---|---|---|
| 1 | 1 minute | 7 | 4 hours |
| 2 | 5 minutes | 8 | Daily |
| 3 | 15 minutes | 9 | Weekly |
| 4 | 30 minutes | 10 | Monthly |
| 5 | 1 hour | 11 | Quarterly |
| 6 | 2 hours | 12 | Yearly |
Example: get the last 10 daily candles for TSMC.
import requests
url = "https://data.infoway.io/taiwan/v2/batch_kline"
headers = {"apiKey": "YOUR_API_KEY"}
payload = {"klineType": 8, "klineNum": 10, "codes": "2330.TW"}
response = requests.post(url, headers=headers, json=payload)
print(response.json())Sample response:
{
"ret": 200,
"msg": "success",
"traceId": "414f11b1-6c5f-43bc-a6fe-e3b839018bc0",
"data": [
{
"s": "2330.TW",
"respList": [
{
"t": "1793808000",
"h": "2285.00",
"o": "2250.00",
"l": "2245.00",
"c": "2265.00",
"v": "17535000",
"vw": "39690465000",
"pc": "0.22%",
"pca": "5.00"
}
]
}
]
}| Field | Description |
|---|---|
t | Candle time, Unix timestamp in seconds (string) |
o / h / l / c | Open / high / low / close |
v | Volume (shares) |
vw | Turnover |
pc | Percent change |
pca | Price change |
Candles come back newest first. To page further back, take the t of the oldest candle on the current page, subtract 1, and pass it as timestamp in your next request:
import time
import requests
url = "https://data.infoway.io/taiwan/v2/batch_kline"
headers = {"apiKey": "YOUR_API_KEY"}
payload = {"klineType": 8, "klineNum": 500, "codes": "2330.TW"}
first_page = requests.post(url, headers=headers, json=payload).json()
candles = first_page["data"][0]["respList"]
time.sleep(1) # The free trial allows 1 request per second
payload["timestamp"] = int(candles[-1]["t"]) - 1
second_page = requests.post(url, headers=headers, json=payload).json()
candles += second_page["data"][0]["respList"]
print(f"{len(candles)} candles")4.4 Get the Order Book (Level 1)
Endpoint:
GET https://data.infoway.io/taiwan/batch_depth/{codes}
import requests
url = "https://data.infoway.io/taiwan/batch_depth/2330.TW"
headers = {"apiKey": "YOUR_API_KEY"}
response = requests.get(url, headers=headers)
depth = response.json()["data"][0]
print(f"Best ask: {depth['a'][0][0]}, size {depth['a'][1][0]}")
print(f"Best bid: {depth['b'][0][0]}, size {depth['b'][1][0]}")Sample response:
{
"ret": 200,
"msg": "success",
"traceId": "59462e85-1c92-433c-b2de-464d9922a6ef",
"data": [
{
"s": "2330.TW",
"t": 1793847512608,
"a": [["2270.00"], ["208000.0"]],
"b": [["2265.00"], ["169000.0"]]
}
]
}a is the ask side and b is the bid side. Each side holds two arrays: the first contains prices and the second contains order sizes.
4.5 Stream Real-Time Data over WebSocket
For live charts or trading signals, WebSocket is the better choice. Once you’re connected, the server pushes every update to you, so there’s no need to keep polling.
Taiwan WebSocket URL:
wss://data.infoway.io/ws?business=taiwan&apikey=YOUR_API_KEY
| Data | Subscribe code | Acknowledgment code | Push code |
|---|---|---|---|
| Real-time trades | 10000 | 10001 | 10002 |
| Order book | 10003 | 10004 | 10005 |
| Candlesticks | 10006 | 10007 | 10008 |
You also need to send a heartbeat (code 10010) every 30 seconds. The example below subscribes to TSMC’s trades, order book, and 1-minute candles, with a heartbeat and automatic reconnection:
import asyncio
import json
import uuid
import websockets
API_KEY = "YOUR_API_KEY"
WS_URL = f"wss://data.infoway.io/ws?business=taiwan&apikey={API_KEY}"
CODES = "2330.TW"
def build_message(code, data=None):
message = {"code": code, "trace": uuid.uuid4().hex}
if data is not None:
message["data"] = data
return json.dumps(message)
async def subscribe(ws):
await ws.send(build_message(10000, {"codes": CODES}))
await ws.send(build_message(10003, {"codes": CODES}))
await ws.send(build_message(10006, {"arr": [{"type": 1, "codes": CODES}]}))
async def send_heartbeat(ws):
while True:
await asyncio.sleep(30)
await ws.send(build_message(10010))
def handle_message(message):
code = message.get("code")
data = message.get("data")
if code == 10002:
print(f"Trade {data['s']}: price {data['p']}, volume {data['v']}")
elif code == 10005:
print(f"Order book {data['s']}: ask {data['a'][0][0]}, bid {data['b'][0][0]}")
elif code == 10008:
print(f"Candle {data['s']}: time {data['t']}, last {data['c']}")
else:
print(f"Other message: {message}")
async def main():
while True:
try:
async with websockets.connect(WS_URL) as ws:
print("Connected")
await subscribe(ws)
heartbeat = asyncio.create_task(send_heartbeat(ws))
try:
async for raw in ws:
handle_message(json.loads(raw))
finally:
heartbeat.cancel()
except (OSError, websockets.exceptions.WebSocketException) as error:
print(f"Connection error: {error}")
print("Disconnected, reconnecting in 10 seconds")
await asyncio.sleep(10)
if __name__ == "__main__":
asyncio.run(main())You need to resubscribe every time you reconnect, and the example above already does this for you.
4.6 Get Company Profiles, Trading Days, and Financial Statements
These endpoints all start with https://data.infoway.io/common/basic and use GET:
import time
import requests
base_url = "https://data.infoway.io/common/basic"
headers = {"apiKey": "YOUR_API_KEY"}
# Company profile: name, exchange, currency, EPS, sector, and more
info = requests.get(
f"{base_url}/symbols/info",
headers=headers,
params={"type": "STOCK_TW", "symbols": "2330.TW"},
)
print(info.json())
time.sleep(1) # The free trial allows 1 request per second
# Trading calendar
trading_days = requests.get(
f"{base_url}/markets/trading_days",
headers=headers,
params={"market": "TW", "beginDay": "20260901", "endDay": "20260930"},
)
print(trading_days.json())
time.sleep(1)
# Quarterly income statement
income = requests.get(
f"{base_url}/financial/income_statement",
headers=headers,
params={"symbol": "2330.TW", "type": "STOCK_TW", "period_type": "fq"},
)
print(income.json())In the company profile response, an exchange value of TWSE means the stock is listed on the Taiwan Stock Exchange, and TPEX means it trades on the Taipei Exchange. For company names, use name_en (English) or name_local (Traditional Chinese). The name_cn field is currently empty for Taiwan stocks.
5. Tips for Developers
- Candlesticks are POST only: Some markets still have a GET endpoint, but Taiwan only supports
POST /taiwan/v2/batch_kline. - Use the right
businessvalue: Taiwan stocks requirebusiness=taiwan. If the business value doesn’t match the ticker, the subscription may report success but you won’t receive any data. - Timestamp units differ: For trades and the order book,
tis an integer in milliseconds. For candlesticks,tis a string in seconds. - The percent change field has different names: It’s
pcin HTTP responses andpfrin WebSocket pushes. - Update live candles in place: The same candle is pushed many times, and there’s no field that marks it as closed. Use
s,ty, andtas a unique key and update the existing record instead of appending a new one each time. msg: okdoesn’t mean data is on the way: A subscription acknowledgment only confirms that your request was received. It’s normal to get no pushes outside trading hours.- Watch your WebSocket request rate: Each connection can send up to 60 subscribe, unsubscribe, and heartbeat messages per minute. Go over that and the connection will be closed.
6. FAQ
6.1 Can I get Taiwan stock data on the free trial?
Yes. Every new account gets a 7-day free trial, no credit card required. During the trial, you can query 2330.TW (TSMC) for Taiwan, and the data is real-time. Requests for tickers outside the trial will return a permission error.
6.2 How do the plans differ?
| Plan | HTTP rate limit | WebSocket subscriptions | WebSocket connections |
|---|---|---|---|
| Free trial | 1 request/sec | 10 | 1 |
| Basic | 2 requests/sec | 200 | 1 |
| Advanced | 10 requests/sec | 800 | 2 |
| Pro | 20 requests/sec | 5,000 | 9 |
| Stock market plan | 20 requests/sec | All stocks in the selected market | Assigned automatically |
See the pricing page for prices and historical data coverage. All plans are priced and paid in USDT.
6.3 Are TPEx stocks supported?
Yes. TWSE and TPEx stocks use the same endpoints and the same .TW suffix. For example, GlobalWafers, which trades on TPEx, is 6488.TW.
6.4 Do you support Taiwan ETFs?
Not at the moment. The current ticker list mainly covers TWSE and TPEx stocks, plus a small number of REITs (such as 01001T.TW). ETFs like 0050.TW aren’t included. Check the latest ticker list for exact coverage.
6.5 How many order book levels are available?
Taiwan stocks currently come with level 1 data, meaning the best bid and best ask with their sizes.
6.6 Are newly listed stocks included?
Yes. The ticker list is updated regularly to add new listings and remove delisted stocks.
6.7 Where can I get more help?
For full endpoint details, see the Infoway API documentation. You can also reach our support team on Telegram.