API 參考
概述
MiniValuator 提供 REST API,讓你透過程式直接獲取股票基本面資料。計費規則與網頁端相同——首次查詢新股票消耗 10 積分,7 天內重複查詢免費。
Base URL: https://minivaluator.com
認證方式: API Key,透過 Authorization: Bearer sk-... 請求頭傳入
獲取 API Key
- 登入你的 MiniValuator 賬號
- 進入 設定 → API Keys
- 點選新增 API Key,填寫名稱後複製生成的 key(格式:
sk-...)
請妥善保管你的 API Key,持有 key 的人可以消耗你的積分。
介面
GET /api/stock/fundamentals
返回指定股票的基本面資料。
請求示例
curl "https://minivaluator.com/api/stock/fundamentals?symbol=AAPL" \
-H "Authorization: Bearer sk-your-api-key-here"查詢引數
| 引數 | 型別 | 必填 | 說明 |
|---|---|---|---|
symbol | string | 是 | 股票程式碼,如 AAPL、MSFT、GOOGL |
響應示例
{
"data": {
"symbol": "AAPL",
"name": "Apple Inc.",
"fcfPerShare": 7.43,
"currentPrice": 211.45,
"currentPFCF": 28,
"eps": 6.42,
"currentPE": 33,
"growthEstimate": {
"rates": [0.062, 0.091, 0.08, 0.08, 0.08],
"cagr": 0.082,
"quality": "ok",
"flags": []
},
"earningsGrowthEstimate": {
"rates": [0.11, 0.13, 0.12, 0.12, 0.12],
"cagr": 0.12,
"quality": "ok",
"flags": []
},
"dataSource": "Financial Modeling Prep"
}
}響應欄位說明
| 欄位 | 型別 | 說明 |
|---|---|---|
symbol | string | 大寫股票程式碼 |
name | string | 公司名稱 |
fcfPerShare | number | 每股自由現金流(TTM,美元) |
currentPrice | number | 當前股價(美元) |
currentPFCF | number | 市現率(TTM) |
eps | number | 每股收益(TTM,美元) |
currentPE | number | 市盈率(TTM) |
growthEstimate | object | null | 基於營收的 5 年增長率預測 |
earningsGrowthEstimate | object | null | 基於 EPS 的 5 年增長率預測 |
dataSource | string | 資料來源 |
growthEstimate 欄位
| 欄位 | 型別 | 說明 |
|---|---|---|
rates | number[] | 5 個逐年增長率(小數,如 0.08 = 8%) |
cagr | number | 全週期複合年增長率 |
quality | "ok" | "partial" | "insufficient" | 資料置信度 |
flags | string[] | 資料填充或截斷說明 |
錯誤響應
| HTTP 狀態碼 | 錯誤資訊 | 原因 |
|---|---|---|
400 | "Symbol required" | 缺少 symbol 引數 |
400 | "Invalid symbol format" | 股票程式碼含非法字元 |
400 | "Insufficient credits" | 賬戶積分不足 10 |
400 | "Rate limit exceeded" | 請求頻率超限 |
400 | "Stock not found" | 資料來源未找到該股票 |
所有錯誤格式如下:
{ "error": "Insufficient credits" }積分消耗規則
| 場景 | 消耗積分 |
|---|---|
| 首次查詢新股票 | 10 積分 |
| 7 天內重複查詢 | 免費(讀取快取) |
| 7 天后重新查詢 | 10 積分 |
程式碼示例
Python
import requests
API_KEY = "sk-your-api-key-here"
response = requests.get(
"https://minivaluator.com/api/stock/fundamentals",
params={"symbol": "AAPL"},
headers={"Authorization": f"Bearer {API_KEY}"},
)
data = response.json()
print(data["data"]["fcfPerShare"]) # 7.43JavaScript / Node.js
const API_KEY = "sk-your-api-key-here";
const res = await fetch(
"https://minivaluator.com/api/stock/fundamentals?symbol=AAPL",
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);
const { data } = await res.json();
console.log(data.fcfPerShare); // 7.43