Loading...
Loading...
Generate a post-earnings analysis for any stock using Yahoo Finance data. Use when the user wants to review what happened after earnings, understand beat/miss results, see stock reaction, or get an earnings recap. Triggers: "AAPL earnings recap", "how did TSLA earnings go", "MSFT earnings results", "did NVDA beat earnings", "post-earnings analysis", "earnings surprise", "what happened with GOOGL earnings", "earnings reaction", "stock moved after earnings", "EPS beat or miss", "revenue beat or miss", "quarterly results for", "how were earnings", "AMZN reported last night", "earnings call recap", or any request about a company's recent earnings outcome. Use this skill when the user references a past earnings event, even if they just say "AAPL reported" or "how did they do".
npx skill4agent add himself65/finance-skills earnings-recap!`python3 -c "import yfinance; print('yfinance ' + yfinance.__version__ + ' installed')" 2>/dev/null || echo "YFINANCE_NOT_INSTALLED"`YFINANCE_NOT_INSTALLEDimport subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance"])import yfinance as yf
import pandas as pd
from datetime import datetime, timedelta
ticker = yf.Ticker("AAPL") # replace with actual ticker
# --- Earnings result ---
earnings_hist = ticker.earnings_history
# --- Financial statements ---
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
hist = ticker.history(period="1mo")
# --- Context ---
info = ticker.info
news = ticker.news
recommendations = ticker.recommendations| Data Source | Key Fields | Purpose |
|---|---|---|
| epsEstimate, epsActual, epsDifference, surprisePercent | Beat/miss result |
| TotalRevenue, GrossProfit, OperatingIncome, NetIncome, BasicEPS | Actual financials |
| Close prices around earnings date | Stock price reaction |
| currentPrice, marketCap, forwardPE | Current context |
| Recent headlines | Earnings-related news |
earnings_historyimport numpy as np
# Find the earnings date from earnings_history index
earnings_date = earnings_hist.index[0] # most recent
# Get daily prices around the earnings date
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| Metric | Estimate | Actual | Surprise |
|---|---|---|---|
| EPS | $1.35 | $1.40 | +$0.05 (+3.7%) |
earnings_historyquarterly_income_stmt| Quarter | Revenue | YoY Growth | Gross Margin | Operating Margin | 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 |
earnings_historyearnings_historyrecommendationsreferences/api_reference.md