earnings-recap

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Earnings Recap Skill

财报回顾 Skill

Generates a post-earnings analysis using Yahoo Finance data via yfinance. Covers the actual vs estimated numbers, surprise magnitude, stock price reaction, and financial context — a complete picture of what happened.
Important: Data is for research and educational purposes only. Not financial advice. yfinance is not affiliated with Yahoo, Inc.

通过 yfinance 调用雅虎财经数据生成财报后分析,覆盖实际值与预期值对比、超预期幅度、股价反应及财务背景,全面呈现财报发布后的整体情况。
重要提示:数据仅用于研究和教育目的,不构成投资建议。yfinance 与 Yahoo, Inc. 无附属关系。

Step 1: Ensure yfinance Is Available

步骤 1:确保 yfinance 可用

Current environment status:
!`python3 -c "import yfinance; print('yfinance ' + yfinance.__version__ + ' installed')" 2>/dev/null || echo "YFINANCE_NOT_INSTALLED"`
If
YFINANCE_NOT_INSTALLED
, install it:
python
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance"])
If already installed, skip to the next step.

当前环境状态:
!`python3 -c "import yfinance; print('yfinance ' + yfinance.__version__ + ' installed')" 2>/dev/null || echo "YFINANCE_NOT_INSTALLED"`
如果输出
YFINANCE_NOT_INSTALLED
,请安装:
python
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance"])
如果已安装,直接跳到下一步。

Step 2: Identify the Ticker and Gather Data

步骤 2:识别股票代码并收集数据

Extract the ticker from the user's request. Fetch all relevant post-earnings data in one script.
python
import yfinance as yf
import pandas as pd
from datetime import datetime, timedelta

ticker = yf.Ticker("AAPL")  # replace with actual ticker
从用户请求中提取股票代码,通过一个脚本获取所有相关的财报后数据:
python
import yfinance as yf
import pandas as pd
from datetime import datetime, timedelta

ticker = yf.Ticker("AAPL")  # 替换为实际股票代码

--- Earnings result ---

--- 财报结果 ---

earnings_hist = ticker.earnings_history
earnings_hist = ticker.earnings_history

--- Financial statements ---

--- 财务报表 ---

quarterly_income = ticker.quarterly_income_stmt quarterly_cashflow = ticker.quarterly_cashflow quarterly_balance = ticker.quarterly_balance_sheet
quarterly_income = ticker.quarterly_income_stmt quarterly_cashflow = ticker.quarterly_cashflow quarterly_balance = ticker.quarterly_balance_sheet

--- Price reaction ---

--- 价格反应 ---

Get ~30 days of history to capture the reaction window

获取近30天的历史数据以覆盖反应窗口

hist = ticker.history(period="1mo")
hist = ticker.history(period="1mo")

--- Context ---

--- 背景信息 ---

info = ticker.info news = ticker.news recommendations = ticker.recommendations
undefined
info = ticker.info news = ticker.news recommendations = ticker.recommendations
undefined

What to extract

需提取的内容

Data SourceKey FieldsPurpose
earnings_history
epsEstimate, epsActual, epsDifference, surprisePercentBeat/miss result
quarterly_income_stmt
TotalRevenue, GrossProfit, OperatingIncome, NetIncome, BasicEPSActual financials
history()
Close prices around earnings dateStock price reaction
info
currentPrice, marketCap, forwardPECurrent context
news
Recent headlinesEarnings-related news

数据源关键字段用途
earnings_history
epsEstimate, epsActual, epsDifference, surprisePercent业绩超出/低于预期结果
quarterly_income_stmt
TotalRevenue, GrossProfit, OperatingIncome, NetIncome, BasicEPS实际财务数据
history()
财报日期前后的收盘价股价反应
info
currentPrice, marketCap, forwardPE当前市场背景
news
近期头条财报相关新闻

Step 3: Determine the Most Recent Earnings

步骤 3:确定最新一期财报

The most recent earnings result is the first row (most recent date) in
earnings_history
. Use its date to:
  1. Identify the earnings date for the price reaction analysis
  2. Match to the corresponding quarter in the financial statements
  3. Calculate stock price reaction — compare the close before earnings to the next trading day's close (or open, depending on whether earnings were before/after market)
最新的财报结果是
earnings_history
中的第一行(日期最近),使用其日期完成以下操作:
  1. 确定财报日期 用于股价反应分析
  2. 匹配财务报表中对应的季度
  3. 计算股价反应——对比财报前的收盘价与下一个交易日的收盘价(如果财报在盘前/盘后发布,可对比开盘价)

Price reaction calculation

股价反应计算

python
import numpy as np
python
import numpy as np

Find the earnings date from earnings_history index

从 earnings_history 索引中获取财报日期

earnings_date = earnings_hist.index[0] # most recent
earnings_date = earnings_hist.index[0] # 最新日期

Get daily prices around the earnings date

获取财报日期前后的日度价格

hist_extended = ticker.history(start=earnings_date - timedelta(days=5), end=earnings_date + timedelta(days=5))
hist_extended = ticker.history(start=earnings_date - timedelta(days=5), end=earnings_date + timedelta(days=5))

The reaction is typically measured as:

反应通常按以下方式计算:

- Close on the last trading day before earnings -> Close on the first trading day after

- 财报前最后一个交易日的收盘价 -> 财报后第一个交易日的收盘价

Be careful with before/after market reports

注意区分盘前/盘后发布的财报

if len(hist_extended) >= 2: pre_price = hist_extended['Close'].iloc[0] post_price = hist_extended['Close'].iloc[-1] reaction_pct = ((post_price - pre_price) / pre_price) * 100

**Note**: The exact reaction window depends on when the company reported (before market open vs after close). The price data will reflect this — look for the biggest gap between consecutive closes near the earnings date.

---
if len(hist_extended) >= 2: pre_price = hist_extended['Close'].iloc[0] post_price = hist_extended['Close'].iloc[-1] reaction_pct = ((post_price - pre_price) / pre_price) * 100

**注意**:具体的反应窗口取决于公司财报的发布时间(盘前 vs 盘后),价格数据会反映这一点——请在财报日期附近寻找连续收盘价之间的最大缺口。

---

Step 4: Build the Earnings Recap

步骤 4:生成财报回顾

Section 1: Headline Result

第一部分:核心结果

Lead with the key numbers:
  • EPS: Actual vs. Estimate, beat/miss by how much, surprise %
  • Revenue: Actual vs. prior year (from quarterly_income_stmt TotalRevenue)
  • Stock reaction: % move on earnings day
Example: "AAPL beat Q3 EPS estimates by 3.7% ($1.40 actual vs $1.35 expected). Revenue grew 5.4% YoY to $94.3B. The stock rose +2.1% on the report."
首先展示核心数据:
  • EPS:实际值 vs 预期值,超出/低于预期的幅度,超预期百分比
  • 营收:实际值 vs 去年同期(从 quarterly_income_stmt 的 TotalRevenue 获取)
  • 股价反应:财报当日的涨跌幅
示例:"AAPL 第三季度 EPS 超出预期 3.7%(实际 1.40 美元 vs 预期 1.35 美元),营收同比增长 5.4% 至 943 亿美元,股价受财报影响上涨 +2.1%。"

Section 2: Earnings vs. Estimates Detail

第二部分:财报与预期对比详情

MetricEstimateActualSurprise
EPS$1.35$1.40+$0.05 (+3.7%)
If the user asked about a specific quarter (not the most recent), look further back in
earnings_history
.
指标预期实际超预期幅度
EPS$1.35$1.40+$0.05 (+3.7%)
如果用户查询的是特定季度(而非最新季度),请在
earnings_history
中回溯查找对应数据。

Section 3: Quarterly Financial Trends

第三部分:季度财务趋势

Show the last 4 quarters of key metrics from
quarterly_income_stmt
:
QuarterRevenueYoY GrowthGross MarginOperating MarginEPS
Q3 2024$94.3B+5.4%46.2%30.1%$1.40
Q2 2024$85.8B+4.9%46.0%29.8%$1.33
Q1 2024$119.6B+2.1%45.9%33.5%$2.18
Q4 2023$89.5B-0.3%45.2%29.2%$1.26
Calculate margins from the raw financials:
  • Gross Margin = GrossProfit / TotalRevenue
  • Operating Margin = OperatingIncome / TotalRevenue
展示
quarterly_income_stmt
中最近 4 个季度的核心指标:
季度营收同比增速毛利率运营利润率EPS
Q3 2024$94.3B+5.4%46.2%30.1%$1.40
Q2 2024$85.8B+4.9%46.0%29.8%$1.33
Q1 2024$119.6B+2.1%45.9%33.5%$2.18
Q4 2023$89.5B-0.3%45.2%29.2%$1.26
从原始财务数据计算利润率:
  • 毛利率 = GrossProfit / TotalRevenue
  • 运营利润率 = OperatingIncome / TotalRevenue

Section 4: Stock Price Reaction

第四部分:股价反应

  • The % move on the earnings day/next session
  • How it compares to the stock's average earnings-day move (calculate the average absolute move from the last 4 earnings dates in
    earnings_history
    )
  • Where the stock is now relative to the earnings-day move (has it held, given back gains, extended further?)
  • 财报当日/下一个交易日的涨跌幅
  • 与该股平均财报日涨跌幅的对比(计算
    earnings_history
    中最近 4 次财报日的平均绝对涨跌幅)
  • 当前股价相对财报日涨跌幅的表现(是否保持涨幅、回吐涨幅、还是进一步上涨?)

Section 5: Context & What Changed

第五部分:背景与变化

Based on the data, note:
  • Whether margins expanded or compressed vs prior quarter
  • Any notable changes in revenue growth trajectory
  • How the beat/miss compares to the stock's historical pattern (from the full
    earnings_history
    )
  • Current analyst sentiment from
    recommendations
    if available

基于数据,标注以下内容:
  • 利润率相对上一季度是扩张还是收缩
  • 营收增长轨迹是否有明显变化
  • 本次超预期/不及预期与该股历史表现的对比(从完整的
    earnings_history
    获取)
  • 如果有可用的
    recommendations
    数据,展示当前分析师观点

Step 5: Respond to the User

步骤 5:响应用户

Present the recap as a clean, structured summary:
  1. Lead with the headline: "AAPL reported Q3 2024 earnings on [date]: Beat EPS by 3.7%, revenue +5.4% YoY."
  2. Show the tables for detail
  3. Highlight what matters: Was this a meaningful beat or a low-bar situation? Is the trend improving or deteriorating?
  4. Keep it factual — present the data, avoid making investment recommendations
将财报回顾整理为清晰、结构化的摘要呈现:
  1. 核心结果先行:"AAPL 于 [日期] 发布 2024 年第三季度财报:EPS 超出预期 3.7%,营收同比增长 5.4%。"
  2. 展示表格 呈现详细数据
  3. 突出重点:本次是明显超预期还是低基数下的达标?趋势是向好还是走弱?
  4. 保持客观——仅呈现数据,避免给出投资建议

Caveats to include

需包含的免责声明

  • Yahoo Finance data may not include all details from the earnings call (guidance, segment breakdowns)
  • Revenue estimates are harder to compare precisely — yfinance provides YoY comparison from financial statements
  • Price reaction may be influenced by broader market moves on the same day
  • This is not financial advice

  • 雅虎财经数据可能未覆盖财报电话会议的全部细节(业绩指引、细分业务数据等)
  • 营收预期难以精确对比——yfinance 提供财务报表中的同比对比数据
  • 股价反应可能受当日大盘走势影响
  • 本内容不构成投资建议

Reference Files

参考文件

  • references/api_reference.md
    — Detailed yfinance API reference for earnings history and financial statement methods
Read the reference file when you need exact method signatures or to handle edge cases in the financial data.
  • references/api_reference.md
    —— yfinance API 的详细参考,包含财报历史和财务报表方法的说明
当你需要确切的方法签名或是处理财务数据的边缘情况时,请阅读参考文件。