earnings-preview

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Earnings Preview Skill

财报预览技能

Generates a pre-earnings briefing using Yahoo Finance data via yfinance. Pulls together upcoming earnings date, consensus estimates, historical accuracy, analyst sentiment, and key financial context — everything you need before an earnings call.
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 All Data

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

Extract the ticker symbol from the user's request. If they mention a company name without a ticker, look it up. Then fetch all relevant data in one script to minimize API calls.
python
import yfinance as yf
import pandas as pd
from datetime import datetime

ticker = yf.Ticker("AAPL")  # replace with actual ticker
从用户请求中提取ticker(股票代码)。如果用户只提到公司名没有提股票代码,请自行查询。然后用一个脚本获取所有相关数据以减少API调用次数。
python
import yfinance as yf
import pandas as pd
from datetime import datetime

ticker = yf.Ticker("AAPL")  # replace with actual ticker

--- Core data ---

--- Core data ---

info = ticker.info calendar = ticker.calendar
info = ticker.info calendar = ticker.calendar

--- Estimates ---

--- Estimates ---

earnings_est = ticker.earnings_estimate revenue_est = ticker.revenue_estimate
earnings_est = ticker.earnings_estimate revenue_est = ticker.revenue_estimate

--- Historical track record ---

--- Historical track record ---

earnings_hist = ticker.earnings_history
earnings_hist = ticker.earnings_history

--- Analyst sentiment ---

--- Analyst sentiment ---

price_targets = ticker.analyst_price_targets recommendations = ticker.recommendations
price_targets = ticker.analyst_price_targets recommendations = ticker.recommendations

--- Recent financials for context ---

--- Recent financials for context ---

quarterly_income = ticker.quarterly_income_stmt quarterly_cashflow = ticker.quarterly_cashflow
undefined
quarterly_income = ticker.quarterly_income_stmt quarterly_cashflow = ticker.quarterly_cashflow
undefined

What to extract from each source

从每个数据源需要提取的内容

Data SourceKey FieldsPurpose
calendar
Earnings Date, Ex-Dividend DateWhen earnings are and key dates
earnings_estimate
avg, low, high, numberOfAnalysts, yearAgoEps, growth (for 0q, +1q, 0y, +1y)Consensus EPS expectations
revenue_estimate
avg, low, high, numberOfAnalysts, yearAgoRevenue, growthRevenue expectations
earnings_history
epsEstimate, epsActual, epsDifference, surprisePercentBeat/miss track record
analyst_price_targets
current, low, high, mean, medianStreet price targets
recommendations
Buy/Hold/Sell countsSentiment distribution
quarterly_income_stmt
TotalRevenue, NetIncome, BasicEPSRecent trajectory

数据源关键字段用途
calendar
财报日期、除息日财报发布时间和关键节点
earnings_estimate
avg, low, high, numberOfAnalysts, yearAgoEps, growth (for 0q, +1q, 0y, +1y)EPS一致预期
revenue_estimate
avg, low, high, numberOfAnalysts, yearAgoRevenue, growth营收预期
earnings_history
epsEstimate, epsActual, epsDifference, surprisePercent超出/不及预期历史记录
analyst_price_targets
current, low, high, mean, median华尔街目标价
recommendations
买入/持有/卖出计数情绪分布
quarterly_income_stmt
TotalRevenue, NetIncome, BasicEPS近期经营趋势

Step 3: Build the Earnings Preview

步骤3:构建财报预览

Assemble the data into a structured briefing. The goal is to give the user everything they need in one glance.
将数据组装成结构化的简报,目标是让用户一眼就能获取所有需要的信息。

Section 1: Earnings Date & Key Info

模块1:财报日期与核心信息

Report the upcoming earnings date from
calendar
. Include:
  • Company name, ticker, sector, industry
  • Upcoming earnings date (and whether it's before/after market)
  • Current stock price and recent performance (1-week, 1-month)
  • Market cap
展示
calendar
中获取的即将到来的财报日期,包含:
  • 公司名称、股票代码、所属板块、行业
  • 即将到来的财报日期(以及是否为盘前/盘后发布)
  • 当前股价和近期表现(1周、1个月)
  • 市值

Section 2: Consensus Estimates

模块2:一致预期

Present the current quarter estimates from
earnings_estimate
and
revenue_estimate
:
MetricConsensusLowHigh# AnalystsYear AgoGrowth
EPS$1.42$1.35$1.5028$1.26+12.7%
Revenue$94.3B$92.1B$96.8B25$89.5B+5.4%
If the estimate range is unusually wide (high/low spread > 20% of consensus), note that as a sign of high uncertainty.
展示
earnings_estimate
revenue_estimate
中的当前季度预期:
指标一致预期值最低预期最高预期分析师数量去年同期值增速
EPS$1.42$1.35$1.5028$1.26+12.7%
营收$94.3B$92.1B$96.8B25$89.5B+5.4%
如果预期范围异常宽(最高/最低值差超过一致预期的20%),请标注这是高不确定性的信号。

Section 3: Historical Beat/Miss Track Record

模块3:历史超出/不及预期记录

From
earnings_history
, show the last 4 quarters:
QuarterEPS EstEPS ActualSurpriseBeat/Miss
Q3 2024$1.35$1.40+3.7%Beat
Q2 2024$1.30$1.33+2.3%Beat
Q1 2024$1.52$1.53+0.7%Beat
Q4 2023$2.10$2.18+3.8%Beat
Summarize: "AAPL has beaten EPS estimates in 4 of the last 4 quarters by an average of 2.6%."
earnings_history
中展示过去4个季度的记录:
季度EPS预期实际EPS超预期幅度超出/不及预期
2024年第三季度$1.35$1.40+3.7%超出预期
2024年第二季度$1.30$1.33+2.3%超出预期
2024年第一季度$1.52$1.53+0.7%超出预期
2023年第四季度$2.10$2.18+3.8%超出预期
总结示例:"AAPL在过去4个季度均超出EPS预期,平均超预期幅度为2.6%。"

Section 4: Analyst Sentiment

模块4:分析师情绪

From
recommendations
and
analyst_price_targets
:
  • Current recommendation distribution (Strong Buy / Buy / Hold / Sell / Strong Sell)
  • Price target range: low, mean, median, high vs. current price
  • Implied upside/downside from mean target
recommendations
analyst_price_targets
中提取:
  • 当前推荐分布(强力买入/买入/持有/卖出/强力卖出)
  • 目标价范围:最低、均值、中位数、最高值与当前价格对比
  • 均值目标价对应的潜在上涨/下跌空间

Section 5: Key Metrics to Watch

模块5:值得关注的核心指标

Based on the quarterly financials, highlight 3-5 things the market will focus on:
  • Revenue growth trend (accelerating or decelerating?)
  • Margin trajectory (expanding or compressing?)
  • Any notable line items that changed significantly quarter-over-quarter
  • Segment breakdowns if available in the data
This section requires judgment — think about what matters for this specific company/sector.

基于季度财务数据,突出3-5个市场会重点关注的内容:
  • 营收增长趋势(加速还是放缓?)
  • 利润率趋势(扩张还是收缩?)
  • 任何环比出现显著变化的重要报表项目
  • 数据中如果有业务分部数据的话也需要列出
这部分需要结合判断——思考对于这家特定公司/行业来说什么指标最重要。

Step 4: Respond to the User

步骤4:响应用户

Present the preview as a clean, structured briefing:
  1. Lead with the headline: "AAPL reports earnings on [date]. Here's what to expect."
  2. Show all 5 sections with clear headers and tables
  3. End with a brief summary: 2-3 sentences capturing the overall setup (bullish/bearish lean based on estimates, track record, and sentiment — frame as "the street expects" not personal recommendation)
将预览内容整理为清晰、结构化的简报呈现:
  1. ** headline开头**:"AAPL将于[日期]发布财报,以下是预期内容。"
  2. 展示全部5个模块,配有清晰的标题和表格
  3. 以简短总结收尾:用2-3句话概括整体情况(基于预期、历史记录和情绪的看涨/看跌倾向——使用"华尔街预期"表述,而非个人推荐)

Caveats to include

需要包含的免责声明

  • Estimates can change up until the report date
  • Historical beats don't guarantee future beats
  • Yahoo Finance data may lag real-time consensus by a few hours
  • This is not financial advice

  • 预期在财报发布前都有可能变化
  • 历史超预期记录不代表未来也会超预期
  • 雅虎财经数据可能比实时一致预期滞后数小时
  • 本内容不构成投资建议

Reference Files

参考文件

  • references/api_reference.md
    — Detailed yfinance API reference for earnings and estimate methods
Read the reference file when you need exact method signatures or edge case handling.
  • references/api_reference.md
    — 关于财报和预期方法的详细yfinance API参考
当你需要准确的方法签名或处理边缘case时请阅读参考文件。