# Yahoo Finance 统计指标 API (yahoo_finance.statistics)

- Canonical page: https://everyinfra.com/yahoo-finance-api/statistics
- Endpoint: POST /api/v1/social with {"platform": "yahoo_finance", "action": "statistics", "params": {...}}
- Price: $0.008 per call ($8 per 1,000 requests); failed and empty results are not charged
- Returns: single object
- Mode: sync; add "mode": "async" for slow tasks

Yahoo Finance 统计指标按美股代码 `keyword` 返回一家公司的分节指标 `sections`：估值、盈利能力、分红等，每节有一句话概述和指标明细，每个指标有名称、显示值和原始数值文本。它回答「这家公司现在的估值和盈利水平怎么样」，适合做筛选前的快照，或把几家公司的指标放到一张表里对比。

显示值像 4.94T 这样带单位缩写，要做计算就用原始数值文本，它和显示值一样时就没有这一项。各公司的节和指标不完全相同，合并几家公司的结果前，先按指标名对齐。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=yahoo_finance&action=statistics

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | 要查统计指标的美股代码，例如 MSFT（可带 $）；不收公司名。返回估值、盈利能力、分红等分节指标；代码查不到不扣费。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| symbol | 股票代码。 |
| sections | 统计指标分节（statistics）：section（valuation、ratios、shares、margins、dividends 等）、summary（一句话概述）、items（key、label 指标名、value 显示值如 4.94T、raw_value 原始数值文本，和显示值一样时没有）。各公司的节和指标不完全相同。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "yahoo_finance",
  "action": "statistics",
  "params": {
    "keyword": "AAPL"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "yahoo_finance",
        "action": "statistics",
        "params": {
            "keyword": "AAPL",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "yahoo_finance",
  "action": "statistics",
  "results": {
    "symbol": …,
    "sections": …,
    "platform": …
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 显示值和原始数值有什么区别？

显示值是页面上看到的写法，例如 4.94T，适合直接展示；原始数值文本保留原始数据，适合计算和排序。两者一样时，原始数值就不单独给，这时直接用显示值。做比较时先判断有没有原始数值。

### 为什么不同公司返回的指标不一样？

各公司的节和指标不完全相同。每节自带一句话概述，可以先读概述再决定看不看明细。多家公司对比时，按指标名对齐，缺的就当缺失处理，别补成 0；先统计每个指标有几家公司给了值，再决定用哪些指标。

### 统计指标和财报与每股收益那一页怎么分工？

统计指标给估值、盈利能力、分红等分节指标，每个代码一次返回全部分节。每股收益的季度预期和实际、下次财报日在财报与每股收益那一页。两页参数都只有美股代码 `keyword`，同一个代码可以连着各调一次，示例里填的是 AAPL。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=yahoo_finance
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
