himself65/finance-skills

earnings-preview

Generate a pre-earnings briefing for any stock using Yahoo Finance data.

Quelltext ansehen
Originales Skill-Dokument

Aus dem Quell-Repository gerendert; Überschriften, Beispiele, Code, Tabellen, Links und Bilder bleiben erhalten.

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.


Step 1: Ensure yfinance Is Available

Current environment status:

!`python3 -c "exec('try:\n import yfinance\n print(\'yfinance \' + yfinance.__version__ + \' installed\')\nexcept Exception:\n print(\'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 All Data

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

# --- Core data ---
info = ticker.info
calendar = ticker.calendar

# --- Estimates ---
earnings_est = ticker.earnings_estimate
revenue_est = ticker.revenue_estimate

# --- Historical track record ---
earnings_hist = ticker.earnings_history

# --- Analyst sentiment ---
price_targets = ticker.analyst_price_targets
recommendations = ticker.recommendations

# --- Recent financials for context ---
quarterly_income = ticker.quarterly_income_stmt
quarterly_cashflow = ticker.quarterly_cashflow

What to extract from each source

Data SourceKey FieldsPurpose
calendarEarnings Date, Ex-Dividend DateWhen earnings are and key dates
earnings_estimateavg, low, high, numberOfAnalysts, yearAgoEps, growth (for 0q, +1q, 0y, +1y)Consensus EPS expectations
revenue_estimateavg, low, high, numberOfAnalysts, yearAgoRevenue, growthRevenue expectations
earnings_historyepsEstimate, epsActual, epsDifference, surprisePercentBeat/miss track record
analyst_price_targetscurrent, low, high, mean, medianStreet price targets
recommendationsBuy/Hold/Sell countsSentiment distribution
quarterly_income_stmtTotalRevenue, NetIncome, BasicEPSRecent trajectory

Step 3: Build the Earnings Preview

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

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

Section 2: Consensus Estimates

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.

Section 3: Historical Beat/Miss Track Record

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%."

Section 4: Analyst Sentiment

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

Section 5: Key Metrics to Watch

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.


Step 4: Respond to the User

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)

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.

aus demselben Repository

Weitere Skills

Alle Skills
himself65
Community

company-valuation

Estimate the intrinsic value of a public company using DCF, relative (peer multiple) and sum-of-parts (SOTP) methods, then triangulate to an implied share price with upside/downside versus the current market price. Use this skill whenever the user asks: "what is AAPL worth", "valuation of NVDA", "fair value of TSLA", "intrinsic value", "DCF for MSFT", "build a DCF", "discounted cash flow", "WACC", "terminal value", "implied share price", "upside to fair value", "is X overvalued/undervalued", "relative valuation", "peer comparison valuation", "EV/EBITDA target", "SOTP", "sum of the parts", "how much is [company] worth", "price target from fundamentals", "value this company", or any ticker in the context of computing intrinsic or relative valuation. Default to running ALL three methods (DCF + relative + SOTP-if-applicable) and presenting a blended implied price with a sensitivity table. Do not answer valuation questions from memory — always run the workflow.

Installationen
2
GitHub Stars
3290
Aktualisiert
27. Aug.
himself65
Community

earnings-recap

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".

Installationen
2
GitHub Stars
3290
Aktualisiert
27. Aug.
himself65
Community

estimate-analysis

Deep-dive into analyst estimates and revision trends for any stock using Yahoo Finance data. Use when the user wants to understand analyst estimate direction, how EPS or revenue forecasts changed over time, compare estimate distributions, or analyze growth projections across periods. Triggers: "estimate analysis for AAPL", "analyst estimate trends for NVDA", "EPS revisions for TSLA", "how have estimates changed for MSFT", "estimate revisions", "EPS trend", "revenue estimates", "consensus changes", "analyst estimates", "estimate distribution", "growth estimates for", "estimate momentum", "revision trend", "forward estimates", "next quarter estimates", "annual estimates", "estimate spread", "bull vs bear estimates", "estimate range", or any request about tracking or comparing analyst estimates/revisions. Use this skill when the user asks about estimates beyond a simple lookup — if they want context, trends, or analysis, this is the right skill.

Installationen
2
GitHub Stars
3290
Aktualisiert
27. Aug.
himself65
Community

etf-premium

Calculate ETF premium/discount vs NAV via Yahoo Finance, and decompose single-day surges into NAV-driven vs structural components (gamma squeeze, dealer hedging, blocked AP arbitrage). Use whenever the user asks about an ETF's premium or discount, NAV comparison, why an ETF diverged from its holdings, or how much of a move is dealer-hedging-driven. Triggers: "ETF premium", "ETF discount", "NAV premium", "is SPY at a premium", "BITO premium", "IBIT premium", "bond ETF discount", "trading above/below NAV", "ETF premium screener", "biggest discount", "compare ETF NAV", "ETF arbitrage", "ETF gamma squeeze", "ETF premium surge", "decompose ETF move", "dealer gamma exposure", "GEX for ETF", "why did this ETF jump", "premium convergence", "AP arbitrage blocked", or any request about the gap between an ETF's price and underlying value. Especially relevant for leveraged, inverse, international, bond, commodity, and crypto ETFs.

Installationen
2
GitHub Stars
3290
Aktualisiert
27. Aug.