earnings-preview
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEarnings 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 , install it:
YFINANCE_NOT_INSTALLEDpython
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_INSTALLEDpython
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
undefinedquarterly_income = ticker.quarterly_income_stmt
quarterly_cashflow = ticker.quarterly_cashflow
undefinedWhat to extract from each source
从每个数据源需要提取的内容
| Data Source | Key Fields | Purpose |
|---|---|---|
| Earnings Date, Ex-Dividend Date | When earnings are and key dates |
| avg, low, high, numberOfAnalysts, yearAgoEps, growth (for 0q, +1q, 0y, +1y) | Consensus EPS expectations |
| avg, low, high, numberOfAnalysts, yearAgoRevenue, growth | Revenue expectations |
| epsEstimate, epsActual, epsDifference, surprisePercent | Beat/miss track record |
| current, low, high, mean, median | Street price targets |
| Buy/Hold/Sell counts | Sentiment distribution |
| TotalRevenue, NetIncome, BasicEPS | Recent trajectory |
| 数据源 | 关键字段 | 用途 |
|---|---|---|
| 财报日期、除息日 | 财报发布时间和关键节点 |
| avg, low, high, numberOfAnalysts, yearAgoEps, growth (for 0q, +1q, 0y, +1y) | EPS一致预期 |
| avg, low, high, numberOfAnalysts, yearAgoRevenue, growth | 营收预期 |
| epsEstimate, epsActual, epsDifference, surprisePercent | 超出/不及预期历史记录 |
| current, low, high, mean, median | 华尔街目标价 |
| 买入/持有/卖出计数 | 情绪分布 |
| 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 . Include:
calendar- 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 and :
earnings_estimaterevenue_estimate| Metric | Consensus | Low | High | # Analysts | Year Ago | Growth |
|---|---|---|---|---|---|---|
| EPS | $1.42 | $1.35 | $1.50 | 28 | $1.26 | +12.7% |
| Revenue | $94.3B | $92.1B | $96.8B | 25 | $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_estimaterevenue_estimate| 指标 | 一致预期值 | 最低预期 | 最高预期 | 分析师数量 | 去年同期值 | 增速 |
|---|---|---|---|---|---|---|
| EPS | $1.42 | $1.35 | $1.50 | 28 | $1.26 | +12.7% |
| 营收 | $94.3B | $92.1B | $96.8B | 25 | $89.5B | +5.4% |
如果预期范围异常宽(最高/最低值差超过一致预期的20%),请标注这是高不确定性的信号。
Section 3: Historical Beat/Miss Track Record
模块3:历史超出/不及预期记录
From , show the last 4 quarters:
earnings_history| Quarter | EPS Est | EPS Actual | Surprise | Beat/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%."
从中展示过去4个季度的记录:
earnings_history| 季度 | 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 and :
recommendationsanalyst_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
从和中提取:
recommendationsanalyst_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:
- Lead with the headline: "AAPL reports earnings on [date]. Here's what to expect."
- Show all 5 sections with clear headers and tables
- 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)
将预览内容整理为清晰、结构化的简报呈现:
- ** headline开头**:"AAPL将于[日期]发布财报,以下是预期内容。"
- 展示全部5个模块,配有清晰的标题和表格
- 以简短总结收尾:用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
参考文件
- — Detailed yfinance API reference for earnings and estimate methods
references/api_reference.md
Read the reference file when you need exact method signatures or edge case handling.
- — 关于财报和预期方法的详细yfinance API参考
references/api_reference.md
当你需要准确的方法签名或处理边缘case时请阅读参考文件。