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