# Taiwan Intraday 5-Second Stats — 每5秒委託成交與指數 API (`chamarix/taiwan-intraday-5sec-stats`) Actor

Taiwan's stock market every five seconds since 2004-10-15: cumulative bid and ask orders, trade count, volume and turnover, joined on the same timestamp to the TAIEX and 37 more TWSE indices. 3,241 rows a session, reconciled against the exchange's own daily close and change.

- **URL**: https://apify.com/chamarix/taiwan-intraday-5sec-stats.md
- **Developed by:** [chris](https://apify.com/chamarix) (community)
- **Categories:** AI, Developer tools, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Taiwan Intraday 5-Second Stats (每5秒委託成交與指數) API

Taiwan's stock market **sampled every five seconds**, as structured JSON, back to **2004-10-15**. Every row carries the whole exchange's cumulative order book — bid orders and size, ask orders and size — beside the matched trade count, volume and turnover, and on the *same timestamp* the TAIEX plus **37 more TWSE indices** — every sector, plus the non-finance and non-electronics cuts of the market.

**3,241 rows per session.** This is the only free, official, machine-readable intraday time series Taiwan publishes, and it goes back twenty-two years.

### Why this data matters

- **Order-book pressure, second by second.** The exchange publishes accumulated buy and sell order size for the entire market, not just what traded. Differencing it gives the arrival rate of buying and selling interest in any window you like, and `order_volume_imbalance` gives the standing tilt as a single number between −1 and +1. There is no other free source for this in Taiwan.
- **Sector rotation at five-second resolution.** Semiconductor, finance, shipping, green energy and thirty-three more indices sit on the identical timestamp as the order flow. Whether money left electronics for financials at 09:47 is a question you can actually answer with one row.
- **Cumulative *and* incremental.** The exchange publishes running totals; running totals are awkward. Every row also carries the change since the previous row, so a bar series at any resolution is a filter, not an arithmetic exercise. They sum back to the session total exactly, including when the grid is thinned.
- **Twenty-two years, and the interval changed four times.** The same two URLs have served **60-second** rows since 2004-10-15, **15-second** since 2011-01-17, **10-second** since 2014-02-24 and **5-second** since 2014-12-29 — and the *only* place that says which is the report's own Chinese title. Every row here states its `resolution_seconds`, and every session's row count is checked against the interval before anything is written.
- **The two reports are proved to be on one clock before they are joined.** Order flow and indices are separate reports. They have shared an identical timestamp grid on every session tested back to 2004, including both sides of each interval change, which is what makes a single row meaningful. The Actor asserts it per session and fails rather than joining two grids that have drifted apart.
- **Every session reconciles against a separately compiled report.** The closing index, the change in points, and one-sided bounds on volume, turnover and trade count are all checked against TWSE's daily market-turnover report, which is not derived from this one.

### Output

One record per timestamp. A real row, mid-session:

```json
{
  "record_type": "INTRADAY_TICK",
  "date": "2026-09-18",
  "time": "09:30:00",
  "timestamp": "2026-09-18T09:30:00+08:00",
  "seconds_from_open": 1800,
  "resolution_seconds": 5,
  "delta_seconds": 5,
  "cum_bid_orders": 5336712,
  "cum_bid_volume_lots": 36027380,
  "cum_ask_orders": 5907600,
  "cum_ask_volume_lots": 23771539,
  "cum_trades": 825256,
  "cum_trade_volume_lots": 3172075,
  "cum_trade_value_ntd_million": 251112,
  "bid_orders_delta": 10380,
  "bid_volume_delta_lots": 197020,
  "ask_orders_delta": 12040,
  "ask_volume_delta_lots": 186923,
  "trades_delta": 949,
  "trade_volume_delta_lots": 4084,
  "trade_value_delta_ntd_million": 282,
  "order_volume_imbalance": 0.204951,
  "order_count_imbalance": -0.050771,
  "taiex": 46722.63,
  "taiex_change": 434.63,
  "taiex_change_pct": 0.939,
  "indices": {
    "semiconductor": 1579.49,
    "finance_and_insurance": 3609.88,
    "shipping_and_transportation": 215.16,
    "...": "34 more"
  }
}
```

Thirty minutes into 2026-09-18, the market had taken 36.0 million lots of buy orders against 23.8 million of sell — an imbalance of +0.20 — and matched 3.17 million lots for NT$251 billion. In the five seconds to 09:30:00 alone: 949 trades, 4,084 lots, NT$282 million.

And one `SESSION_SUMMARY` per day, which is where the reconciliation is written down:

```json
{
  "record_type": "SESSION_SUMMARY",
  "date": "2026-09-18",
  "resolution_seconds": 5,
  "published_rows": 3241,
  "expected_rows": 3241,
  "first_time": "09:00:00",
  "last_time": "13:30:00",
  "previous_close_taiex": 46288.0,
  "closing_taiex": 47180.75,
  "taiex_change": 892.75,
  "official_close_index": 47180.75,
  "official_change_points": 892.75,
  "official_total_shares": 12052158761.0,
  "official_total_value_ntd": 1142321910407.0,
  "official_total_trades": 4680943.0,
  "close_cum_trade_volume_lots": 11751121,
  "close_cum_trade_value_ntd_million": 1075065,
  "close_cum_trades": 2869805,
  "round_lot_volume_coverage_pct": 97.5022,
  "round_lot_value_coverage_pct": 94.1123,
  "round_lot_trade_count_coverage_pct": 61.3083,
  "identity_ok": true
}
```

### What one row means

| Column | Unit | Note |
|---|---|---|
| `cum_bid_orders` / `cum_ask_orders` | orders | Accumulated from the 08:30 pre-open |
| `cum_bid_volume_lots` / `cum_ask_volume_lots` | lots (1,000 shares) | **Can fall** — cancelled and reduced orders are netted out |
| `cum_trades` | trades | Round lots, continuous session |
| `cum_trade_volume_lots` | lots (1,000 shares) | Never falls |
| `cum_trade_value_ntd_million` | NT$ million | The unit the exchange's own English edition states |
| `taiex`, `indices.*` | index points | Two decimals, as published |

Units are not printed in the Chinese edition. They were taken from the English one — its last column is literally headed `Acc. Trade Value (NT$M)` — and then confirmed against the exchange's daily turnover report on sessions spanning 2004 to 2026: official shares ÷ this report's volume lands just above 1,000 every time, official dollars ÷ its value just above 1,000,000. The "just above" is the part the next section is about.

### The three things that will catch you out

**1. The 09:00:00 row is not an opening print.** It is the *previous session's close* for every index, and the pre-open order book for every order column — the opening auction has not matched yet, which is why `cum_trades` is often 0 on that row. It was verified on sessions from 2004, 2019, 2020 and 2026 that the 09:00:00 index equals the prior day's official close exactly. So `taiex_change` is measured from it, and the deltas on that row are **null** rather than treating half an hour of order collection as one five-second bucket.

**2. This report covers round lots in the continuous session only — and its share of the market has collapsed.** The closing call auction at 13:30 and all odd-lot trading sit outside it. That was a rounding error once and is not any more:

| Session | Round-lot share of the day's **trade count** |
|---|---|
| 2004-10-15 | 97.1% |
| 2019-06-17 | 97.4% |
| 2020-11-02 | 94.5% |
| 2026-09-18 | **61.3%** |

Intraday odd-lot trading opened in October 2020 and has grown ever since. By value the gap is much smaller — 94.1% on 2026-09-18 — because odd-lot trades are tiny. Every `SESSION_SUMMARY` carries all three coverage percentages against the exchange's own daily totals, so this is measured per session rather than assumed. It is also why the check here is a **one-sided bound** (the intraday total can never exceed the day's) rather than an equality: an equality would be a lie about what the report is.

**3. The bid and ask *volume* columns go down.** Not a parsing fault and not a data error: the exchange nets cancelled and reduced orders out of the accumulated quantity, while the order *counts* keep climbing. A monotonicity check on those two columns fails on essentially every real session. This Actor asserts monotonicity on the five columns where it holds and leaves those two alone, and their deltas are signed.

### What you can ask for

| Input | Effect |
|---|---|
| `startDate` / `endDate` | Empty for the latest session. Archive floor **2004-10-15** |
| `includeOrderStats` | The 每5秒委託成交統計 report — order book and trades |
| `includeIndices` | The 每5秒指數統計 report — TAIEX on the same clock |
| `includeSectorIndices` | The other 37 indices as an `indices` object. Off ≈ a quarter the row size |
| `timeFrom` / `timeTo` | Keep only a window of the session. The open, or the last ten minutes |
| `sampleEverySeconds` | Thin to one row a minute (60), five minutes (300), anything |
| `maxSessions` | Default 5, because one session is 3,241 rows |

Cost is **two requests per session**, plus one per month of range for the exchange's trading calendar — which is also the report every session is reconciled against, so it is never optional.

Thinning and windowing are not the same operation and they compose in the order that keeps the arithmetic honest: the grid is thinned first across the **whole** session, deltas are taken along the thinned series, and only then is the time window applied. So the first row inside a window is a full interval, not a partial one, and a thinned series still sums back to the session total.

### Archive floors and interval changes, as measured

Every boundary below was found by binary search against the live endpoints, one day at a time, not read off a documentation page.

| Range | The report's own title | `resolution_seconds` | Rows |
|---|---|---|---|
| 2004-10-15 → 2011-01-14 | 每一分鐘 | 60 | 271 |
| 2011-01-17 → 2014-02-21 | 每15秒 | 15 | 1,081 |
| 2014-02-24 → 2014-12-27 | 每10秒 | 10 | 1,621 |
| 2014-12-29 → today | 每5秒 | 5 | 3,241 |

Both reports change interval on exactly the same day, every time — checked day by day on all three boundaries — which is why the join holds across the whole archive without special-casing.

The row count is not decoration. The session runs 09:00:00 to 13:30:00 inclusive, so it must be `270 × 60 ÷ resolution + 1`, and all four eras match. A response that parses cleanly but arrived short is the failure mode this Actor exists to catch, so a session that does not produce exactly that many evenly spaced rows from 09:00:00 to 13:30:00 is **refused**, not published.

Ask for 2004-10-14 or earlier and both reports answer HTTP 200 with `查詢日期小於93年10月15日，請重新查詢!`. That is a different thing from a public holiday, which answers `很抱歉，沒有符合條件的資料!`, and conflating them is how a backfill quietly returns nothing. The Actor distinguishes them.

### The index report has changed shape six times

25 columns in October 2004, 26 by November 2005, **24** in November 2006 — it got *smaller* — then 35 in 2008, a different 35 in 2009, and 39 today. Along the way the exchange renamed its columns twice:

- the whole set dropped from `加權股價` / `水泥類` style to `發行量加權股價指數` / `水泥類指數` in late 2006;
- `百貨貿易類指數` became `貿易百貨類指數` (2009) and `觀光類指數` became `觀光餐旅類指數` (2024).

Positional parsing is therefore not an option, and neither is keying on the Chinese name if you want a series that survives a rename. Each column is matched by name to a **stable key** — `tourism`, `trading_and_consumer_goods`, `taiex` — that both sides of every rename share, plus the exchange's own English name for that era. A column this Actor has never seen is published under its own Chinese name and reported in the log, rather than being dropped. Every `SESSION_SUMMARY` lists the day's columns with both names.

Two 2004-era columns, `綜合平均` and `工業平均`, are average share *prices* rather than index levels. The exchange stopped publishing them in 2006. They are carried through because deleting a published column would be editing the archive, and flagged `is_price_index: false` so they are not mistaken for indices.

### Verification

Every run reports what it reconciled. These are not optional switches — a failure fails the run and nothing is written.

- `reports_share_one_clock` — the order-book report and the index report must have identical timestamps and an identical interval for the session. The entire premise of one joined row rests on this.
- `cumulative_columns_never_fall` — the five columns that must be monotonic, are. (The two order-volume columns are deliberately excluded; see above.)
- `last_row_is_the_official_close` — the 13:30:00 TAIEX must equal the close in the exchange's separately compiled daily turnover report.
- `session_move_matches_official_change` — 13:30:00 minus 09:00:00 must equal the change in points that report publishes. This is the check that catches a day's file being served under the wrong date.
- `session_opens_where_the_last_one_closed` — across consecutive sessions in the range, **every** index must open exactly where it closed the session before, not just the TAIEX. On a modern session that is 38 comparisons a day, needing no extra request and no second source.
- `session_total_within_official_day` — intraday volume, turnover and trade count, scaled to the exchange's units, must each be no greater than the whole day's official total.

Tolerance on the index comparisons is **0.01** — one unit in the last decimal place the exchange itself publishes — because that is the only disagreement its own rounding can produce. It is not a number chosen to make a run pass; on every session tested the identities hold exactly.

### Limitations, stated plainly

- **This is market-wide, not per stock.** One row is the whole exchange. There is no per-security intraday feed in the free data; for per-stock daily figures see [taiwan-stock-daily-quotes](https://apify.com/chamarix/taiwan-stock-daily-quotes).
- **TWSE only.** The OTC board publishes no equivalent series, so there is no TPEx half of this and this README will not pretend otherwise.
- **Round lots, continuous session.** Excludes the closing auction and all odd-lot trading. See the coverage table above; for odd lots see [taiwan-odd-lot-trading](https://apify.com/chamarix/taiwan-odd-lot-trading).
- **No bid/ask prices or depth.** The exchange publishes accumulated order *quantities* market-wide, not a price ladder. This is not a limit-order book snapshot.
- **It is a big dataset.** 3,241 rows a session is by design, and `maxSessions` defaults to 5 for that reason. Use `sampleEverySeconds` and `timeFrom`/`timeTo` for a long backfill.
- **The exchange's firewall refuses by address.** A sustained fast caller gets a redirect whose body is the "FOR SECURITY REASONS" page, and once tripped it refuses *every* uncached report for that address for minutes — sometimes arriving instead as an HTTP 200 whose body is HTML. The Actor paces under the threshold, slows the whole run at the first refusal, treats a non-JSON 200 as throttling rather than as an empty day, and can route through Apify Proxy (`useApifyProxy`) to take a different exit address when a long backfill is refused.

### Taiwan Market Data Suite

This Actor is part of a suite of 33 Taiwan market data APIs by [chamarix](https://apify.com/chamarix) — official sources only, cross-validated against independent official endpoints, clean JSON out. Code samples for the whole suite: [GitHub](https://github.com/cc77556/taiwan-market-data-actors).

**Market data:**

- [taiwan-intraday-5sec-stats](https://apify.com/chamarix/taiwan-intraday-5sec-stats) — Market-wide order book & all sector indices every 5 seconds since 2004, 3,241 rows a session
- [taiwan-stock-daily-quotes](https://apify.com/chamarix/taiwan-stock-daily-quotes) — Daily OHLCV, VWAP, P/E, price-to-book & dividend yield for every listed/OTC stock since 2004
- [taiwan-index-history](https://apify.com/chamarix/taiwan-index-history) — Daily TAIEX & TPEx index history since 1990 with market turnover, the total-return index & all 273 TWSE indices
- [twse-institutional-trades](https://apify.com/chamarix/twse-institutional-trades) — Daily institutional buy/sell (foreign, investment trust, dealer) per stock — TWSE listed
- [tpex-institutional-trades](https://apify.com/chamarix/tpex-institutional-trades) — Daily institutional buy/sell per stock — TPEx OTC market
- [taiwan-monthly-revenue](https://apify.com/chamarix/taiwan-monthly-revenue) — Monthly revenue of 1,900+ listed & OTC companies, MoM/YoY
- [taiwan-financial-statements](https://apify.com/chamarix/taiwan-financial-statements) — Quarterly income statement, balance sheet & cash flow back to 2013
- [taiwan-director-compensation](https://apify.com/chamarix/taiwan-director-compensation) — Board pay for 1,950+ companies, parent vs consolidated scope, with EPS, ROE & profit on the same row
- [taiwan-esg-disclosures](https://apify.com/chamarix/taiwan-esg-disclosures) — 21 ESG topics for 1,950+ companies — Scope 1/2/3 emissions, energy, water, waste, pay, board & climate risk
- [taiwan-dividend-calendar](https://apify.com/chamarix/taiwan-dividend-calendar) — Ex-dividend / ex-rights dates, reference prices & payouts back to 2003
- [taiwan-margin-trading](https://apify.com/chamarix/taiwan-margin-trading) — Daily margin trading & short sale balances per stock
- [taiwan-sbl-short-sale-balance](https://apify.com/chamarix/taiwan-sbl-short-sale-balance) — Securities-lending short sale balances per stock
- [taiwan-day-trading-stats](https://apify.com/chamarix/taiwan-day-trading-stats) — Day-trading volume, value & ratio per stock since 2014
- [taiwan-odd-lot-trading](https://apify.com/chamarix/taiwan-odd-lot-trading) — Both odd-lot sessions per stock — intraday & after-hours, shares, turnover, OHLC & quotes since 2004
- [taiwan-broker-rankings](https://apify.com/chamarix/taiwan-broker-rankings) — Securities-firm turnover, market share & the top firms in each hot stock on the OTC board since 2007
- [tdcc-shareholding-dispersion](https://apify.com/chamarix/tdcc-shareholding-dispersion) — Weekly TDCC shareholding dispersion (retail vs whale structure)
- [taiwan-foreign-shareholding](https://apify.com/chamarix/taiwan-foreign-shareholding) — Foreign ownership percentage & remaining quota per stock
- [taiwan-futures-daily](https://apify.com/chamarix/taiwan-futures-daily) — Daily bars, settlement price & open interest for all 384 TAIFEX futures contracts since 1998, with the large-trader report
- [taifex-institutional-derivatives](https://apify.com/chamarix/taifex-institutional-derivatives) — Institutional futures & options positions (TAIFEX), incl. put/call ratio
- [taifex-options-chain](https://apify.com/chamarix/taifex-options-chain) — Full options chain by strike & expiry, both sessions, with the exchange's own Delta, since 2001
- [taiwan-warrants-daily](https://apify.com/chamarix/taiwan-warrants-daily) — Daily quotes, strike, expiry & moneyness for every listed/OTC warrant since 2004
- [taiwan-government-bonds](https://apify.com/chamarix/taiwan-government-bonds) — Central government bond benchmark yields, the full yield curve & issuance master, with staleness stated
- [taiwan-stock-alerts](https://apify.com/chamarix/taiwan-stock-alerts) — Watch-list, disposition & short-sale suspension alerts
- [taiwan-insider-share-transfers](https://apify.com/chamarix/taiwan-insider-share-transfers) — Insider share-transfer filings (directors, officers, 10% holders) since 2002
- [taiwan-director-shareholdings](https://apify.com/chamarix/taiwan-director-shareholdings) — Monthly director/officer shareholdings & share-pledge ratio since 1999
- [taiwan-block-trades](https://apify.com/chamarix/taiwan-block-trades) — Every block trade (鉅額交易) with price, size & basket constituents since 2005
- [taiwan-shareholder-meetings](https://apify.com/chamarix/taiwan-shareholder-meetings) — Shareholder meeting dates, book closure periods & e-voting since 2005
- [taiwan-emerging-stock-quotes](https://apify.com/chamarix/taiwan-emerging-stock-quotes) — Emerging (興櫃) board quotes, pre-IPO register & history since 2003
- [taiwan-etf-regular-investment](https://apify.com/chamarix/taiwan-etf-regular-investment) — Monthly regular savings plan (定期定額) rankings for stocks & ETFs since 2020
- [taiwan-treasury-stock-buybacks](https://apify.com/chamarix/taiwan-treasury-stock-buybacks) — Every treasury-stock buyback (庫藏股) filing, plan vs execution, since 2000

**Property market:**

- [taiwan-real-estate-transactions](https://apify.com/chamarix/taiwan-real-estate-transactions) — Actual registered sale, presale & lease prices (實價登錄) for all 22 cities since 2012

**Government & civic data:**

- [taiwan-legislator-monitor](https://apify.com/chamarix/taiwan-legislator-monitor) — Legislative Yuan bills, legislators & meetings
- [taiwan-tender-monitor](https://apify.com/chamarix/taiwan-tender-monitor) — Government e-procurement tenders (open calls, awards, failures)

# Actor input Schema

## `startDate` (type: `string`):

First session to fetch. Leave both dates empty for the latest session. The archive begins 2004-10-15 and a range that starts earlier simply begins there — the exchange answers an earlier date with its own 'query date is earlier than 93/10/15' message rather than data.

## `endDate` (type: `string`):

Last session to fetch, inclusive. Defaults to today. Each session costs two requests plus one per month for the exchange's trading calendar.

## `includeOrderStats` (type: `boolean`):

Cumulative bid orders and volume, ask orders and volume, and the trade count, volume and value — the 每5秒委託成交統計 report. Each row also carries the increment since the previous row, so the flow in any window can be read off directly.

## `includeIndices` (type: `boolean`):

The TAIEX on the same timestamps — the 每5秒指數統計 report. The two reports have been published on an identical clock on every session back to 2004, which is what lets one row carry both; the run fails rather than guesses if that ever stops being true.

## `includeSectorIndices` (type: `boolean`):

Adds an `indices` object to every row carrying every index the report carried besides the TAIEX — 37 of them today, 23 in 2004. Turning it off keeps the TAIEX and makes each row roughly a quarter the size, which is worth doing on a long backfill. Only affects rows; the indices report is fetched either way.

## `includeSessionSummary` (type: `boolean`):

A SESSION\_SUMMARY record per day: the sampling interval in force, the row count published against the row count the session needs, the closing totals, the exchange's own daily close, change and turnover for comparison, the round-lot share of each, and the list of index columns that day carried with their official English names.

## `timeFrom` (type: `string`):

Only write rows stamped at or after this time. The session runs 09:00:00 to 13:30:00. Useful for the open or the close on their own, and the cheapest way to cut a run's output without losing resolution — increments are still measured against the previous row of the full session, so the first row in the window is not a partial one.

## `timeTo` (type: `string`):

Only write rows stamped at or before this time. Defaults to the 13:30:00 close.

## `sampleEverySeconds` (type: `integer`):

0 keeps the exchange's own resolution — 5 seconds since 2014-12-29, and 10, 15 or 60 before that. Set 60 for one row a minute, 300 for one every five. Increments are then measured across the thinned interval, so a sampled series still sums back to the session total. A value below the day's own resolution changes nothing.

## `maxSessions` (type: `integer`):

A safety cap, because one session is 3,241 rows at today's resolution — the largest per-day payload in this suite. When a range exceeds the cap the most recent sessions are kept and the rest skipped, with a warning. Set to 0 to lift it.

## `useApifyProxy` (type: `boolean`):

Turn this on for a backfill of more than a few weeks. TWSE's firewall refuses by address and, once tripped, refuses every report for that address for minutes at a time; with this on, requests take a different exit address each time they are refused. It is off by default because a direct run is faster and cleaner for any ordinary range.

## Actor input object example

```json
{
  "startDate": "",
  "endDate": "",
  "includeOrderStats": true,
  "includeIndices": true,
  "includeSectorIndices": true,
  "includeSessionSummary": true,
  "timeFrom": "",
  "timeTo": "",
  "sampleEverySeconds": 0,
  "maxSessions": 5,
  "useApifyProxy": false
}
```

# Actor output Schema

## `datasetItems` (type: `string`):

One record per timestamp — cumulative bid and ask orders, trade count, volume and value, their increments, and the TAIEX with every sector index on the same row — plus one summary record per session reconciling it against the exchange's daily figures.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startDate": "",
    "endDate": "",
    "includeOrderStats": true,
    "includeIndices": true,
    "includeSectorIndices": true,
    "includeSessionSummary": true,
    "timeFrom": "",
    "timeTo": "",
    "sampleEverySeconds": 0,
    "maxSessions": 5,
    "useApifyProxy": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("chamarix/taiwan-intraday-5sec-stats").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "startDate": "",
    "endDate": "",
    "includeOrderStats": True,
    "includeIndices": True,
    "includeSectorIndices": True,
    "includeSessionSummary": True,
    "timeFrom": "",
    "timeTo": "",
    "sampleEverySeconds": 0,
    "maxSessions": 5,
    "useApifyProxy": False,
}

# Run the Actor and wait for it to finish
run = client.actor("chamarix/taiwan-intraday-5sec-stats").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startDate": "",
  "endDate": "",
  "includeOrderStats": true,
  "includeIndices": true,
  "includeSectorIndices": true,
  "includeSessionSummary": true,
  "timeFrom": "",
  "timeTo": "",
  "sampleEverySeconds": 0,
  "maxSessions": 5,
  "useApifyProxy": false
}' |
apify call chamarix/taiwan-intraday-5sec-stats --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,chamarix/taiwan-intraday-5sec-stats"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/i52UtdggSvAjZEgYN/builds/NBvybgrZnbn5P8Tmb/openapi.json
