# 開始使用 富果行情 REST API 提供開發者友善的 Web API 服務。您可以查詢台股的日內行情、行情快照與歷史行情等數據。 ## 身份驗證[​](#身份驗證 "Direct link to 身份驗證") 富果行情 API 透過 API 金鑰對用戶進行身份驗證(Authentication)。請在發送 API 請求時加入以下 HTTP 標頭: ```text X-API-KEY: ``` ## 速率限制[​](#速率限制 "Direct link to 速率限制") 如果您的 API 請求超過了限制,將收到帶有狀態碼 `429` 的回應。 不同的 API 方案有不同的速率限制,關於速率限制,請參考 [行情方案及價格](https://developer.fugle.tw/docs/pricing.md) 的說明。 ## API 端點[​](#api-端點 "Direct link to API 端點") 富果行情 REST API 端點使用以下位置為前綴: ```text https://api.fugle.tw/marketdata/v1.0/stock/ ``` API 端點依資料類型可分為 **日內行情(intraday)**、**行情快照(snapshot)**、**歷史行情(historical)**、**技術指標(technical)**、**股務事件(corporate-actions)**、**盤後籌碼(ownership)**。富果行情 REST API 提供的端點如下: * GET `/intraday/tickers` - [取得股票或指數列表(依條件查詢)](https://developer.fugle.tw/docs/data/http-api/intraday/tickers.md) * GET `/intraday/ticker/{symbol}` - [取得股票基本資料(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/intraday/ticker.md) * GET `/intraday/quote/{symbol}` - [取得股票即時報價(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/intraday/quote.md) * GET `/intraday/candles/{symbol}` - [取得股票價格K線(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/intraday/candles.md) * GET `/intraday/trades/{symbol}` - [取得股票成交明細(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/intraday/trades.md) * GET `/intraday/volumes/{symbol}` - [取得股票分價量表(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/intraday/volumes.md) * GET `/snapshot/quotes/{market}` - [取得股票行情快照(依市場別)](https://developer.fugle.tw/docs/data/http-api/snapshot/quotes.md) * GET `/snapshot/movers/{market}` - [取得股票漲跌幅排行(依市場別)](https://developer.fugle.tw/docs/data/http-api/snapshot/movers.md) * GET `/snapshot/actives/{market}` - [取得股票成交量值排行(依市場別)](https://developer.fugle.tw/docs/data/http-api/snapshot/actives.md) * GET `/historical/candles/{symbol}` - [取得歷史股價(依代碼查詢,單次查詢區間須小於 1 年)](https://developer.fugle.tw/docs/data/http-api/historical/candles.md) * GET `/historical/stats/{symbol}` - [取得近 52 週股價數據(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/historical/stats.md) * GET `/technical/sma/{symbol}` - [取得簡單移動平均(SMA)數據(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/technical/sma.md) * GET `/technical/rsi/{symbol}` - [取得相對強弱指標(RSI)數據(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/technical/rsi.md) * GET `/technical/kdj/{symbol}` - [取得隨機指標(KDJ)數據(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/technical/kdj.md) * GET `/technical/macd/{symbol}` - [取得指數平滑異同移動平均線(MACD)數據(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/technical/macd.md) * GET `/technical/bb/{symbol}` - [取得布林通道(BBands)數據(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/technical/bb.md) * GET `/corporate-actions/dividends` - [取得上市櫃除權息資料(依日期查詢)](https://developer.fugle.tw/docs/data/http-api/corporate-actions/dividends.md) * GET `/corporate-actions/capital-changes` - [取得上市櫃股票及 ETF 之資本變動資料(依日期查詢)](https://developer.fugle.tw/docs/data/http-api/corporate-actions/capital-changes.md) * GET `/corporate-actions/listing-applicants` - [取得申請上市櫃公司資料(依日期查詢)](https://developer.fugle.tw/docs/data/http-api/corporate-actions/listing-applicants.md) * GET `/ownership/etf-holdings/{symbol}` - [取得 ETF 每日成分股清單(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/ownership/etf-holdings.md) * GET `/ownership/institutional-trades/{symbol}` - [取得個股每日三大法人買賣超(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/ownership/institutional-trades.md) * GET `/ownership/tdcc-distribution/{symbol}` - [取得個股集保戶股權分散表(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/ownership/tdcc-distribution.md) * GET `/ownership/director-holdings/{symbol}` - [取得個股董監及經理人持股(依代碼查詢)](https://developer.fugle.tw/docs/data/http-api/ownership/director-holdings.md) ## 使用 SDK[​](#使用-sdk "Direct link to 使用 SDK") 富果行情 REST API 提供 Python 與 Node.js SDK。 請先安裝 SDK: * Python * Node.js ```sh pip install fugle-marketdata ``` ```sh npm install @fugle/marketdata ``` 安裝後可透過以下方式存取 REST API: * Python * Node.js ```python from fugle_marketdata import RestClient client = RestClient(api_key = 'YOUR_API_KEY') stock = client.stock ``` ```js const { RestClient } = require('@fugle/marketdata'); const client = new RestClient({ apiKey: 'YOUR_API_KEY' }); const stock = client.stock; ```