Cookie settings
We use essential cookies to keep you signed in and secure, and analytics cookies to improve the product. We never use them for ad tracking.Learn more
Answer
選台股資料 API 先看三件事:資料是否第一手(TWSE / TPEx / MOPS / TAIFEX)、每筆回應是否附來源 lineage、以及是否誠實揭露 coverage 與 data_gaps。用 Python 抓歷史資料的基本流程是:在 header 帶 X-API-Key 呼叫對應 dataset 端點、拿到 JSON rows、再依 freshness 與 data_gaps 訊號判讀完整度。TW Market Data 為 TWSE-first verified baseline,公開揭露限制(例如 TPEx 歷史深度尚未完整開放),不宣稱 full-market。
帶 X-API-Key 呼叫日線價格 dataset,讀取 JSON rows:
import requests
headers = {"X-API-Key": "your_api_key_here"}
url = "https://api.twmarketdata.com/v2/datasets/twse-daily-price?symbol=2330&limit=10"
print(requests.get(url, headers=headers).json())使用前先讀回應與 dataset 頁上的 freshness、data_gaps 訊號,不要假設歷史完整;缺口會被標示、不以推測值補洞。
免費方案包含基礎資料集(不含財報三表)並有每月請求額度,可先把整條串接跑通再升級。Python SDK(pip install)為規劃中、尚未發布。
Related