# Taiwan Stock Exchange API

> Returns TWSE stock quotes, valuation ratios, company registry entries, index values, margin balances and monthly average prices.

Category: Finance & Crypto. Region: TW. 11 endpoints at `https://api.hoshime.com/v1/twse/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/twse
## GET /v1/twse/quotes

The trading of the latest day of listed stocks, one code or all of them.

Scope: `social:read` · Units: 1 · Cached: 10 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | no | Security code, such as 2330. Omit it for every listed security. (e.g. 2330) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `date` (string), `items` (Quote[]), `items[].change` (number (double)), `items[].close` (number (double)), `items[].code` (string), `items[].high` (number (double)), `items[].low` (number (double)), `items[].name` (string), `items[].open` (number (double)), `items[].transactions` (integer (int64)), `items[].value` (integer (int64)), `items[].volume` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/twse/quotes?code=2330" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/valuation

The price-to-earnings ratio, price-to-book ratio and dividend yield of listed stocks.

Scope: `social:read` · Units: 1 · Cached: 60 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | no | Security code, such as 2330. Omit it for every listed stock. (e.g. 2330) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `date` (string), `items` (Valuation[]), `items[].code` (string), `items[].dividendYield` (number (double) | null), `items[].name` (string), `items[].peRatio` (number (double) | null), `items[].priceToBook` (number (double) | null)

```bash
curl "https://api.hoshime.com/v1/twse/valuation?code=2330" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/company

The register entry of one listed company: names, industry, chairman, address and listing date.

Scope: `social:read` · Units: 1 · Cached: 1440 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | yes | Company code, such as 2330. (e.g. 2330) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `address` (string), `capital` (string), `chairman` (string), `code` (string), `englishName` (string), `founded` (string), `industry` (string), `listedOn` (string), `name` (string), `phone` (string), `shortName` (string), `website` (string)

```bash
curl "https://api.hoshime.com/v1/twse/company?code=2330" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/indexes

The closing value and change of every Taiwan Stock Exchange index on the latest trading day.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `change` (number (double)), `changePercent` (number (double)), `close` (number (double)), `date` (string), `name` (string)

```bash
curl "https://api.hoshime.com/v1/twse/indexes" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/margin

Margin purchase and short sale balances of listed stocks on the latest trading day.

Scope: `social:read` · Units: 1 · Cached: 30 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | no | Security code, such as 2330. Omit it for every listed security. (e.g. 2330) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `code` (string), `marginBalance` (integer (int64)), `marginBuy` (integer (int64)), `marginSell` (integer (int64)), `name` (string), `shortBalance` (integer (int64)), `shortSell` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/twse/margin?code=2330" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/monthlyAverage

The closing price of one listed stock on the latest day and its monthly average closing price.

Scope: `social:read` · Units: 1 · Cached: 30 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | yes | Security code, such as 2330. (e.g. 2330) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `close` (number (double)), `code` (string), `date` (string), `monthAverage` (number (double)), `name` (string)

```bash
curl "https://api.hoshime.com/v1/twse/monthlyAverage?code=2330" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/dividends

Dividend announcements of listed companies: cash and stock dividend per share, the board and shareholder meeting dates, for one company or every company.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | no | Company code, such as 2330. Omit it for every company. (e.g. 2330) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `boardDate` (string), `cashPerShare` (number (double)), `code` (string), `fiscalYear` (integer (int64)), `meetingDate` (string), `name` (string), `period` (string), `status` (string), `stockPerShare` (number (double))

```bash
curl "https://api.hoshime.com/v1/twse/dividends?code=2330" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/materialNews

Material information announcements (重大訊息) of listed companies: subject, the TWSE rule clause and details, for one company or every company.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | no | Company code, such as 2330. Omit it for every company. (e.g. 2330) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `clause` (string), `code` (string), `date` (string), `details` (string), `name` (string), `subject` (string), `time` (string)

```bash
curl "https://api.hoshime.com/v1/twse/materialNews?code=2330" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/topVolume

The twenty listed securities with the largest trading volume on the latest day, with their prices and change.

Scope: `social:read` · Units: 1 · Cached: 10 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `date` (string), `items` (TopVolume[]), `items[].change` (number (double)), `items[].close` (number (double)), `items[].code` (string), `items[].high` (number (double)), `items[].low` (number (double)), `items[].name` (string), `items[].open` (number (double)), `items[].rank` (integer (int64)), `items[].transactions` (integer (int64)), `items[].volume` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/twse/topVolume" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/marketVolume

Daily trading totals of the whole Taiwan Stock Exchange market in the current month: shares, value, transactions and the TAIEX.

Scope: `social:read` · Units: 1 · Cached: 30 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `change` (number (double)), `date` (string), `taiex` (number (double)), `transactions` (integer (int64)), `value` (integer (int64)), `volume` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/twse/marketVolume" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twse/foreignOwnership

The twenty listed stocks with the highest share held by foreign and mainland Chinese investors, with the room left for them to buy.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `availablePercent` (number (double)), `code` (string), `heldPercent` (number (double)), `heldShares` (integer (int64)), `issuedShares` (integer (int64)), `limitPercent` (number (double)), `name` (string), `rank` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/twse/foreignOwnership" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
