# Yahoo Finance 财报与每股收益 API (yahoo_finance.earnings)

- Canonical page: https://everyinfra.com/yahoo-finance-api/earnings
- Endpoint: POST /api/v1/social with {"platform": "yahoo_finance", "action": "earnings", "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` 返回一个对象：已公布和接下来几个季度的每股收益 `quarters`，下次财报的预计日期 `next_earnings_date`、盘前还是盘后公布 `next_earnings_timing`，以及给出下季度一致预期的分析师人数 `analyst_count`。它回答「最近几个季度业绩比预期好还是差、下次什么时候公布」。

`keyword` 填股票代码，例如 AAPL、BRK.B，可以带 $，不收公司名；代码查不到不扣费。每个季度一项：财季、已公布还是待公布、分析师一致预期、实际值，以及实际减预期的差，待公布的季度没有实际值。估值、分红这类指标在统计指标那一页。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | 要查财报的美股代码，例如 AAPL、BRK.B（可带 $）；不收公司名。返回已公布季度和接下来几个季度的每股收益与下次财报日；代码查不到不扣费。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| symbol | 股票代码。 |
| quarters | 按季度的每股收益（earnings）：period（财季，如 Sep 2026）、status（reported 已公布 / upcoming 待公布）、eps_estimate（分析师一致预期）、eps_actual（实际，待公布季度没有）、eps_surprise（实际减预期）。 |
| next_earnings_date | 下次财报公布日期（earnings，YYYY-MM-DD，预计日期）；公司没公布时没有。 |
| next_earnings_timing | 下次财报在盘前还是盘后公布（earnings）：before_market_open / after_market_close；没说明时没有。 |
| analyst_count | 给出下季度 EPS 一致预期的分析师人数（earnings）；没有时没有。 |
| 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": "earnings",
  "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": "earnings",
        "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": "earnings",
  "results": {
    "symbol": …,
    "quarters": …,
    "next_earnings_date": …,
    "next_earnings_timing": …,
    "analyst_count": …,
    "platform": …
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 能用公司名查财报吗？

不能。`keyword` 只收美股代码，例如 AAPL 或 BRK.B，可以带 $，公司名查不到。代码查不到时不扣费，不确定代码对不对，可以直接试一次。

### 怎么看一家公司最近几个季度有没有超预期？

看 `quarters` 里已公布的季度：实际值减去分析师一致预期，就是每个季度的差，为正是超预期，为负是不及预期。待公布的季度只有预期，没有实际值，自然也没有差，统计前先把它们排除。

### `next_earnings_date` 是确定的日期吗？

不一定，它是预计日期，公司没公布时没有这个字段。`next_earnings_timing` 说明下次财报在盘前还是盘后公布，没说明时也没有。排财报日历时，这两个字段缺失就当作时间未定，别按默认值补。

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