4e5af95272
- Add defeatbeta-api as primary financial data source (replaces yfinance for analysis) - Add comprehensive Jupyter notebook tutorial (defeatbeta_tutorial.ipynb) - Add API comparison script (compare_apis.py) - Add data exploration script (explore_data.py) - Add basic test script (test_defeatbeta.py) - Add notebook runner script (run_notebook.sh) - Add org-mode mapping documentation (docs/defeatbeta_mapping.org) - Update pyproject.toml with defeatbeta-api dependency - Add defeatbeta-api as git submodule for reference DefeatBeta Advantages: - No rate limits (HuggingFace hosted) - Historical financial ratios (ROE, ROIC, WACC time series) - Earnings call transcripts access - Revenue segmentation by product/geography - Automated DCF valuation with Excel output - DuckDB-powered fast queries Note: .envrc, .jupyter_checkpoints/, __marimo__/, AAPL.xlsx, tearsheet.html and other generated files intentionally excluded
3.4 KiB
3.4 KiB
DefeatBeta-API Tutorial Notebook
An interactive Jupyter notebook comparing DefeatBeta-API vs Yahoo Finance for financial data analysis.
📚 What's Included
defeatbeta_tutorial.ipynb
A comprehensive 12-section interactive notebook covering:
- Quick Performance Test - Compare query speeds
- Price Data Comparison - OHLCV data structures
- Valuation Metrics - TTM EPS, P/E ratios, Market Cap (historical!)
- Financial Statements - Income statements, balance sheets, cash flows
- Financial Ratios - ROE, ROIC, WACC with full time-series
- Growth & Margin Metrics - YoY growth and margin analysis
- Earnings Transcripts - Unique feature! Full transcript access
- Revenue Breakdown - Unique feature! By segment and geography
- DCF Valuation - Unique feature! Automated Excel output
- Interactive Stock Analysis - Explore any stock symbol
- Stock Comparison - Compare multiple stocks side-by-side
- Complete Method Reference - All available API methods
🚀 How to Use
Option 1: Run the notebook directly
./run_notebook.sh
Option 2: Run with uv
uv run jupyter notebook defeatbeta_tutorial.ipynb
Option 3: Convert to Python script
uv run jupyter nbconvert --to script defeatbeta_tutorial.ipynb
uv run python defeatbeta_tutorial.py
📦 Requirements
uv add defeatbeta-api jupyter
🎯 Key Features Demonstrated
DefeatBeta-API Unique Features:
- ✅ Earnings Call Transcripts - Access full transcripts by quarter
- ✅ Revenue Segmentation - Breakdown by product/segment/geography
- ✅ Automated DCF - Professional Excel valuation models
- ✅ Historical Financial Ratios - Time-series for ROE, ROIC, WACC
- ✅ AI-Powered Analysis - LLM analysis of transcripts
- ✅ No Rate Limits - Hugging Face hosted data
Comparison with Yahoo Finance:
- DefeatBeta: Historical analysis, financial modeling, no rate limits
- Yahoo Finance: Real-time data, analyst consensus, larger ecosystem
📊 Example Output
# Stock Comparison
Symbol Price P/E Market Cap ROE Rev Growth
AAPL $270.23 31.2 $4.1T 10.2% 16.7%
MSFT $420.00 35.1 $3.1T 31.1% 20.2%
GOOGL $341.68 31.6 $4.1T 8.6% 22.3%
NVDA $201.68 41.2 $4.9T 31.1% 73.2%
🧪 Exercises
Try these challenges in the notebook:
- Find Undervalued Stocks - P/E < 20 but ROE > 15%
- Growth Analysis - Compare NVDA vs AMD
- DCF Valuation - Compare fair value estimates
- Revenue Mix - Track Apple's services growth
- Transcript Mining - Extract sentiment from earnings calls
📖 Documentation
⚠️ Notes
- Data is updated daily (batch on HuggingFace)
- Real-time data requires Yahoo Finance
- AI features need
OPENAI_API_KEYset - Some features require Windows WSL/Docker (DuckDB dependency)
🎓 Learning Path
- Start with Section 1-2 to understand data structures
- Move to Section 3-5 for valuation and ratios
- Explore Section 7-9 for unique features
- Complete Section 10-11 for practical analysis
- Reference Section 12 for complete API
Created: 2026-04-25 Version: 0.0.45 Author: Interactive Tutorial