Answer

What is tpex_mainboard_daily_close_quotes, and how do you use it?

tpex_mainboard_daily_close_quotes is the Taipei Exchange (TPEx) open-data endpoint for mainboard daily closing quotes. It is free, needs no key, and answers a plain GET with JSON. It returns a snapshot of the latest trading day only — there is no date parameter, so history is something you poll for and store.

What the endpoint is

This is the TPEx open-data endpoint for daily closing quotes on the OTC mainboard, covering OTC-listed stocks and exchange-traded funds. Probed on 2026-07-31 it returned roughly ten thousand rows, all for the same trading day, carrying open, high, low and close, traded shares, turnover, transaction count, latest bid and ask, and the next session's reference and limit-up/limit-down prices.

curl "https://www.tpex.org.tw/openapi/v1/tpex_mainboard_daily_close_quotes"

The official way to call it

No key and no headers — a plain GET is enough. The response is a JSON array, one element per security for that day. Field names are English (Date, SecuritiesCompanyCode, Close, TradingShares and so on), dates are ROC-calendar strings such as 1150730 for 2026-07-30, all values arrive as strings, and some fields carry padding you will want to trim.

import requests

url = "https://www.tpex.org.tw/openapi/v1/tpex_mainboard_daily_close_quotes"
rows = requests.get(url, timeout=30).json()
print(len(rows), rows[0]["Date"])

# ROC calendar -> ISO date
def roc_to_date(s):
    s = s.strip()
    return f"{int(s[:3]) + 1911:04d}-{s[3:5]}-{s[5:7]}"

print(roc_to_date(rows[0]["Date"]))

Its limits

  • Latest trading day only: the endpoint is a snapshot, with no date parameter for history. Backtesting means polling every trading day and storing the result — your history starts the day you start collecting.
  • Non-trading days return the previous session: called on a weekend or a holiday you get the most recent close, and nothing in the payload says the market was shut. Check the Date field yourself or you will write the same day twice.
  • ROC dates and string types: convert the calendar, cast the numbers, trim the padding.
  • Prices are unadjusted: these are raw closes with no adjustment for dividends or capital changes, so returns computed across an ex-date will be wrong unless you apply your own adjustment factors.
  • Separate from the listed market: TWSE publishes its own daily quotes on a different domain with Chinese field names, so whole-market work needs your own merge and mapping.

When you need history, both markets, or adjusted prices

If what you want is "OTC daily bars from year X to today", the official endpoint cannot help — that has to be accumulated. TW Market Data's OTC daily prices start in 1994, share one schema with the listed market, are queryable by symbol and date range, and preserve disclosed gaps rather than filling them with inferred values. Listed daily prices start in 2004 and cover 1,682 names, including full price history for 311 that have stopped trading.

curl "https://api.twmarketdata.com/v2/datasets/tpex-daily-price?symbol=6488&limit=10" \
  -H "X-API-Key: $TWMD_API_KEY"

Related