Skill-Details
earnings-recap
Post-earnings financial analysis.
Vor Nutzung prüfen
Die automatische Prüfung bewertet Relevanz, nicht Sicherheit oder Empfehlung. Lies vor der Nutzung die Quellanweisungen.
SKILL.md
Dieser Auszug wurde bei der Prüfung gespeichert. Die externe Quelle enthält die vollständige und aktuelle Version.
---
name: earnings-recap
description: >
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".
---
# Earnings Recap Skill
Generates a post-earnings analysis using Yahoo Finance data via [yfinance](https://github.com/ranaroussi/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.
---
## Step 1: Ensure yfinance Is Available
**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.
---
## Step 2: Identify the Ticker and Gather Data
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
# --- 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
```
### What to extract
| Data Source | Key Fields | Purpose |
|---|---|---|
| `earnings_history` | epsEstimate, epsActual, epsDifference, surprisePercent | Beat/miss result |
| `quarterly_income_stmt` | TotalRevenue, GrossProfit, OperatingIncome, NetIncome, BasicEPS | Actual financials |
| `history()` | Close prices around earnings date | Stock price reaction |
| `info` | currentPrice, marketCap, forwardPE | Current context |
| `news` | Recent headlines | Earnings-related news |
---
## Step 3: Determine the Most Recent Earnings
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)
### Price reaction calculation
```python
import 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 = Vollständige Quelle auf GitHub lesen (öffnet externe Seite)