Get dataset rows
dataset.getFetch rows from a TWSE OpenAPI or TAIFEX OAS dataset. Find the dataset_id with dataset.search first; do not guess it, since each metric lives in its own table. Supports server-side filtering (code is an exact match; match and where), sorting, field selection and paging: 30 rows by default, 200 at most. For rankings and screens (top 10 by dividend yield, P/E below 10) use where and sort_by instead of paging through rows. Most daily tables hold the previous trading day's after-close data, not live prices; the response note states the period. Data is republished under Taiwan's Open Government Data License. 取得證交所或期交所資料集內容,支援伺服器端過濾、欄位投影與分頁。上游每個資料集都是整份回傳(可能上萬筆),這支工具預設只回前 30 筆(上限 200);用 code/match/where/fields 縮小到需要的範圍。排名與篩選(殖利率最高的前 20 檔、本益比低於 10 的股票)用 where + sort_by,不要自己翻頁比大小。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | 證券/基金/契約代號,例如 "0050"、"TX"。一律精確比對(不分大小寫),實際用了哪個欄位會回在 code_field_used。找不到完全相符的代號時回 0 筆,並在 code_candidates 給出拼法相近的代號——**那些是候選不是答案**,可能是不同商品(MXF 與 MXFFX 是不同契約),請確認後改用該代號重查,不要直接引用它們的數字。 | |
| limit | No | 回傳筆數上限(硬上限 200)。 | |
| match | No | 其他欄位的子字串過濾,例如 {"基金類型": "ETF"}。最多 20 個欄位。 | |
| order | No | "desc"(大到小,預設)或 "asc"。 | desc |
| where | No | 數值條件,全部都要成立。例如本益比低於 10、殖利率至少 5%:[{"field":"PEratio","op":"lt","value":10},{"field":"DividendYield","op":"gte","value":5}]。欄位值會去逗號轉數字;空值或非數字(例如虧損公司的本益比)無法比較,會被排除並回報筆數。 | |
| fields | No | 只回傳這些欄位。 | |
| offset | No | 分頁位移。 | |
| sort_by | No | 依這個欄位排序,在分頁之前做——要「前 N 名」就用它配 limit。多數值是數字就依數值排,否則依字串排;空值與非數字一律排最後。 | |
| dataset_id | Yes | 資料集代號,例如 "exchangeReport/STOCK_DAY_ALL"。 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| note | Yes | ||
| offset | Yes | ||
| source | Yes | ||
| summary | Yes | ||
| returned | Yes | ||
| dataset_id | Yes | ||
| rows_matched | Yes | ||
| rows_in_source | Yes |