# TWSE Taiwan Stock Exchange API
> Live data from the Taiwan Stock Exchange (TWSE), with no key. Read the daily quote for any listed stock by its code (open/high/low/close, change, traded volume and value); pull a whole-market snapshot of every listed stock; get per-stock valuation metrics (price/earnings ratio, price/book ratio and dividend yield); read the live value of every TWSE index (the headline TAIEX and all sector indices); and get the daily history of the TAIEX index. The Taiwan-equities / valuation / index layer for trading dashboards, screeners and fintech — distinct from other exchange readers, with a dedicated valuation cut. Live from TWSE via its official OpenAPI; short cache only.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/twse-api/..."
```

## Pricing
- **Free** (Free) — 20,000 calls/Mo, 3 req/s
- **Starter** ($17/Mo) — 400,000 calls/Mo, 8 req/s
- **Pro** ($48/Mo) — 2,050,000 calls/Mo, 20 req/s
- **Enterprise** ($118/Mo) — 10,200,000 calls/Mo, 60 req/s

## Endpoints

### Valuation

#### `GET /v1/valuation` — P/E, P/B & dividend yield

**Parameters:**
- `code` (query, optional, string) — TWSE stock code, e.g. 2330 (TSMC); omit for all Example: `2330`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/twse-api/v1/valuation?code=2330"
```

**Response:**
```json
{
    "data": {
        "note": "Valuation metrics for one TWSE-listed stock — price/earnings ratio, price/book ratio and dividend yield. Pass code (e.g. 2330 for TSMC); omit it for every stock.",
        "source": "TWSE",
        "valuation": {
            "code": "2330",
            "date": "2026-06-12",
            "name": "台積電",
            "pb_ratio": 10.17,
            "pe_ratio": 31.06,
            "dividend_yield": 0.95
        }
    },
    "meta": {
        "timestamp": "2026-06-15T02:11:14.119Z",
        "request_id": "386522b8-a094-4aa7-b493-b98459afd188"
    },
    "status": "ok",
    "message": "Valuation retrieved successfully",
    "success": true
}
```

### Stocks

#### `GET /v1/market` — Whole-market snapshot

**Parameters:**
- `sort` (query, optional, string) — value or volume (default value) Example: `value`
- `limit` (query, optional, string) — Results (1-200, default 50) Example: `50`
- `offset` (query, optional, string) — Pagination offset Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/twse-api/v1/market?sort=value&limit=50&offset=0"
```

**Response:**
```json
{
    "data": {
        "note": "A whole-market snapshot of every TWSE-listed stock for the latest trading day — each with its OHLC, change, volume and value. Sort by value (default) or volume; page with offset and limit (max 200). The full Taiwan market tape.",
        "sort": "value",
        "count": 50,
        "total": 1366,
        "offset": 0,
        "source": "TWSE",
        "stocks": [
            {
                "low": 852,
                "code": "2327",
                "date": "2026-06-12",
                "high": 919,
                "name": "國巨*",
                "open": 919,
                "close": 855,
                "change": 0,
                "trade_value": 80454166531,
                "trade_volume": 90466919,
                "transactions": 134773
            },
            {
                "low": 2290,
                "code": "2330",
                "date": "2026-06-12",
                "high": 2325,
                "name": "台積電",
                "open": 2325,
                "close": 2310,
                "change": 60,
                "trade_value": 60666936905,
                "trade_volume": 26306885,
                "transactions": 77219
            },
            {
                "low": 132.5,
                "code": "2303",
                "date": "2026-06-12",
                "high": 137.5,
                "name": "聯電",
                "open": 134,
                "close": 133.5,
                "change": 8.5,
              
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/quote` — Daily quote for a stock

**Parameters:**
- `code` (query, required, string) — TWSE stock code, e.g. 2330 (TSMC) Example: `2330`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/twse-api/v1/quote?code=2330"
```

**Response:**
```json
{
    "data": {
        "note": "The latest daily quote for one TWSE-listed stock — open/high/low/close, change, traded volume, traded value and transaction count. Pass code (the TWSE stock code, e.g. 2330 for TSMC). Use /v1/valuation for P/E, P/B and yield.",
        "stock": {
            "low": 2290,
            "code": "2330",
            "date": "2026-06-12",
            "high": 2325,
            "name": "台積電",
            "open": 2325,
            "close": 2310,
            "change": 60,
            "trade_value": 60666936905,
            "trade_volume": 26306885,
            "transactions": 77219
        },
        "source": "TWSE"
    },
    "meta": {
        "timestamp": "2026-06-15T02:11:14.723Z",
        "request_id": "60a20b58-faa0-44aa-b73b-ab0318776655"
    },
    "status": "ok",
    "message": "Quote retrieved successfully",
    "success": true
}
```

### Indices

#### `GET /v1/indices` — Every TWSE index (TAIEX & sectors)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/twse-api/v1/indices"
```

**Response:**
```json
{
    "data": {
        "note": "The latest value of every TWSE index — the headline TAIEX (發行量加權股價指數) and all sector and themed indices — each with its closing level, point change and percent change. The pulse of the Taiwan market.",
        "count": 267,
        "source": "TWSE",
        "indices": [
            {
                "date": "2026-06-12",
                "name": "寶島股價指數",
                "close": 49305.35,
                "direction": "+",
                "change_points": 1163.61,
                "change_percent": 2.42
            },
            {
                "date": "2026-06-12",
                "name": "發行量加權股價指數",
                "close": 44169.04,
                "direction": "+",
                "change_points": 1019.58,
                "change_percent": 2.36
            },
            {
                "date": "2026-06-12",
                "name": "臺灣公司治理100指數",
                "close": 27509.62,
                "direction": "+",
                "change_points": 591.54,
                "change_percent": 2.2
            },
            {
                "date": "2026-06-12",
                "name": "臺灣50指數",
                "close": 40828.13,
                "direction": "+",
                "change_points": 991.77,
                "change_percent": 2.49
            },
            {
                "date": "2026-06-12",
                "name": "臺灣50權重上限30%指數",
  
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/taiex` — Daily history of the TAIEX index

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/twse-api/v1/taiex"
```

**Response:**
```json
{
    "data": {
        "note": "The recent daily history of the headline TAIEX index (Taiwan Capitalization Weighted Stock Index) — each day's open, high, low and close. Track the trend of the whole Taiwan market.",
        "count": 10,
        "source": "TWSE",
        "history": [
            {
                "low": 44872.82,
                "date": "2026-06-01",
                "high": 45931.1,
                "open": 44872.82,
                "close": 45337.91
            },
            {
                "low": 44869.38,
                "date": "2026-06-02",
                "high": 45915.92,
                "open": 45388.93,
                "close": 45557.31
            },
            {
                "low": 45660.46,
                "date": "2026-06-03",
                "high": 46552.16,
                "open": 45660.46,
                "close": 46459.16
            },
            {
                "low": 45677.46,
                "date": "2026-06-04",
                "high": 46364.07,
                "open": 46364.07,
                "close": 45677.46
            },
            {
                "low": 44209.53,
                "date": "2026-06-05",
                "high": 45619.82,
                "open": 45619.82,
                "close": 45070.94
            },
            {
                "low": 42376.86,
                "date": "2026-06-08",
                "high": 44507.49,
                "open": 44507.49,
                "close": 43502.78
            },
  
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Endpoints & source

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/twse-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "sample": {
            "tsmc_pe": 31.06
        },
        "source": "Taiwan Stock Exchange official OpenAPI (openapi.twse.com.tw), keyless",
        "service": "twse-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/quote": "Daily quote for one stock (code).",
            "GET /v1/taiex": "Daily history of the TAIEX index.",
            "GET /v1/market": "Whole-market snapshot (sort, offset, limit).",
            "GET /v1/indices": "Every TWSE index (TAIEX and the rest).",
            "GET /v1/valuation": "P/E, P/B and dividend yield (code, or all)."
        },
        "description": "Live data from the Taiwan Stock Exchange (TWSE) with no key: the daily quote for any listed stock by code (OHLC, change, volume, value), a whole-market snapshot, per-stock valuation metrics (P/E, P/B, dividend yield), every TWSE index (TAIEX and the rest) and the daily TAIEX history. The Taiwan-equities / valuation / index layer for trading dashboards, screeners and fintech. Distinct from other exchange readers — TWSE data with a valuation cut. Live, short cache only.",
        "upstream_status": "ok"
    },
    "meta": {
        "timestamp": "2026-06-15T02:11:15.419Z",
        "request_id": "4aa6d419-c891-4772-9643-2c821fe5dd8b"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/twse-api
OpenAPI spec: https://www.oanor.com/api/twse-api/openapi.json
