API 參考

概述

MiniValuator 提供 REST API,讓你透過程式直接獲取股票基本面資料。計費規則與網頁端相同——首次查詢新股票消耗 10 積分,7 天內重複查詢免費。

Base URL: https://minivaluator.com

認證方式: API Key,透過 Authorization: Bearer sk-... 請求頭傳入


獲取 API Key

  1. 登入你的 MiniValuator 賬號
  2. 進入 設定 → API Keys
  3. 點選新增 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"

查詢引數

引數型別必填說明
symbolstring股票程式碼,如 AAPLMSFTGOOGL

響應示例

{
  "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"
  }
}

響應欄位說明

欄位型別說明
symbolstring大寫股票程式碼
namestring公司名稱
fcfPerSharenumber每股自由現金流(TTM,美元)
currentPricenumber當前股價(美元)
currentPFCFnumber市現率(TTM)
epsnumber每股收益(TTM,美元)
currentPEnumber市盈率(TTM)
growthEstimateobject | null基於營收的 5 年增長率預測
earningsGrowthEstimateobject | null基於 EPS 的 5 年增長率預測
dataSourcestring資料來源

growthEstimate 欄位

欄位型別說明
ratesnumber[]5 個逐年增長率(小數,如 0.08 = 8%)
cagrnumber全週期複合年增長率
quality"ok" | "partial" | "insufficient"資料置信度
flagsstring[]資料填充或截斷說明

錯誤響應

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.43

JavaScript / 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