# Yahoo Finance 分析师评级 API (yahoo_finance.analyst)

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

Yahoo Finance 分析师评级按标的代码 `keyword` 读取一只股票的分析师评级：评级分布随时间的变化，以及评级上调与下调的历史记录。它回答「分析师对这只股票的评级怎样分布、最近有哪些调整」，适合金融资讯和数据产品补充评级信息、财经编辑引用评级变化，以及研究人员把评级调整当作事件数据整理。

`recommendation_trend` 看的是一段时间里各档评级的整体分布，`upgrades_downgrades` 看的是具体哪一次发生了什么调整，`symbol` 标明数据对应的代码。这里的数据是分析师公开发表的观点，原样提供，不构成投资建议。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | Yahoo Finance 标的代码，例如 AAPL；不是公司名全文搜索，市场后缀须保留。analyst 每次针对一个代码返回评级分布和升降级记录，目标价在每条升降级记录里。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| symbol | 股票代码。 |
| recommendation_trend | 分析师评级分布随时间的变化。 |
| upgrades_downgrades | 评级调整历史。 |
| 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": "analyst",
  "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": "analyst",
        "params": {
            "keyword": "AAPL",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "yahoo_finance",
  "action": "analyst",
  "results": {
    "symbol": "AAPL",
    "recommendation_trend": [
      {
        "period": "0m",
        "strongBuy": 6,
        "buy": 19,
        "hold": 13,
        "sell": 3,
        "strongSell": 3
      },
      {
        "period": "-1m",
        "strongBuy": 6,
        "buy": 19,
        "hold": 14,
        "sell": 3,
        "strongSell": 2
      },
      {
        "period": "-2m",
        "strongBuy": 6,
        "buy": 22,
        "hold": 14,
        "sell": 2,
        "strongSell": 2
      }
    ],
    "upgrades_downgrades": [
      {
        "firm": "B of A Securities",
        "action": "reit",
        "from_grade": "Buy",
        "to_grade": "Buy",
        "price_target": 370,
        "prior_price_target": 370,
        "posted_at": "2026-09-23T17:25:04+00:00"
      },
      {
        "firm": "Evercore ISI Group",
        "action": "main",
        "from_grade": "Outperform",
        "to_grade": "Outperform",
        "price_target": 380,
        "prior_price_target": 365,
        "posted_at": "2026-09-18T11:45:30+00:00"
      },
      {
        "firm": "B of A Securities",
        "action": "reit",
        "from_grade": "Buy",
        "to_grade": "Buy",
        "price_target": 370,
        "prior_price_target": 370,
        "posted_at": "2026-09-17T18:02:51+00:00"
      }
    ],
    "platform": "yahoo_finance"
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `keyword` 里的代码需要带市场后缀吗？

代码本身带后缀的就要保留，按 Yahoo Finance 页面上显示的写法原样填写；AAPL 这类没有后缀的代码直接填。公司全名不会被检索，每次调用只对应一个代码。拿不准时，先把代码交给 Yahoo Finance 关键词搜索，看返回的名称和交易所是否对得上。

### 能只查某段时间的评级吗？

这个能力没有日期参数，每次返回这个代码当下可读到的评级数据。`recommendation_trend` 本身按时间列出评级分布，`upgrades_downgrades` 记录了历次调整；需要更长的序列时，定期调用并按调用日期存档。

### 怎么把评级和其他数据放在一起看？

同一个代码可以分别交给 Yahoo Finance 的历史行情、财务指标和财经新闻，把评级调整放到同期的价格走势、财务报表和新闻时间线上对照，便于研究和报道时说明背景。

## 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
