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
3449 lines
111 KiB
Plaintext
3449 lines
111 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"# 📈 DefeatBeta-API vs Yahoo Finance: Interactive Comparison\n",
|
||
"\n",
|
||
"Welcome to this interactive notebook where we'll explore the **DefeatBeta-API** - an open-source alternative to Yahoo Finance's market data APIs with higher reliability.\n",
|
||
"\n",
|
||
"## 🎯 What You'll Learn\n",
|
||
"\n",
|
||
"- How to use DefeatBeta-API for financial data analysis\n",
|
||
"- Compare data structures and methods with Yahoo Finance\n",
|
||
"- Explore unique features like earnings transcripts and DCF valuation\n",
|
||
"- Test practical trading analysis scenarios\n",
|
||
"\n",
|
||
"## 📦 Setup"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 1,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stderr",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"[nltk_data] Error loading punkt_tab: <urlopen error [SSL:\n",
|
||
"[nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed:\n",
|
||
"[nltk_data] unable to get local issuer certificate (_ssl.c:1010)>\n"
|
||
]
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\u001b[38;5;10m______ __ _ ______ _ \n",
|
||
"| _ \\ / _| | | | ___ \\ | | \n",
|
||
"| | | |___| |_ ___ __ _| |_ | |_/ / ___| |_ __ _ \n",
|
||
"| | | / _ \\ _/ _ \\/ _` | __| | ___ \\/ _ \\ __/ _` |\n",
|
||
"| |/ / __/ || __/ (_| | |_ | |_/ / __/ || (_| |\n",
|
||
"|___/ \\___|_| \\___|\\__,_|\\__| \\____/ \\___|\\__\\__,_|\u001b[0m\n",
|
||
"\u001b[1;38;5;10m📈:: Data Update Time ::\u001b[0m\t2026-04-17 \u001b[1;38;5;10m::\u001b[0m\n",
|
||
"\u001b[1;38;5;10m📈:: Software Version ::\u001b[0m\t0.0.45 \u001b[1;38;5;10m::\u001b[0m\n",
|
||
"✅ yfinance is installed\n",
|
||
"✅ DefeatBeta-API imported successfully\n",
|
||
"Python version: 3.12.12\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Import required libraries\n",
|
||
"import pandas as pd\n",
|
||
"import numpy as np\n",
|
||
"import time\n",
|
||
"import sys\n",
|
||
"\n",
|
||
"# DefeatBeta-API\n",
|
||
"from defeatbeta_api.data.ticker import Ticker\n",
|
||
"\n",
|
||
"# Yahoo Finance (for comparison)\n",
|
||
"try:\n",
|
||
" import yfinance as yf\n",
|
||
" YFINANCE_AVAILABLE = True\n",
|
||
" print(\"✅ yfinance is installed\")\n",
|
||
"except ImportError:\n",
|
||
" YFINANCE_AVAILABLE = False\n",
|
||
" print(\"⚠️ yfinance not installed - install with: uv add yfinance\")\n",
|
||
"\n",
|
||
"print(\"✅ DefeatBeta-API imported successfully\")\n",
|
||
"print(f\"Python version: {sys.version.split()[0]}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 🏃♀️ 1. QUICK PERFORMANCE TEST"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 2,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"PERFORMANCE COMPARISON: Fetching Price Data\n",
|
||
"============================================================\n",
|
||
"2026-04-25 17:43:11 INFO DuckDBClient MainThread - Cache is up-to-date. Update time: 2026-04-17\n",
|
||
"\n",
|
||
"✅ DefeatBeta: 0.617s\n",
|
||
" Data shape: (7897, 7)\n",
|
||
"\n",
|
||
"✅ Yahoo Finance: 0.493s\n",
|
||
" Data shape: (11433, 7)\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Test query speed for both APIs\n",
|
||
"symbol = 'AAPL'\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"PERFORMANCE COMPARISON: Fetching Price Data\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"# DefeatBeta\n",
|
||
"start = time.time()\n",
|
||
"db_ticker = Ticker(symbol)\n",
|
||
"db_price = db_ticker.price()\n",
|
||
"db_time = time.time() - start\n",
|
||
"print(f\"\\n✅ DefeatBeta: {db_time:.3f}s\")\n",
|
||
"print(f\" Data shape: {db_price.shape}\")\n",
|
||
"\n",
|
||
"# Yahoo Finance\n",
|
||
"if YFINANCE_AVAILABLE:\n",
|
||
" start = time.time()\n",
|
||
" yf_ticker = yf.Ticker(symbol)\n",
|
||
" yf_price = yf_ticker.history(period='max')\n",
|
||
" yf_time = time.time() - start\n",
|
||
" print(f\"\\n✅ Yahoo Finance: {yf_time:.3f}s\")\n",
|
||
" print(f\" Data shape: {yf_price.shape}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 📊 2. PRICE DATA COMPARISON"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 3,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"PRICE DATA STRUCTURE COMPARISON\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 DEFEATBETA API:\n",
|
||
" Type: DataFrame\n",
|
||
" Columns: ['symbol', 'report_date', 'open', 'close', 'high', 'low', 'volume']\n",
|
||
"\n",
|
||
" Latest 3 rows:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>open</th>\n",
|
||
" <th>close</th>\n",
|
||
" <th>high</th>\n",
|
||
" <th>low</th>\n",
|
||
" <th>volume</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>7887</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-06</td>\n",
|
||
" <td>256.51</td>\n",
|
||
" <td>258.86</td>\n",
|
||
" <td>262.16</td>\n",
|
||
" <td>256.46</td>\n",
|
||
" <td>29329900</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7888</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-07</td>\n",
|
||
" <td>256.16</td>\n",
|
||
" <td>253.50</td>\n",
|
||
" <td>256.20</td>\n",
|
||
" <td>245.70</td>\n",
|
||
" <td>62148000</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7889</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-08</td>\n",
|
||
" <td>258.45</td>\n",
|
||
" <td>258.90</td>\n",
|
||
" <td>259.75</td>\n",
|
||
" <td>256.53</td>\n",
|
||
" <td>41032800</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7890</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-09</td>\n",
|
||
" <td>259.00</td>\n",
|
||
" <td>260.49</td>\n",
|
||
" <td>261.12</td>\n",
|
||
" <td>256.07</td>\n",
|
||
" <td>28121600</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7891</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-10</td>\n",
|
||
" <td>259.98</td>\n",
|
||
" <td>260.48</td>\n",
|
||
" <td>262.19</td>\n",
|
||
" <td>259.02</td>\n",
|
||
" <td>31291500</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7892</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-13</td>\n",
|
||
" <td>259.73</td>\n",
|
||
" <td>259.20</td>\n",
|
||
" <td>260.18</td>\n",
|
||
" <td>256.66</td>\n",
|
||
" <td>36234700</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7893</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-14</td>\n",
|
||
" <td>259.25</td>\n",
|
||
" <td>258.83</td>\n",
|
||
" <td>261.93</td>\n",
|
||
" <td>257.19</td>\n",
|
||
" <td>48370700</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7894</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-15</td>\n",
|
||
" <td>258.16</td>\n",
|
||
" <td>266.43</td>\n",
|
||
" <td>266.56</td>\n",
|
||
" <td>257.81</td>\n",
|
||
" <td>49913500</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7895</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-16</td>\n",
|
||
" <td>266.80</td>\n",
|
||
" <td>263.40</td>\n",
|
||
" <td>267.16</td>\n",
|
||
" <td>261.27</td>\n",
|
||
" <td>43323100</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7896</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2026-04-17</td>\n",
|
||
" <td>266.96</td>\n",
|
||
" <td>270.23</td>\n",
|
||
" <td>272.30</td>\n",
|
||
" <td>266.72</td>\n",
|
||
" <td>61314800</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date open close high low volume\n",
|
||
"7887 AAPL 2026-04-06 256.51 258.86 262.16 256.46 29329900\n",
|
||
"7888 AAPL 2026-04-07 256.16 253.50 256.20 245.70 62148000\n",
|
||
"7889 AAPL 2026-04-08 258.45 258.90 259.75 256.53 41032800\n",
|
||
"7890 AAPL 2026-04-09 259.00 260.49 261.12 256.07 28121600\n",
|
||
"7891 AAPL 2026-04-10 259.98 260.48 262.19 259.02 31291500\n",
|
||
"7892 AAPL 2026-04-13 259.73 259.20 260.18 256.66 36234700\n",
|
||
"7893 AAPL 2026-04-14 259.25 258.83 261.93 257.19 48370700\n",
|
||
"7894 AAPL 2026-04-15 258.16 266.43 266.56 257.81 49913500\n",
|
||
"7895 AAPL 2026-04-16 266.80 263.40 267.16 261.27 43323100\n",
|
||
"7896 AAPL 2026-04-17 266.96 270.23 272.30 266.72 61314800"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 YAHOO FINANCE:\n",
|
||
" Type: DataFrame\n",
|
||
" Columns: ['Open', 'High', 'Low', 'Close', 'Volume', 'Dividends', 'Stock Splits']\n",
|
||
"\n",
|
||
" Latest 3 rows:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>Open</th>\n",
|
||
" <th>High</th>\n",
|
||
" <th>Low</th>\n",
|
||
" <th>Close</th>\n",
|
||
" <th>Volume</th>\n",
|
||
" <th>Dividends</th>\n",
|
||
" <th>Stock Splits</th>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>Date</th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-13 00:00:00-04:00</th>\n",
|
||
" <td>259.730011</td>\n",
|
||
" <td>260.179993</td>\n",
|
||
" <td>256.660004</td>\n",
|
||
" <td>259.200012</td>\n",
|
||
" <td>36234700</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-14 00:00:00-04:00</th>\n",
|
||
" <td>259.250000</td>\n",
|
||
" <td>261.929993</td>\n",
|
||
" <td>257.190002</td>\n",
|
||
" <td>258.829987</td>\n",
|
||
" <td>48370700</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-15 00:00:00-04:00</th>\n",
|
||
" <td>258.160004</td>\n",
|
||
" <td>266.559998</td>\n",
|
||
" <td>257.809998</td>\n",
|
||
" <td>266.429993</td>\n",
|
||
" <td>49913500</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-16 00:00:00-04:00</th>\n",
|
||
" <td>266.799988</td>\n",
|
||
" <td>267.160004</td>\n",
|
||
" <td>261.269989</td>\n",
|
||
" <td>263.399994</td>\n",
|
||
" <td>43323100</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-17 00:00:00-04:00</th>\n",
|
||
" <td>266.959991</td>\n",
|
||
" <td>272.299988</td>\n",
|
||
" <td>266.720001</td>\n",
|
||
" <td>270.230011</td>\n",
|
||
" <td>61436200</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-20 00:00:00-04:00</th>\n",
|
||
" <td>270.329987</td>\n",
|
||
" <td>274.279999</td>\n",
|
||
" <td>270.290009</td>\n",
|
||
" <td>273.049988</td>\n",
|
||
" <td>36590200</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-21 00:00:00-04:00</th>\n",
|
||
" <td>271.500000</td>\n",
|
||
" <td>272.799988</td>\n",
|
||
" <td>265.399994</td>\n",
|
||
" <td>266.170013</td>\n",
|
||
" <td>50209800</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-22 00:00:00-04:00</th>\n",
|
||
" <td>267.820007</td>\n",
|
||
" <td>273.739990</td>\n",
|
||
" <td>266.869995</td>\n",
|
||
" <td>273.170013</td>\n",
|
||
" <td>43249200</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-23 00:00:00-04:00</th>\n",
|
||
" <td>275.049988</td>\n",
|
||
" <td>275.769989</td>\n",
|
||
" <td>271.649994</td>\n",
|
||
" <td>273.429993</td>\n",
|
||
" <td>33399600</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2026-04-24 00:00:00-04:00</th>\n",
|
||
" <td>272.760010</td>\n",
|
||
" <td>273.059998</td>\n",
|
||
" <td>269.649994</td>\n",
|
||
" <td>271.059998</td>\n",
|
||
" <td>38124500</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" Open High Low Close \\\n",
|
||
"Date \n",
|
||
"2026-04-13 00:00:00-04:00 259.730011 260.179993 256.660004 259.200012 \n",
|
||
"2026-04-14 00:00:00-04:00 259.250000 261.929993 257.190002 258.829987 \n",
|
||
"2026-04-15 00:00:00-04:00 258.160004 266.559998 257.809998 266.429993 \n",
|
||
"2026-04-16 00:00:00-04:00 266.799988 267.160004 261.269989 263.399994 \n",
|
||
"2026-04-17 00:00:00-04:00 266.959991 272.299988 266.720001 270.230011 \n",
|
||
"2026-04-20 00:00:00-04:00 270.329987 274.279999 270.290009 273.049988 \n",
|
||
"2026-04-21 00:00:00-04:00 271.500000 272.799988 265.399994 266.170013 \n",
|
||
"2026-04-22 00:00:00-04:00 267.820007 273.739990 266.869995 273.170013 \n",
|
||
"2026-04-23 00:00:00-04:00 275.049988 275.769989 271.649994 273.429993 \n",
|
||
"2026-04-24 00:00:00-04:00 272.760010 273.059998 269.649994 271.059998 \n",
|
||
"\n",
|
||
" Volume Dividends Stock Splits \n",
|
||
"Date \n",
|
||
"2026-04-13 00:00:00-04:00 36234700 0.0 0.0 \n",
|
||
"2026-04-14 00:00:00-04:00 48370700 0.0 0.0 \n",
|
||
"2026-04-15 00:00:00-04:00 49913500 0.0 0.0 \n",
|
||
"2026-04-16 00:00:00-04:00 43323100 0.0 0.0 \n",
|
||
"2026-04-17 00:00:00-04:00 61436200 0.0 0.0 \n",
|
||
"2026-04-20 00:00:00-04:00 36590200 0.0 0.0 \n",
|
||
"2026-04-21 00:00:00-04:00 50209800 0.0 0.0 \n",
|
||
"2026-04-22 00:00:00-04:00 43249200 0.0 0.0 \n",
|
||
"2026-04-23 00:00:00-04:00 33399600 0.0 0.0 \n",
|
||
"2026-04-24 00:00:00-04:00 38124500 0.0 0.0 "
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Compare price data structures\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"PRICE DATA STRUCTURE COMPARISON\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"print(\"\\n📌 DEFEATBETA API:\")\n",
|
||
"print(f\" Type: {type(db_price).__name__}\")\n",
|
||
"print(f\" Columns: {list(db_price.columns)}\")\n",
|
||
"print(f\"\\n Latest 3 rows:\")\n",
|
||
"display(db_price.tail(10))\n",
|
||
"\n",
|
||
"if YFINANCE_AVAILABLE:\n",
|
||
" print(\"\\n📌 YAHOO FINANCE:\")\n",
|
||
" print(f\" Type: {type(yf_price).__name__}\")\n",
|
||
" print(f\" Columns: {list(yf_price.columns)}\")\n",
|
||
" print(f\"\\n Latest 3 rows:\")\n",
|
||
" display(yf_price.tail(10))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 💰 3. VALUATION METRICS"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 4,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"VALUATION METRICS (with historical data!)\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 TTM EPS History:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>tailing_eps</th>\n",
|
||
" <th>eps</th>\n",
|
||
" <th>update_time</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>104</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-01-31</td>\n",
|
||
" <td>2.94</td>\n",
|
||
" <td>0.89</td>\n",
|
||
" <td>2026-04-18</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>105</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-04-30</td>\n",
|
||
" <td>3.10</td>\n",
|
||
" <td>0.76</td>\n",
|
||
" <td>2026-04-18</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>106</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-07-31</td>\n",
|
||
" <td>3.51</td>\n",
|
||
" <td>1.08</td>\n",
|
||
" <td>2026-04-18</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>107</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-10-31</td>\n",
|
||
" <td>4.04</td>\n",
|
||
" <td>1.30</td>\n",
|
||
" <td>2026-04-18</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>108</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>4.90</td>\n",
|
||
" <td>1.76</td>\n",
|
||
" <td>2026-04-18</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date tailing_eps eps update_time\n",
|
||
"104 NVDA 2025-01-31 2.94 0.89 2026-04-18\n",
|
||
"105 NVDA 2025-04-30 3.10 0.76 2026-04-18\n",
|
||
"106 NVDA 2025-07-31 3.51 1.08 2026-04-18\n",
|
||
"107 NVDA 2025-10-31 4.04 1.30 2026-04-18\n",
|
||
"108 NVDA 2026-01-31 4.90 1.76 2026-04-18"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 TTM P/E Ratio History:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>eps_report_date</th>\n",
|
||
" <th>close_price</th>\n",
|
||
" <th>ttm_eps</th>\n",
|
||
" <th>ttm_pe</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>6846</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-04-13</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>189.31</td>\n",
|
||
" <td>4.9</td>\n",
|
||
" <td>38.63</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6847</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-04-14</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>196.51</td>\n",
|
||
" <td>4.9</td>\n",
|
||
" <td>40.10</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6848</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-04-15</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>198.87</td>\n",
|
||
" <td>4.9</td>\n",
|
||
" <td>40.59</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6849</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-04-16</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>198.35</td>\n",
|
||
" <td>4.9</td>\n",
|
||
" <td>40.48</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6850</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-04-17</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>201.68</td>\n",
|
||
" <td>4.9</td>\n",
|
||
" <td>41.16</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date eps_report_date close_price ttm_eps ttm_pe\n",
|
||
"6846 NVDA 2026-04-13 2026-01-31 189.31 4.9 38.63\n",
|
||
"6847 NVDA 2026-04-14 2026-01-31 196.51 4.9 40.10\n",
|
||
"6848 NVDA 2026-04-15 2026-01-31 198.87 4.9 40.59\n",
|
||
"6849 NVDA 2026-04-16 2026-01-31 198.35 4.9 40.48\n",
|
||
"6850 NVDA 2026-04-17 2026-01-31 201.68 4.9 41.16"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 Market Capitalization History:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>close_price</th>\n",
|
||
" <th>shares_outstanding</th>\n",
|
||
" <th>market_capitalization</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>6846</th>\n",
|
||
" <td>2026-04-13</td>\n",
|
||
" <td>189.31</td>\n",
|
||
" <td>2.430000e+10</td>\n",
|
||
" <td>4.600233e+12</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6847</th>\n",
|
||
" <td>2026-04-14</td>\n",
|
||
" <td>196.51</td>\n",
|
||
" <td>2.430000e+10</td>\n",
|
||
" <td>4.775193e+12</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6848</th>\n",
|
||
" <td>2026-04-15</td>\n",
|
||
" <td>198.87</td>\n",
|
||
" <td>2.430000e+10</td>\n",
|
||
" <td>4.832541e+12</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6849</th>\n",
|
||
" <td>2026-04-16</td>\n",
|
||
" <td>198.35</td>\n",
|
||
" <td>2.430000e+10</td>\n",
|
||
" <td>4.819905e+12</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6850</th>\n",
|
||
" <td>2026-04-17</td>\n",
|
||
" <td>201.68</td>\n",
|
||
" <td>2.430000e+10</td>\n",
|
||
" <td>4.900824e+12</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" report_date close_price shares_outstanding market_capitalization\n",
|
||
"6846 2026-04-13 189.31 2.430000e+10 4.600233e+12\n",
|
||
"6847 2026-04-14 196.51 2.430000e+10 4.775193e+12\n",
|
||
"6848 2026-04-15 198.87 2.430000e+10 4.832541e+12\n",
|
||
"6849 2026-04-16 198.35 2.430000e+10 4.819905e+12\n",
|
||
"6850 2026-04-17 201.68 2.430000e+10 4.900824e+12"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Explore valuation metrics - DefeatBeta provides HISTORICAL data\n",
|
||
"symbol = 'NVDA' # NVIDIA for interesting metrics\n",
|
||
"db_ticker = Ticker(symbol)\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"VALUATION METRICS (with historical data!)\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"print(\"\\n📌 TTM EPS History:\")\n",
|
||
"ttm_eps = db_ticker.ttm_eps()\n",
|
||
"display(ttm_eps.tail(5))\n",
|
||
"\n",
|
||
"print(\"\\n📌 TTM P/E Ratio History:\")\n",
|
||
"ttm_pe = db_ticker.ttm_pe()\n",
|
||
"display(ttm_pe.tail(5))\n",
|
||
"\n",
|
||
"print(\"\\n📌 Market Capitalization History:\")\n",
|
||
"market_cap = db_ticker.market_capitalization()\n",
|
||
"display(market_cap[['report_date', 'close_price', 'shares_outstanding', 'market_capitalization']].tail(5))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 5,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"============================================================\n",
|
||
"YAHOO FINANCE: Current Valuation (from .info)\n",
|
||
"============================================================\n",
|
||
" trailingPE: 42.591003\n",
|
||
" forwardPE: 18.530712\n",
|
||
" marketCap: 5062002737152\n",
|
||
" trailingEps: 4.89\n",
|
||
" forwardEps: 11.23918\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Compare with Yahoo Finance current values\n",
|
||
"if YFINANCE_AVAILABLE:\n",
|
||
" print(\"\\n\" + \"=\" * 60)\n",
|
||
" print(\"YAHOO FINANCE: Current Valuation (from .info)\")\n",
|
||
" print(\"=\" * 60)\n",
|
||
" \n",
|
||
" yf_ticker = yf.Ticker(symbol)\n",
|
||
" info = yf_ticker.info\n",
|
||
" \n",
|
||
" valuation_keys = ['trailingPE', 'forwardPE', 'marketCap', 'trailingEps', 'forwardEps']\n",
|
||
" for key in valuation_keys:\n",
|
||
" if key in info:\n",
|
||
" print(f\" {key}: {info[key]}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 📉 4. FINANCIAL STATEMENTS"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 6,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"QUARTERLY INCOME STATEMENT\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 Type: Statement\n",
|
||
" Methods: .df(), .data(), .print_pretty_table()\n",
|
||
"\n",
|
||
"📌 DataFrame Shape: (47, 17)\n",
|
||
" Columns: TTM + 16 quarters\n",
|
||
"\n",
|
||
"📌 KEY METRICS (TTM values):\n",
|
||
" Total Revenue: $281.72B\n",
|
||
" Gross Profit: $193.89B\n",
|
||
" Operating Income: $128.53B\n",
|
||
" Net Income Common Stockholders: $101.83B\n",
|
||
" Diluted EPS: $10.32\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Explore quarterly income statement\n",
|
||
"symbol = 'MSFT'\n",
|
||
"db_ticker = Ticker(symbol)\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"QUARTERLY INCOME STATEMENT\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"# Get the Statement object\n",
|
||
"income_stmt = db_ticker.quarterly_income_statement()\n",
|
||
"print(f\"\\n📌 Type: {type(income_stmt).__name__}\")\n",
|
||
"print(f\" Methods: .df(), .data(), .print_pretty_table()\")\n",
|
||
"\n",
|
||
"# Get as DataFrame\n",
|
||
"stmt_df = income_stmt.df()\n",
|
||
"print(f\"\\n📌 DataFrame Shape: {stmt_df.shape}\")\n",
|
||
"print(f\" Columns: TTM + 16 quarters\")\n",
|
||
"\n",
|
||
"# Show key metrics\n",
|
||
"key_metrics = [\n",
|
||
" 'Total Revenue',\n",
|
||
" 'Gross Profit',\n",
|
||
" 'Operating Income',\n",
|
||
" 'Net Income Common Stockholders',\n",
|
||
" 'Diluted EPS'\n",
|
||
"]\n",
|
||
"\n",
|
||
"print(\"\\n📌 KEY METRICS (TTM values):\")\n",
|
||
"for metric in key_metrics:\n",
|
||
" if metric in stmt_df['Breakdown'].values:\n",
|
||
" row = stmt_df[stmt_df['Breakdown'] == metric].iloc[0]\n",
|
||
" value = float(row['TTM']) # Convert Decimal to float\n",
|
||
" if abs(value) >= 1e9:\n",
|
||
" print(f\" {metric}: ${value/1e9:.2f}B\")\n",
|
||
" elif abs(value) >= 1e6:\n",
|
||
" print(f\" {metric}: ${value/1e6:.2f}M\")\n",
|
||
" else:\n",
|
||
" print(f\" {metric}: ${value:.2f}\")\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 7,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 FORMATTED TABLE (first 10 line items):\n",
|
||
"------------------------------------------------------------\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>Metric</th>\n",
|
||
" <th>TTM Value</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>Total Revenue</td>\n",
|
||
" <td>281724000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>Operating Revenue</td>\n",
|
||
" <td>281724000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>Cost of Revenue</td>\n",
|
||
" <td>87831000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>Gross Profit</td>\n",
|
||
" <td>193893000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>Operating Expense</td>\n",
|
||
" <td>65365000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>5</th>\n",
|
||
" <td>Selling General and Administrative</td>\n",
|
||
" <td>32877000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6</th>\n",
|
||
" <td>General & Administrative Expense</td>\n",
|
||
" <td>7223000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7</th>\n",
|
||
" <td>Other G and A</td>\n",
|
||
" <td>7223000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>8</th>\n",
|
||
" <td>Selling & Marketing Expense</td>\n",
|
||
" <td>25654000000.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>9</th>\n",
|
||
" <td>Research & Development</td>\n",
|
||
" <td>32488000000.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" Metric TTM Value\n",
|
||
"0 Total Revenue 281724000000.0\n",
|
||
"1 Operating Revenue 281724000000.0\n",
|
||
"2 Cost of Revenue 87831000000.0\n",
|
||
"3 Gross Profit 193893000000.0\n",
|
||
"4 Operating Expense 65365000000.0\n",
|
||
"5 Selling General and Administrative 32877000000.0\n",
|
||
"6 General & Administrative Expense 7223000000.0\n",
|
||
"7 Other G and A 7223000000.0\n",
|
||
"8 Selling & Marketing Expense 25654000000.0\n",
|
||
"9 Research & Development 32488000000.0"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Try the pretty print version\n",
|
||
"print(\"\\n📌 FORMATTED TABLE (first 10 line items):\")\n",
|
||
"print(\"-\" * 60)\n",
|
||
"# Note: print_pretty_table() might be very wide, so let's show a subset\n",
|
||
"subset = stmt_df.head(10)[['Breakdown', 'TTM']]\n",
|
||
"subset.columns = ['Metric', 'TTM Value']\n",
|
||
"display(subset)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 📈 5. FINANCIAL RATIOS"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 8,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"FINANCIAL RATIOS (Historical Time Series)\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 RETURN ON EQUITY (ROE):\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>net_income_common_stockholders</th>\n",
|
||
" <th>beginning_stockholders_equity</th>\n",
|
||
" <th>ending_stockholders_equity</th>\n",
|
||
" <th>avg_equity</th>\n",
|
||
" <th>roe</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2023-09-30</td>\n",
|
||
" <td>1.851000e+09</td>\n",
|
||
" <td>5.113000e+10</td>\n",
|
||
" <td>5.346600e+10</td>\n",
|
||
" <td>5.229800e+10</td>\n",
|
||
" <td>0.0354</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2023-12-31</td>\n",
|
||
" <td>7.927000e+09</td>\n",
|
||
" <td>5.346600e+10</td>\n",
|
||
" <td>6.263400e+10</td>\n",
|
||
" <td>5.805000e+10</td>\n",
|
||
" <td>0.1366</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2024-03-31</td>\n",
|
||
" <td>1.432000e+09</td>\n",
|
||
" <td>6.263400e+10</td>\n",
|
||
" <td>6.437800e+10</td>\n",
|
||
" <td>6.350600e+10</td>\n",
|
||
" <td>0.0225</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2024-06-30</td>\n",
|
||
" <td>1.400000e+09</td>\n",
|
||
" <td>6.437800e+10</td>\n",
|
||
" <td>6.646800e+10</td>\n",
|
||
" <td>6.542300e+10</td>\n",
|
||
" <td>0.0214</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2024-09-30</td>\n",
|
||
" <td>2.173000e+09</td>\n",
|
||
" <td>6.646800e+10</td>\n",
|
||
" <td>6.993100e+10</td>\n",
|
||
" <td>6.819950e+10</td>\n",
|
||
" <td>0.0319</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>5</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2024-12-31</td>\n",
|
||
" <td>2.314000e+09</td>\n",
|
||
" <td>6.993100e+10</td>\n",
|
||
" <td>7.291300e+10</td>\n",
|
||
" <td>7.142200e+10</td>\n",
|
||
" <td>0.0324</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2025-03-31</td>\n",
|
||
" <td>4.090000e+08</td>\n",
|
||
" <td>7.291300e+10</td>\n",
|
||
" <td>7.465300e+10</td>\n",
|
||
" <td>7.378300e+10</td>\n",
|
||
" <td>0.0055</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2025-06-30</td>\n",
|
||
" <td>1.172000e+09</td>\n",
|
||
" <td>7.465300e+10</td>\n",
|
||
" <td>7.731400e+10</td>\n",
|
||
" <td>7.598350e+10</td>\n",
|
||
" <td>0.0154</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>8</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2025-09-30</td>\n",
|
||
" <td>1.373000e+09</td>\n",
|
||
" <td>7.731400e+10</td>\n",
|
||
" <td>7.997000e+10</td>\n",
|
||
" <td>7.864200e+10</td>\n",
|
||
" <td>0.0175</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>9</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2025-12-31</td>\n",
|
||
" <td>8.400000e+08</td>\n",
|
||
" <td>7.997000e+10</td>\n",
|
||
" <td>8.213700e+10</td>\n",
|
||
" <td>8.105350e+10</td>\n",
|
||
" <td>0.0104</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date net_income_common_stockholders \\\n",
|
||
"0 TSLA 2023-09-30 1.851000e+09 \n",
|
||
"1 TSLA 2023-12-31 7.927000e+09 \n",
|
||
"2 TSLA 2024-03-31 1.432000e+09 \n",
|
||
"3 TSLA 2024-06-30 1.400000e+09 \n",
|
||
"4 TSLA 2024-09-30 2.173000e+09 \n",
|
||
"5 TSLA 2024-12-31 2.314000e+09 \n",
|
||
"6 TSLA 2025-03-31 4.090000e+08 \n",
|
||
"7 TSLA 2025-06-30 1.172000e+09 \n",
|
||
"8 TSLA 2025-09-30 1.373000e+09 \n",
|
||
"9 TSLA 2025-12-31 8.400000e+08 \n",
|
||
"\n",
|
||
" beginning_stockholders_equity ending_stockholders_equity avg_equity \\\n",
|
||
"0 5.113000e+10 5.346600e+10 5.229800e+10 \n",
|
||
"1 5.346600e+10 6.263400e+10 5.805000e+10 \n",
|
||
"2 6.263400e+10 6.437800e+10 6.350600e+10 \n",
|
||
"3 6.437800e+10 6.646800e+10 6.542300e+10 \n",
|
||
"4 6.646800e+10 6.993100e+10 6.819950e+10 \n",
|
||
"5 6.993100e+10 7.291300e+10 7.142200e+10 \n",
|
||
"6 7.291300e+10 7.465300e+10 7.378300e+10 \n",
|
||
"7 7.465300e+10 7.731400e+10 7.598350e+10 \n",
|
||
"8 7.731400e+10 7.997000e+10 7.864200e+10 \n",
|
||
"9 7.997000e+10 8.213700e+10 8.105350e+10 \n",
|
||
"\n",
|
||
" roe \n",
|
||
"0 0.0354 \n",
|
||
"1 0.1366 \n",
|
||
"2 0.0225 \n",
|
||
"3 0.0214 \n",
|
||
"4 0.0319 \n",
|
||
"5 0.0324 \n",
|
||
"6 0.0055 \n",
|
||
"7 0.0154 \n",
|
||
"8 0.0175 \n",
|
||
"9 0.0104 "
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 RETURN ON INVESTED CAPITAL (ROIC):\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>ebit</th>\n",
|
||
" <th>tax_rate_for_calcs</th>\n",
|
||
" <th>nopat</th>\n",
|
||
" <th>beginning_invested_capital</th>\n",
|
||
" <th>ending_invested_capital</th>\n",
|
||
" <th>avg_invested_capital</th>\n",
|
||
" <th>roic</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2022-09-30</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>3.952800e+10</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2023-09-30</td>\n",
|
||
" <td>2.083000e+09</td>\n",
|
||
" <td>0.08</td>\n",
|
||
" <td>1.916360e+09</td>\n",
|
||
" <td>5.264900e+10</td>\n",
|
||
" <td>5.717000e+10</td>\n",
|
||
" <td>5.490950e+10</td>\n",
|
||
" <td>0.0349</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2023-12-31</td>\n",
|
||
" <td>2.252000e+09</td>\n",
|
||
" <td>0.21</td>\n",
|
||
" <td>1.779080e+09</td>\n",
|
||
" <td>5.717000e+10</td>\n",
|
||
" <td>6.729100e+10</td>\n",
|
||
" <td>6.223050e+10</td>\n",
|
||
" <td>0.0286</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2024-03-31</td>\n",
|
||
" <td>1.964000e+09</td>\n",
|
||
" <td>0.26</td>\n",
|
||
" <td>1.453360e+09</td>\n",
|
||
" <td>6.729100e+10</td>\n",
|
||
" <td>6.925200e+10</td>\n",
|
||
" <td>6.827150e+10</td>\n",
|
||
" <td>0.0213</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2024-06-30</td>\n",
|
||
" <td>1.873000e+09</td>\n",
|
||
" <td>0.21</td>\n",
|
||
" <td>1.479670e+09</td>\n",
|
||
" <td>6.925200e+10</td>\n",
|
||
" <td>7.383000e+10</td>\n",
|
||
" <td>7.154100e+10</td>\n",
|
||
" <td>0.0207</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>5</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2024-09-30</td>\n",
|
||
" <td>2.883000e+09</td>\n",
|
||
" <td>0.22</td>\n",
|
||
" <td>2.248740e+09</td>\n",
|
||
" <td>7.383000e+10</td>\n",
|
||
" <td>7.732100e+10</td>\n",
|
||
" <td>7.557550e+10</td>\n",
|
||
" <td>0.0298</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2024-12-31</td>\n",
|
||
" <td>2.862000e+09</td>\n",
|
||
" <td>0.16</td>\n",
|
||
" <td>2.404080e+09</td>\n",
|
||
" <td>7.732100e+10</td>\n",
|
||
" <td>8.079100e+10</td>\n",
|
||
" <td>7.905600e+10</td>\n",
|
||
" <td>0.0304</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2025-03-31</td>\n",
|
||
" <td>6.800000e+08</td>\n",
|
||
" <td>0.29</td>\n",
|
||
" <td>4.828000e+08</td>\n",
|
||
" <td>8.079100e+10</td>\n",
|
||
" <td>8.189700e+10</td>\n",
|
||
" <td>8.134400e+10</td>\n",
|
||
" <td>0.0059</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>8</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2025-06-30</td>\n",
|
||
" <td>1.635000e+09</td>\n",
|
||
" <td>0.23</td>\n",
|
||
" <td>1.258950e+09</td>\n",
|
||
" <td>8.189700e+10</td>\n",
|
||
" <td>8.427000e+10</td>\n",
|
||
" <td>8.308350e+10</td>\n",
|
||
" <td>0.0152</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>9</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2025-09-30</td>\n",
|
||
" <td>2.035000e+09</td>\n",
|
||
" <td>0.29</td>\n",
|
||
" <td>1.444850e+09</td>\n",
|
||
" <td>8.427000e+10</td>\n",
|
||
" <td>8.743100e+10</td>\n",
|
||
" <td>8.585050e+10</td>\n",
|
||
" <td>0.0168</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>10</th>\n",
|
||
" <td>TSLA</td>\n",
|
||
" <td>2025-12-31</td>\n",
|
||
" <td>1.266000e+09</td>\n",
|
||
" <td>0.28</td>\n",
|
||
" <td>9.115200e+08</td>\n",
|
||
" <td>8.743100e+10</td>\n",
|
||
" <td>9.029000e+10</td>\n",
|
||
" <td>8.886050e+10</td>\n",
|
||
" <td>0.0103</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date ebit tax_rate_for_calcs nopat \\\n",
|
||
"0 TSLA 2022-09-30 NaN NaN NaN \n",
|
||
"1 TSLA 2023-09-30 2.083000e+09 0.08 1.916360e+09 \n",
|
||
"2 TSLA 2023-12-31 2.252000e+09 0.21 1.779080e+09 \n",
|
||
"3 TSLA 2024-03-31 1.964000e+09 0.26 1.453360e+09 \n",
|
||
"4 TSLA 2024-06-30 1.873000e+09 0.21 1.479670e+09 \n",
|
||
"5 TSLA 2024-09-30 2.883000e+09 0.22 2.248740e+09 \n",
|
||
"6 TSLA 2024-12-31 2.862000e+09 0.16 2.404080e+09 \n",
|
||
"7 TSLA 2025-03-31 6.800000e+08 0.29 4.828000e+08 \n",
|
||
"8 TSLA 2025-06-30 1.635000e+09 0.23 1.258950e+09 \n",
|
||
"9 TSLA 2025-09-30 2.035000e+09 0.29 1.444850e+09 \n",
|
||
"10 TSLA 2025-12-31 1.266000e+09 0.28 9.115200e+08 \n",
|
||
"\n",
|
||
" beginning_invested_capital ending_invested_capital avg_invested_capital \\\n",
|
||
"0 3.952800e+10 NaN NaN \n",
|
||
"1 5.264900e+10 5.717000e+10 5.490950e+10 \n",
|
||
"2 5.717000e+10 6.729100e+10 6.223050e+10 \n",
|
||
"3 6.729100e+10 6.925200e+10 6.827150e+10 \n",
|
||
"4 6.925200e+10 7.383000e+10 7.154100e+10 \n",
|
||
"5 7.383000e+10 7.732100e+10 7.557550e+10 \n",
|
||
"6 7.732100e+10 8.079100e+10 7.905600e+10 \n",
|
||
"7 8.079100e+10 8.189700e+10 8.134400e+10 \n",
|
||
"8 8.189700e+10 8.427000e+10 8.308350e+10 \n",
|
||
"9 8.427000e+10 8.743100e+10 8.585050e+10 \n",
|
||
"10 8.743100e+10 9.029000e+10 8.886050e+10 \n",
|
||
"\n",
|
||
" roic \n",
|
||
"0 NaN \n",
|
||
"1 0.0349 \n",
|
||
"2 0.0286 \n",
|
||
"3 0.0213 \n",
|
||
"4 0.0207 \n",
|
||
"5 0.0298 \n",
|
||
"6 0.0304 \n",
|
||
"7 0.0059 \n",
|
||
"8 0.0152 \n",
|
||
"9 0.0168 \n",
|
||
"10 0.0103 "
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Explore financial ratios with historical data\n",
|
||
"symbol = 'TSLA' # Tesla for interesting ratios\n",
|
||
"db_ticker = Ticker(symbol)\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"FINANCIAL RATIOS (Historical Time Series)\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"print(\"\\n📌 RETURN ON EQUITY (ROE):\")\n",
|
||
"roe = db_ticker.roe()\n",
|
||
"display(roe)\n",
|
||
"\n",
|
||
"print(\"\\n📌 RETURN ON INVESTED CAPITAL (ROIC):\")\n",
|
||
"roic = db_ticker.roic()\n",
|
||
"display(roic)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 21,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 WEIGHTED AVERAGE COST OF CAPITAL (WACC):\n",
|
||
" Columns: ['symbol', 'report_date', 'market_capitalization', 'exchange_rate', 'total_debt', 'total_debt_usd', 'interest_expense', 'interest_expense_usd', 'pretax_income', 'pretax_income_usd', 'tax_provision', 'tax_provision_usd', 'tax_rate_for_calcs', 'sp500_cagr_end', 'sp500_10y_cagr', 'treasure_10y_yield', 'beta_5y', 'weight_of_debt', 'weight_of_equity', 'cost_of_debt', 'cost_of_equity', 'wacc']\n",
|
||
"\n",
|
||
" Latest calculation components:\n",
|
||
" Market Cap: $3967.28B\n",
|
||
" Beta (5Y): 1.0636\n",
|
||
" S&P 500 10Y CAGR: 12.87%\n",
|
||
" Treasury 10Y Yield: 4.26%\n",
|
||
" Weight of Debt: 0.0272\n",
|
||
" Weight of Equity: 0.9728\n",
|
||
" Cost of Debt: 0.0090\n",
|
||
" Cost of Equity: 0.1342\n",
|
||
"\n",
|
||
" ⭐ WACC: 0.1308 (13.08%\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# WACC - Weighted Average Cost of Capital\n",
|
||
"print(\"\\n📌 WEIGHTED AVERAGE COST OF CAPITAL (WACC):\")\n",
|
||
"wacc = db_ticker.wacc()\n",
|
||
"print(f\" Columns: {list(wacc.columns)}\")\n",
|
||
"print(f\"\\n Latest calculation components:\")\n",
|
||
"latest_wacc = wacc.iloc[-1]\n",
|
||
"print(f\" Market Cap: ${float(latest_wacc['market_capitalization'])/1e9:.2f}B\")\n",
|
||
"print(f\" Beta (5Y): {float(latest_wacc['beta_5y']):.4f}\")\n",
|
||
"print(f\" S&P 500 10Y CAGR: {float(latest_wacc['sp500_10y_cagr']):.2%}\")\n",
|
||
"print(f\" Treasury 10Y Yield: {float(latest_wacc['treasure_10y_yield']):.2%}\")\n",
|
||
"print(f\" Weight of Debt: {float(latest_wacc['weight_of_debt']):.4f}\")\n",
|
||
"print(f\" Weight of Equity: {float(latest_wacc['weight_of_equity']):.4f}\")\n",
|
||
"print(f\" Cost of Debt: {float(latest_wacc['cost_of_debt']):.4f}\")\n",
|
||
"print(f\" Cost of Equity: {float(latest_wacc['cost_of_equity']):.4f}\")\n",
|
||
"print(f\"\\n ⭐ WACC: {float(latest_wacc['wacc']):.4f} ({float(latest_wacc['wacc']):.2%}\")\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 📊 6. GROWTH & MARGIN METRICS"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 10,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"GROWTH & MARGIN METRICS\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 QUARTERLY REVENUE YoY GROWTH:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>revenue</th>\n",
|
||
" <th>prev_year_revenue</th>\n",
|
||
" <th>yoy_growth</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>5</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2024-04-30</td>\n",
|
||
" <td>2.604400e+10</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>6</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2024-07-31</td>\n",
|
||
" <td>3.004000e+10</td>\n",
|
||
" <td>1.350700e+10</td>\n",
|
||
" <td>1.2240</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>7</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2024-10-31</td>\n",
|
||
" <td>3.508200e+10</td>\n",
|
||
" <td>1.812000e+10</td>\n",
|
||
" <td>0.9361</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>8</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-01-31</td>\n",
|
||
" <td>3.933100e+10</td>\n",
|
||
" <td>2.210300e+10</td>\n",
|
||
" <td>0.7794</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>9</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-04-30</td>\n",
|
||
" <td>4.406200e+10</td>\n",
|
||
" <td>2.604400e+10</td>\n",
|
||
" <td>0.6918</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>10</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-07-31</td>\n",
|
||
" <td>4.674300e+10</td>\n",
|
||
" <td>3.004000e+10</td>\n",
|
||
" <td>0.5560</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>11</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-10-31</td>\n",
|
||
" <td>5.700600e+10</td>\n",
|
||
" <td>3.508200e+10</td>\n",
|
||
" <td>0.6249</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>12</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>6.812700e+10</td>\n",
|
||
" <td>3.933100e+10</td>\n",
|
||
" <td>0.7321</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date revenue prev_year_revenue yoy_growth\n",
|
||
"5 NVDA 2024-04-30 2.604400e+10 NaN NaN\n",
|
||
"6 NVDA 2024-07-31 3.004000e+10 1.350700e+10 1.2240\n",
|
||
"7 NVDA 2024-10-31 3.508200e+10 1.812000e+10 0.9361\n",
|
||
"8 NVDA 2025-01-31 3.933100e+10 2.210300e+10 0.7794\n",
|
||
"9 NVDA 2025-04-30 4.406200e+10 2.604400e+10 0.6918\n",
|
||
"10 NVDA 2025-07-31 4.674300e+10 3.004000e+10 0.5560\n",
|
||
"11 NVDA 2025-10-31 5.700600e+10 3.508200e+10 0.6249\n",
|
||
"12 NVDA 2026-01-31 6.812700e+10 3.933100e+10 0.7321"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 QUARTERLY EPS YoY GROWTH:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>eps</th>\n",
|
||
" <th>prev_year_eps</th>\n",
|
||
" <th>yoy_growth</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>101</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2024-04-30</td>\n",
|
||
" <td>0.60</td>\n",
|
||
" <td>0.08</td>\n",
|
||
" <td>6.5000</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>102</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2024-07-31</td>\n",
|
||
" <td>0.67</td>\n",
|
||
" <td>0.25</td>\n",
|
||
" <td>1.6800</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>103</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2024-10-31</td>\n",
|
||
" <td>0.78</td>\n",
|
||
" <td>0.37</td>\n",
|
||
" <td>1.1081</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>104</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-01-31</td>\n",
|
||
" <td>0.89</td>\n",
|
||
" <td>0.49</td>\n",
|
||
" <td>0.8163</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>105</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-04-30</td>\n",
|
||
" <td>0.76</td>\n",
|
||
" <td>0.60</td>\n",
|
||
" <td>0.2667</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>106</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-07-31</td>\n",
|
||
" <td>1.08</td>\n",
|
||
" <td>0.67</td>\n",
|
||
" <td>0.6119</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>107</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-10-31</td>\n",
|
||
" <td>1.30</td>\n",
|
||
" <td>0.78</td>\n",
|
||
" <td>0.6667</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>108</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>1.76</td>\n",
|
||
" <td>0.89</td>\n",
|
||
" <td>0.9775</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date eps prev_year_eps yoy_growth\n",
|
||
"101 NVDA 2024-04-30 0.60 0.08 6.5000\n",
|
||
"102 NVDA 2024-07-31 0.67 0.25 1.6800\n",
|
||
"103 NVDA 2024-10-31 0.78 0.37 1.1081\n",
|
||
"104 NVDA 2025-01-31 0.89 0.49 0.8163\n",
|
||
"105 NVDA 2025-04-30 0.76 0.60 0.2667\n",
|
||
"106 NVDA 2025-07-31 1.08 0.67 0.6119\n",
|
||
"107 NVDA 2025-10-31 1.30 0.78 0.6667\n",
|
||
"108 NVDA 2026-01-31 1.76 0.89 0.9775"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Explore growth metrics\n",
|
||
"symbol = 'NVDA'\n",
|
||
"db_ticker = Ticker(symbol)\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"GROWTH & MARGIN METRICS\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"print(\"\\n📌 QUARTERLY REVENUE YoY GROWTH:\")\n",
|
||
"rev_growth = db_ticker.quarterly_revenue_yoy_growth()\n",
|
||
"display(rev_growth.tail(8))\n",
|
||
"\n",
|
||
"print(\"\\n📌 QUARTERLY EPS YoY GROWTH:\")\n",
|
||
"eps_growth = db_ticker.quarterly_eps_yoy_growth()\n",
|
||
"display(eps_growth.tail(8))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 11,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 QUARTERLY GROSS MARGIN:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>gross_profit</th>\n",
|
||
" <th>total_revenue</th>\n",
|
||
" <th>gross_margin</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>11</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-01-31</td>\n",
|
||
" <td>2.872300e+10</td>\n",
|
||
" <td>3.933100e+10</td>\n",
|
||
" <td>0.7303</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>12</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-04-30</td>\n",
|
||
" <td>2.666800e+10</td>\n",
|
||
" <td>4.406200e+10</td>\n",
|
||
" <td>0.6052</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>13</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-07-31</td>\n",
|
||
" <td>3.385300e+10</td>\n",
|
||
" <td>4.674300e+10</td>\n",
|
||
" <td>0.7242</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>14</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-10-31</td>\n",
|
||
" <td>4.184900e+10</td>\n",
|
||
" <td>5.700600e+10</td>\n",
|
||
" <td>0.7341</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>15</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>5.109300e+10</td>\n",
|
||
" <td>6.812700e+10</td>\n",
|
||
" <td>0.7500</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date gross_profit total_revenue gross_margin\n",
|
||
"11 NVDA 2025-01-31 2.872300e+10 3.933100e+10 0.7303\n",
|
||
"12 NVDA 2025-04-30 2.666800e+10 4.406200e+10 0.6052\n",
|
||
"13 NVDA 2025-07-31 3.385300e+10 4.674300e+10 0.7242\n",
|
||
"14 NVDA 2025-10-31 4.184900e+10 5.700600e+10 0.7341\n",
|
||
"15 NVDA 2026-01-31 5.109300e+10 6.812700e+10 0.7500"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 QUARTERLY NET MARGIN:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>net_income_common_stockholders</th>\n",
|
||
" <th>total_revenue</th>\n",
|
||
" <th>net_margin</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>11</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-01-31</td>\n",
|
||
" <td>2.209100e+10</td>\n",
|
||
" <td>3.933100e+10</td>\n",
|
||
" <td>0.5617</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>12</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-04-30</td>\n",
|
||
" <td>1.877500e+10</td>\n",
|
||
" <td>4.406200e+10</td>\n",
|
||
" <td>0.4261</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>13</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-07-31</td>\n",
|
||
" <td>2.642200e+10</td>\n",
|
||
" <td>4.674300e+10</td>\n",
|
||
" <td>0.5653</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>14</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2025-10-31</td>\n",
|
||
" <td>3.191000e+10</td>\n",
|
||
" <td>5.700600e+10</td>\n",
|
||
" <td>0.5598</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>15</th>\n",
|
||
" <td>NVDA</td>\n",
|
||
" <td>2026-01-31</td>\n",
|
||
" <td>4.296000e+10</td>\n",
|
||
" <td>6.812700e+10</td>\n",
|
||
" <td>0.6306</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date net_income_common_stockholders total_revenue \\\n",
|
||
"11 NVDA 2025-01-31 2.209100e+10 3.933100e+10 \n",
|
||
"12 NVDA 2025-04-30 1.877500e+10 4.406200e+10 \n",
|
||
"13 NVDA 2025-07-31 2.642200e+10 4.674300e+10 \n",
|
||
"14 NVDA 2025-10-31 3.191000e+10 5.700600e+10 \n",
|
||
"15 NVDA 2026-01-31 4.296000e+10 6.812700e+10 \n",
|
||
"\n",
|
||
" net_margin \n",
|
||
"11 0.5617 \n",
|
||
"12 0.4261 \n",
|
||
"13 0.5653 \n",
|
||
"14 0.5598 \n",
|
||
"15 0.6306 "
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Margin metrics\n",
|
||
"print(\"\\n📌 QUARTERLY GROSS MARGIN:\")\n",
|
||
"gross_margin = db_ticker.quarterly_gross_margin()\n",
|
||
"display(gross_margin.tail(5))\n",
|
||
"\n",
|
||
"print(\"\\n📌 QUARTERLY NET MARGIN:\")\n",
|
||
"net_margin = db_ticker.quarterly_net_margin()\n",
|
||
"display(net_margin.tail(5))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 🎯 7. UNIQUE FEATURES: EARNINGS TRANSCRIPTS"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 12,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"EARNINGS CALL TRANSCRIPTS (Unique to DefeatBeta!)\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 Available transcripts: 82 quarters\n",
|
||
" From FY2005 Q4 to FY2026 Q1\n",
|
||
"\n",
|
||
"📌 MOST RECENT TRANSCRIPTS:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>fiscal_year</th>\n",
|
||
" <th>fiscal_quarter</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>77</th>\n",
|
||
" <td>2025</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2025-01-30</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>78</th>\n",
|
||
" <td>2025</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>2025-05-01</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>79</th>\n",
|
||
" <td>2025</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>2025-07-31</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>80</th>\n",
|
||
" <td>2025</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>2025-10-30</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>81</th>\n",
|
||
" <td>2026</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2026-01-29</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" fiscal_year fiscal_quarter report_date\n",
|
||
"77 2025 1 2025-01-30\n",
|
||
"78 2025 2 2025-05-01\n",
|
||
"79 2025 3 2025-07-31\n",
|
||
"80 2025 4 2025-10-30\n",
|
||
"81 2026 1 2026-01-29"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Access earnings call transcripts\n",
|
||
"symbol = 'AAPL'\n",
|
||
"db_ticker = Ticker(symbol)\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"EARNINGS CALL TRANSCRIPTS (Unique to DefeatBeta!)\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"transcripts = db_ticker.earning_call_transcripts()\n",
|
||
"transcript_list = transcripts.get_transcripts_list()\n",
|
||
"\n",
|
||
"print(f\"\\n📌 Available transcripts: {len(transcript_list)} quarters\")\n",
|
||
"print(f\" From FY{transcript_list.iloc[0]['fiscal_year']} Q{transcript_list.iloc[0]['fiscal_quarter']} to FY{transcript_list.iloc[-1]['fiscal_year']} Q{transcript_list.iloc[-1]['fiscal_quarter']}\")\n",
|
||
"\n",
|
||
"print(\"\\n📌 MOST RECENT TRANSCRIPTS:\")\n",
|
||
"display(transcript_list[['fiscal_year', 'fiscal_quarter', 'report_date']].tail(5))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 13,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 SAMPLE: Q4 2025 EARNINGS CALL\n",
|
||
" Type: DataFrame\n",
|
||
" Total paragraphs: 77\n",
|
||
" Speakers: 15\n",
|
||
"\n",
|
||
" 📝 FIRST 3 PARAGRAPHS:\n",
|
||
"\n",
|
||
" [Suhasini Chandramouli]:\n",
|
||
" Good afternoon, and welcome to the Apple Q4 Fiscal Year 2025 Earnings Conference Call. My name is Suhasini Chandramouli, Director of Investor Relation...\n",
|
||
"\n",
|
||
" [Timothy Cook]:\n",
|
||
" Thank you, Suhasini. Good afternoon, everyone, and thanks for joining the call. Today, Apple is proud to report $102.5 billion in revenue, up 8% from ...\n",
|
||
"\n",
|
||
" [Kevan Parekh]:\n",
|
||
" Thanks, Tim, and good afternoon, everyone. Our revenue of $102.5 billion was up 8% year-over-year and is a new September quarter record. We set some t...\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Get a specific transcript\n",
|
||
"print(\"\\n📌 SAMPLE: Q4 2025 EARNINGS CALL\")\n",
|
||
"q4_2025 = transcripts.get_transcript(2025, 4)\n",
|
||
"\n",
|
||
"if q4_2025 is not None and len(q4_2025) > 0:\n",
|
||
" print(f\" Type: {type(q4_2025).__name__}\")\n",
|
||
" print(f\" Total paragraphs: {len(q4_2025)}\")\n",
|
||
" print(f\" Speakers: {q4_2025['speaker'].nunique()}\")\n",
|
||
" \n",
|
||
" print(\"\\n 📝 FIRST 3 PARAGRAPHS:\")\n",
|
||
" for idx, row in q4_2025.head(3).iterrows():\n",
|
||
" speaker = row['speaker']\n",
|
||
" content = row['content'][:150] + \"...\" if len(row['content']) > 150 else row['content']\n",
|
||
" print(f\"\\n [{speaker}]:\")\n",
|
||
" print(f\" {content}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 14,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 AVAILABLE AI METHODS:\n",
|
||
" • transcripts.analyze_financial_metrics_change_for_this_quarter_with_ai()\n",
|
||
" • transcripts.analyze_financial_metrics_forecast_for_future_with_ai()\n",
|
||
" • transcripts.summarize_key_financial_data_with_ai()\n",
|
||
"\n",
|
||
"⚠️ NOTE: AI methods require OPENAI_API_KEY to be set in environment\n",
|
||
" Set with: export OPENAI_API_KEY=your_key_here\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# AI-powered analysis (requires OpenAI API key)\n",
|
||
"print(\"\\n📌 AVAILABLE AI METHODS:\")\n",
|
||
"ai_methods = [m for m in dir(transcripts) if 'ai' in m.lower() or 'analyze' in m.lower()]\n",
|
||
"for method in ai_methods:\n",
|
||
" print(f\" • transcripts.{method}()\")\n",
|
||
"\n",
|
||
"print(\"\\n⚠️ NOTE: AI methods require OPENAI_API_KEY to be set in environment\")\n",
|
||
"print(\" Set with: export OPENAI_API_KEY=your_key_here\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 🌍 8. REVENUE BREAKDOWN (Unique Feature!)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 15,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"REVENUE BREAKDOWN BY SEGMENT\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 Columns: ['symbol', 'report_date', 'Mac', 'Services', 'Wearables, Home and Accessories', 'iPad', 'iPhone']\n",
|
||
"\n",
|
||
"📌 Latest Quarter (2025-12-31):\n",
|
||
" Mac: $8.39B\n",
|
||
" Services: $30.01B\n",
|
||
" Wearables, Home and Accessories: $11.49B\n",
|
||
" iPad: $8.60B\n",
|
||
" iPhone: $85.27B\n",
|
||
"\n",
|
||
" TOTAL: $143.76B\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Revenue by segment - unique to DefeatBeta!\n",
|
||
"symbol = 'AAPL'\n",
|
||
"db_ticker = Ticker(symbol)\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"REVENUE BREAKDOWN BY SEGMENT\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"revenue_segment = db_ticker.revenue_by_segment()\n",
|
||
"print(f\"\\n📌 Columns: {list(revenue_segment.columns)}\")\n",
|
||
"print(f\"\\n📌 Latest Quarter ({revenue_segment.iloc[-1]['report_date']}):\")\n",
|
||
"\n",
|
||
"latest = revenue_segment.iloc[-1]\n",
|
||
"total = 0\n",
|
||
"for col in revenue_segment.columns[2:]: # Skip symbol and report_date\n",
|
||
" value = latest[col]\n",
|
||
" if pd.notna(value):\n",
|
||
" value = float(value) # Convert Decimal to float\n",
|
||
" print(f\" {col}: ${value/1e9:.2f}B\")\n",
|
||
" total += value\n",
|
||
"print(f\"\\n TOTAL: ${total/1e9:.2f}B\")\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 16,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
"📌 REVENUE BY GEOGRAPHY:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" <th>Americas</th>\n",
|
||
" <th>Europe</th>\n",
|
||
" <th>Greater China</th>\n",
|
||
" <th>Japan</th>\n",
|
||
" <th>Rest of Asia Pacific</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>20</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2025-06-30</td>\n",
|
||
" <td>4.119800e+10</td>\n",
|
||
" <td>2.401400e+10</td>\n",
|
||
" <td>1.536900e+10</td>\n",
|
||
" <td>5.782000e+09</td>\n",
|
||
" <td>7.673000e+09</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>21</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2025-09-30</td>\n",
|
||
" <td>4.419200e+10</td>\n",
|
||
" <td>2.870300e+10</td>\n",
|
||
" <td>1.449300e+10</td>\n",
|
||
" <td>6.636000e+09</td>\n",
|
||
" <td>8.442000e+09</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>22</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>2025-12-31</td>\n",
|
||
" <td>5.852900e+10</td>\n",
|
||
" <td>3.814600e+10</td>\n",
|
||
" <td>2.552600e+10</td>\n",
|
||
" <td>9.413000e+09</td>\n",
|
||
" <td>1.214200e+10</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol report_date Americas Europe Greater China \\\n",
|
||
"20 AAPL 2025-06-30 4.119800e+10 2.401400e+10 1.536900e+10 \n",
|
||
"21 AAPL 2025-09-30 4.419200e+10 2.870300e+10 1.449300e+10 \n",
|
||
"22 AAPL 2025-12-31 5.852900e+10 3.814600e+10 2.552600e+10 \n",
|
||
"\n",
|
||
" Japan Rest of Asia Pacific \n",
|
||
"20 5.782000e+09 7.673000e+09 \n",
|
||
"21 6.636000e+09 8.442000e+09 \n",
|
||
"22 9.413000e+09 1.214200e+10 "
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Revenue by geography\n",
|
||
"print(\"\\n📌 REVENUE BY GEOGRAPHY:\")\n",
|
||
"revenue_geo = db_ticker.revenue_by_geography()\n",
|
||
"display(revenue_geo.tail(3))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 📋 9. DCF VALUATION (Automated!)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 17,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"AUTOMATED DCF VALUATION\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 Running DCF analysis...\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"\n",
|
||
" <script src=\"https://apis.google.com/js/platform.js\" async defer></script>\n",
|
||
" <div style=\"margin-top: 12px;\">\n",
|
||
" <a href=\"AAPL.xlsx\" download=\"AAPL_DCF.xlsx\"\n",
|
||
" style=\"font-size:16px; margin-right:20px; display:inline-block;\">\n",
|
||
" ⬇️ Download AAPL DCF.xlsx\n",
|
||
" </a>\n",
|
||
" <div id=\"drive-button-AAPL\" style=\"display:inline-block;\">\n",
|
||
" <div class=\"g-savetodrive\"\n",
|
||
" data-src=\"\"\n",
|
||
" data-filename=\"AAPL_DCF.xlsx\"\n",
|
||
" data-sitename=\"DefeatBeta DCF Analysis\">\n",
|
||
" </div>\n",
|
||
" </div>\n",
|
||
" </div>\n",
|
||
" <script>\n",
|
||
" (function() {\n",
|
||
" // Get the current page URL and construct the full file URL\n",
|
||
" var baseUrl = window.location.origin + window.location.pathname.replace(/\\/[^/]*$/, '');\n",
|
||
" var fileUrl = baseUrl + '/files/AAPL.xlsx';\n",
|
||
"\n",
|
||
" // Update the data-src attribute with the full URL\n",
|
||
" var saveButton = document.querySelector('#drive-button-AAPL .g-savetodrive');\n",
|
||
" if (saveButton) {\n",
|
||
" saveButton.setAttribute('data-src', fileUrl);\n",
|
||
"\n",
|
||
" // Reload the Google Drive button to apply the new URL\n",
|
||
" if (typeof gapi !== 'undefined' && gapi.savetodrive) {\n",
|
||
" gapi.savetodrive.go('#drive-button-AAPL');\n",
|
||
" }\n",
|
||
" }\n",
|
||
" })();\n",
|
||
" </script>\n",
|
||
" "
|
||
],
|
||
"text/plain": [
|
||
"<IPython.core.display.HTML object>"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"\n",
|
||
" Return type: dict\n",
|
||
" Keys: ['file_path', 'description']\n",
|
||
" Description: DCF Valuation Analysis for AAPL\n",
|
||
" Excel file: AAPL.xlsx\n",
|
||
"\n",
|
||
"⚠️ NOTE: DCF generates a professional Excel spreadsheet with:\n",
|
||
" • WACC calculations\n",
|
||
" • 10-year cash flow projections\n",
|
||
" • Enterprise value and fair price\n",
|
||
" • Buy/Sell recommendations\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Automated DCF Valuation\n",
|
||
"symbol = 'AAPL'\n",
|
||
"db_ticker = Ticker(symbol)\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"AUTOMATED DCF VALUATION\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"print(\"\\n📌 Running DCF analysis...\")\n",
|
||
"dcf_result = db_ticker.dcf()\n",
|
||
"\n",
|
||
"print(f\"\\n Return type: {type(dcf_result).__name__}\")\n",
|
||
"if isinstance(dcf_result, dict):\n",
|
||
" print(f\" Keys: {list(dcf_result.keys())}\")\n",
|
||
" print(f\" Description: {dcf_result.get('description', 'N/A')}\")\n",
|
||
" if 'file_path' in dcf_result:\n",
|
||
" print(f\" Excel file: {dcf_result['file_path']}\")\n",
|
||
"\n",
|
||
"print(\"\\n⚠️ NOTE: DCF generates a professional Excel spreadsheet with:\")\n",
|
||
"print(\" • WACC calculations\")\n",
|
||
"print(\" • 10-year cash flow projections\")\n",
|
||
"print(\" • Enterprise value and fair price\")\n",
|
||
"print(\" • Buy/Sell recommendations\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 🔍 10. EXPLORE YOUR OWN STOCK"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 18,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"EXPLORING: GOOGL\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 CURRENT PRICE DATA:\n",
|
||
" Latest Close: $341.68\n",
|
||
" Date: 2026-04-17\n",
|
||
" Volume: 25,519,000\n",
|
||
"\n",
|
||
"📌 VALUATION:\n",
|
||
" TTM P/E: 31.61\n",
|
||
" Market Cap: $4133.30B\n",
|
||
"\n",
|
||
"📌 PROFITABILITY:\n",
|
||
" ROE: 8.59%\n",
|
||
" WACC: 13.93%\n",
|
||
"\n",
|
||
"📌 GROWTH:\n",
|
||
" Revenue YoY Growth: 18.00%\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Interactive stock analysis - change the symbol!\n",
|
||
"SYMBOL = 'GOOGL' # ⬅️ CHANGE THIS TO ANY STOCK SYMBOL\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(f\"EXPLORING: {SYMBOL}\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"ticker = Ticker(SYMBOL)\n",
|
||
"\n",
|
||
"# Basic stats\n",
|
||
"price_data = ticker.price()\n",
|
||
"latest = price_data.iloc[-1]\n",
|
||
"\n",
|
||
"print(f\"\\n📌 CURRENT PRICE DATA:\")\n",
|
||
"print(f\" Latest Close: ${float(latest['close']):.2f}\")\n",
|
||
"print(f\" Date: {latest['report_date']}\")\n",
|
||
"print(f\" Volume: {int(latest['volume']):,}\")\n",
|
||
"\n",
|
||
"# Valuation\n",
|
||
"ttm_pe = ticker.ttm_pe()\n",
|
||
"if not ttm_pe.empty:\n",
|
||
" print(f\"\\n📌 VALUATION:\")\n",
|
||
" print(f\" TTM P/E: {float(ttm_pe.iloc[-1]['ttm_pe']):.2f}\")\n",
|
||
"\n",
|
||
"market_cap = ticker.market_capitalization()\n",
|
||
"if not market_cap.empty:\n",
|
||
" mcap = float(market_cap.iloc[-1]['market_capitalization'])\n",
|
||
" print(f\" Market Cap: ${mcap/1e9:.2f}B\")\n",
|
||
"\n",
|
||
"# Ratios\n",
|
||
"roe = ticker.roe()\n",
|
||
"if not roe.empty:\n",
|
||
" print(f\"\\n📌 PROFITABILITY:\")\n",
|
||
" print(f\" ROE: {float(roe.iloc[-1]['roe']):.2%}\")\n",
|
||
"\n",
|
||
"wacc = ticker.wacc()\n",
|
||
"if not wacc.empty:\n",
|
||
" print(f\" WACC: {float(wacc.iloc[-1]['wacc']):.2%}\")\n",
|
||
"\n",
|
||
"# Growth\n",
|
||
"growth = ticker.quarterly_revenue_yoy_growth()\n",
|
||
"if not growth.empty:\n",
|
||
" print(f\"\\n📌 GROWTH:\")\n",
|
||
" print(f\" Revenue YoY Growth: {float(growth.iloc[-1]['yoy_growth']):.2%}\")\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 🧪 11. STOCK COMPARISON"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 19,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"STOCK COMPARISON\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"📌 COMPARISON TABLE:\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>Price</th>\n",
|
||
" <th>P/E</th>\n",
|
||
" <th>Market Cap</th>\n",
|
||
" <th>ROE</th>\n",
|
||
" <th>Rev Growth</th>\n",
|
||
" <th>Gross Margin</th>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>Symbol</th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>AAPL</th>\n",
|
||
" <td>270.23</td>\n",
|
||
" <td>34.21</td>\n",
|
||
" <td>$3967.3B</td>\n",
|
||
" <td>52.0%</td>\n",
|
||
" <td>15.7%</td>\n",
|
||
" <td>48.2%</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>MSFT</th>\n",
|
||
" <td>422.79</td>\n",
|
||
" <td>26.46</td>\n",
|
||
" <td>$3139.5B</td>\n",
|
||
" <td>10.2%</td>\n",
|
||
" <td>16.7%</td>\n",
|
||
" <td>68.0%</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>GOOGL</th>\n",
|
||
" <td>341.68</td>\n",
|
||
" <td>31.61</td>\n",
|
||
" <td>$4133.3B</td>\n",
|
||
" <td>8.6%</td>\n",
|
||
" <td>18.0%</td>\n",
|
||
" <td>59.8%</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>NVDA</th>\n",
|
||
" <td>201.68</td>\n",
|
||
" <td>41.16</td>\n",
|
||
" <td>$4900.8B</td>\n",
|
||
" <td>31.1%</td>\n",
|
||
" <td>73.2%</td>\n",
|
||
" <td>75.0%</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" Price P/E Market Cap ROE Rev Growth Gross Margin\n",
|
||
"Symbol \n",
|
||
"AAPL 270.23 34.21 $3967.3B 52.0% 15.7% 48.2%\n",
|
||
"MSFT 422.79 26.46 $3139.5B 10.2% 16.7% 68.0%\n",
|
||
"GOOGL 341.68 31.61 $4133.3B 8.6% 18.0% 59.8%\n",
|
||
"NVDA 201.68 41.16 $4900.8B 31.1% 73.2% 75.0%"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Compare multiple stocks\n",
|
||
"stocks = ['AAPL', 'MSFT', 'GOOGL', 'NVDA'] # ⬅️ CHANGE THESE\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"STOCK COMPARISON\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"comparison_data = []\n",
|
||
"\n",
|
||
"for symbol in stocks:\n",
|
||
" try:\n",
|
||
" ticker = Ticker(symbol)\n",
|
||
" \n",
|
||
" metrics = {'Symbol': symbol}\n",
|
||
" \n",
|
||
" # Price\n",
|
||
" price = ticker.price()\n",
|
||
" if not price.empty:\n",
|
||
" metrics['Price'] = float(price.iloc[-1]['close'])\n",
|
||
" \n",
|
||
" # Valuation\n",
|
||
" ttm_pe = ticker.ttm_pe()\n",
|
||
" if not ttm_pe.empty:\n",
|
||
" metrics['P/E'] = float(ttm_pe.iloc[-1]['ttm_pe'])\n",
|
||
" \n",
|
||
" market_cap = ticker.market_capitalization()\n",
|
||
" if not market_cap.empty:\n",
|
||
" metrics['Market Cap'] = float(market_cap.iloc[-1]['market_capitalization'])\n",
|
||
" \n",
|
||
" # Profitability\n",
|
||
" roe = ticker.roe()\n",
|
||
" if not roe.empty:\n",
|
||
" metrics['ROE'] = float(roe.iloc[-1]['roe'])\n",
|
||
" \n",
|
||
" # Growth\n",
|
||
" growth = ticker.quarterly_revenue_yoy_growth()\n",
|
||
" if not growth.empty:\n",
|
||
" metrics['Rev Growth'] = float(growth.iloc[-1]['yoy_growth'])\n",
|
||
" \n",
|
||
" # Margins\n",
|
||
" gross_margin = ticker.quarterly_gross_margin()\n",
|
||
" if not gross_margin.empty:\n",
|
||
" metrics['Gross Margin'] = float(gross_margin.iloc[-1]['gross_margin'])\n",
|
||
" \n",
|
||
" comparison_data.append(metrics)\n",
|
||
" \n",
|
||
" except Exception as e:\n",
|
||
" print(f\"⚠️ Error loading {symbol}: {e}\")\n",
|
||
"\n",
|
||
"df = pd.DataFrame(comparison_data)\n",
|
||
"df.set_index('Symbol', inplace=True)\n",
|
||
"\n",
|
||
"# Format Market Cap in billions\n",
|
||
"df['Market Cap'] = df['Market Cap'].apply(lambda x: f\"${x/1e9:.1f}B\" if pd.notna(x) else 'N/A')\n",
|
||
"df['Rev Growth'] = df['Rev Growth'].apply(lambda x: f\"{x:.1%}\" if pd.notna(x) else 'N/A')\n",
|
||
"df['Gross Margin'] = df['Gross Margin'].apply(lambda x: f\"{x:.1%}\" if pd.notna(x) else 'N/A')\n",
|
||
"df['ROE'] = df['ROE'].apply(lambda x: f\"{x:.1%}\" if pd.notna(x) else 'N/A')\n",
|
||
"\n",
|
||
"print(\"\\n📌 COMPARISON TABLE:\")\n",
|
||
"display(df)\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 📚 12. COMPLETE METHOD REFERENCE"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 20,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"============================================================\n",
|
||
"COMPLETE API METHOD REFERENCE\n",
|
||
"============================================================\n",
|
||
"\n",
|
||
"💹 Price & Volume:\n",
|
||
" • ticker.price()\n",
|
||
"\n",
|
||
"📊 Valuation:\n",
|
||
" • ticker.market_capitalization()\n",
|
||
" • ticker.pb_ratio()\n",
|
||
" • ticker.peg_ratio()\n",
|
||
" • ticker.ps_ratio()\n",
|
||
" • ticker.ttm_eps()\n",
|
||
" • ticker.ttm_pe()\n",
|
||
"\n",
|
||
"📈 Financial Ratios:\n",
|
||
" • ticker.asset_turnover()\n",
|
||
" • ticker.beta()\n",
|
||
" • ticker.equity_multiplier()\n",
|
||
" • ticker.roa()\n",
|
||
" • ticker.roe()\n",
|
||
" • ticker.roic()\n",
|
||
" • ticker.wacc()\n",
|
||
"\n",
|
||
"📋 Income Statement:\n",
|
||
" • ticker.annual_income_statement()\n",
|
||
" • ticker.quarterly_income_statement()\n",
|
||
"\n",
|
||
"⚖️ Balance Sheet:\n",
|
||
" • ticker.annual_balance_sheet()\n",
|
||
" • ticker.quarterly_balance_sheet()\n",
|
||
"\n",
|
||
"💵 Cash Flow:\n",
|
||
" • ticker.annual_cash_flow()\n",
|
||
" • ticker.quarterly_cash_flow()\n",
|
||
"\n",
|
||
"📉 Growth Metrics:\n",
|
||
" • ticker.annual_ebitda_yoy_growth()\n",
|
||
" • ticker.annual_fcf_yoy_growth()\n",
|
||
" • ticker.annual_net_income_yoy_growth()\n",
|
||
" • ticker.annual_operating_income_yoy_growth()\n",
|
||
" • ticker.annual_revenue_yoy_growth()\n",
|
||
" • ticker.quarterly_ebitda_yoy_growth()\n",
|
||
" • ticker.quarterly_eps_yoy_growth()\n",
|
||
" • ticker.quarterly_fcf_yoy_growth()\n",
|
||
" • ticker.quarterly_net_income_yoy_growth()\n",
|
||
" • ticker.quarterly_operating_income_yoy_growth()\n",
|
||
" • ticker.quarterly_revenue_yoy_growth()\n",
|
||
" • ticker.quarterly_ttm_eps_yoy_growth()\n",
|
||
"\n",
|
||
"📊 Margin Metrics:\n",
|
||
" • ticker.annual_ebitda_margin()\n",
|
||
" • ticker.annual_fcf_margin()\n",
|
||
" • ticker.annual_gross_margin()\n",
|
||
" • ticker.annual_net_margin()\n",
|
||
" • ticker.annual_operating_margin()\n",
|
||
" • ticker.quarterly_ebitda_margin()\n",
|
||
" • ticker.quarterly_fcf_margin()\n",
|
||
" • ticker.quarterly_gross_margin()\n",
|
||
" • ticker.quarterly_net_margin()\n",
|
||
" • ticker.quarterly_operating_margin()\n",
|
||
"\n",
|
||
"🎙️ Special Data:\n",
|
||
" • ticker.dividends()\n",
|
||
" • ticker.earning_call_transcripts()\n",
|
||
" • ticker.news()\n",
|
||
" • ticker.sec_filing()\n",
|
||
" • ticker.splits()\n",
|
||
"\n",
|
||
"🌍 Revenue Breakdown:\n",
|
||
" • ticker.revenue_by_geography()\n",
|
||
" • ticker.revenue_by_product()\n",
|
||
" • ticker.revenue_by_segment()\n",
|
||
"\n",
|
||
"🏭 Industry Metrics:\n",
|
||
" • ticker.industry_asset_turnover()\n",
|
||
" • ticker.industry_equity_multiplier()\n",
|
||
" • ticker.industry_pb_ratio()\n",
|
||
" • ticker.industry_ps_ratio()\n",
|
||
" • ticker.industry_quarterly_ebitda_margin()\n",
|
||
" • ticker.industry_quarterly_gross_margin()\n",
|
||
" • ticker.industry_quarterly_net_margin()\n",
|
||
" • ticker.industry_roa()\n",
|
||
" • ticker.industry_roe()\n",
|
||
" • ticker.industry_ttm_pe()\n",
|
||
"\n",
|
||
"ℹ️ Info & Calendar:\n",
|
||
" • ticker.calendar()\n",
|
||
" • ticker.currency()\n",
|
||
" • ticker.info()\n",
|
||
" • ticker.officers()\n",
|
||
" • ticker.shares()\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# List all available methods\n",
|
||
"symbol = 'AAPL'\n",
|
||
"ticker = Ticker(symbol)\n",
|
||
"\n",
|
||
"print(\"=\" * 60)\n",
|
||
"print(\"COMPLETE API METHOD REFERENCE\")\n",
|
||
"print(\"=\" * 60)\n",
|
||
"\n",
|
||
"all_methods = [m for m in dir(ticker) if not m.startswith('_')]\n",
|
||
"\n",
|
||
"categories = {\n",
|
||
" '💹 Price & Volume': ['price'],\n",
|
||
" '📊 Valuation': ['ttm_eps', 'ttm_pe', 'market_capitalization', 'ps_ratio', 'pb_ratio', 'peg_ratio'],\n",
|
||
" '📈 Financial Ratios': ['roe', 'roic', 'roa', 'wacc', 'beta', 'equity_multiplier', 'asset_turnover'],\n",
|
||
" '📋 Income Statement': ['quarterly_income_statement', 'annual_income_statement'],\n",
|
||
" '⚖️ Balance Sheet': ['quarterly_balance_sheet', 'annual_balance_sheet'],\n",
|
||
" '💵 Cash Flow': ['quarterly_cash_flow', 'annual_cash_flow'],\n",
|
||
" '📉 Growth Metrics': [m for m in all_methods if 'yoy_growth' in m.lower()],\n",
|
||
" '📊 Margin Metrics': [m for m in all_methods if 'margin' in m.lower() and 'industry' not in m.lower()],\n",
|
||
" '🎙️ Special Data': ['earning_call_transcripts', 'news', 'sec_filing', 'dividends', 'splits'],\n",
|
||
" '🌍 Revenue Breakdown': ['revenue_by_segment', 'revenue_by_product', 'revenue_by_geography'],\n",
|
||
" '🏭 Industry Metrics': [m for m in all_methods if 'industry' in m.lower()],\n",
|
||
" 'ℹ️ Info & Calendar': ['info', 'calendar', 'currency', 'shares', 'officers']\n",
|
||
"}\n",
|
||
"\n",
|
||
"for category, methods in categories.items():\n",
|
||
" matching = [m for m in methods if m in all_methods]\n",
|
||
" if matching:\n",
|
||
" print(f\"\\n{category}:\")\n",
|
||
" for method in sorted(matching):\n",
|
||
" print(f\" • ticker.{method}()\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 🎓 EXERCISES TO TRY"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### Exercise 1: Find Undervalued Stocks\n",
|
||
"Screen for stocks with P/E < 20 but ROE > 15%\n",
|
||
"\n",
|
||
"### Exercise 2: Growth Stock Analysis\n",
|
||
"Compare NVDA vs AMD on revenue growth, margins, and profitability\n",
|
||
"\n",
|
||
"### Exercise 3: DCF Valuation\n",
|
||
"Run DCF on 3 different stocks and compare their fair value estimates\n",
|
||
"\n",
|
||
"### Exercise 4: Revenue Mix Analysis\n",
|
||
"Analyze how Apple's revenue mix has shifted from hardware to services\n",
|
||
"\n",
|
||
"### Exercise 5: Earnings Transcript Mining\n",
|
||
"Extract key topics and sentiment from recent earnings calls"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"---\n",
|
||
"\n",
|
||
"## 📖 SUMMARY"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### DefeatBeta-API vs Yahoo Finance\n",
|
||
"\n",
|
||
"| Feature | DefeatBeta | Yahoo Finance |\n",
|
||
"|---------|------------|---------------|\n",
|
||
"| **Rate Limits** | ✅ None | ❌ Yes |\n",
|
||
"| **Historical Data** | ✅ Full | ✅ Full |\n",
|
||
"| **Financial Ratios** | ✅ Time series | ⚠️ Current only |\n",
|
||
"| **Earnings Transcripts** | ✅ Yes | ❌ No |\n",
|
||
"| **Revenue Segmentation** | ✅ Yes | ❌ No |\n",
|
||
"| **DCF Valuation** | ✅ Automated | ❌ No |\n",
|
||
"| **Real-time Data** | ❌ Daily batch | ✅ 15min delayed |\n",
|
||
"| **Query Speed** | ⚡ Fast (DuckDB) | 🐢 Variable |\n",
|
||
"\n",
|
||
"### When to Use Each\n",
|
||
"- **DefeatBeta**: Historical analysis, financial modeling, backtesting, DCF\n",
|
||
"- **Yahoo Finance**: Real-time data, analyst consensus, quick lookups"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 22,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"sym = \"AAPL\"\n",
|
||
"dbt = Ticker(sym)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 32,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"['__class__',\n",
|
||
" '__delattr__',\n",
|
||
" '__dict__',\n",
|
||
" '__dir__',\n",
|
||
" '__doc__',\n",
|
||
" '__eq__',\n",
|
||
" '__format__',\n",
|
||
" '__ge__',\n",
|
||
" '__getattribute__',\n",
|
||
" '__getstate__',\n",
|
||
" '__gt__',\n",
|
||
" '__hash__',\n",
|
||
" '__init__',\n",
|
||
" '__init_subclass__',\n",
|
||
" '__le__',\n",
|
||
" '__lt__',\n",
|
||
" '__module__',\n",
|
||
" '__ne__',\n",
|
||
" '__new__',\n",
|
||
" '__reduce__',\n",
|
||
" '__reduce_ex__',\n",
|
||
" '__repr__',\n",
|
||
" '__setattr__',\n",
|
||
" '__sizeof__',\n",
|
||
" '__str__',\n",
|
||
" '__subclasshook__',\n",
|
||
" '__weakref__',\n",
|
||
" '_add_dcf_template_section',\n",
|
||
" '_add_dcf_value_section',\n",
|
||
" '_add_discount_rate_section',\n",
|
||
" '_add_growth_estimates_section',\n",
|
||
" '_add_key_metrics_display',\n",
|
||
" '_calculate_yoy_growth',\n",
|
||
" '_dataframe_to_stock_statements',\n",
|
||
" '_generate_margin',\n",
|
||
" '_get_finance_values_map',\n",
|
||
" '_quarterly_book_value_of_equity',\n",
|
||
" '_quarterly_eps_yoy_growth',\n",
|
||
" '_query_data',\n",
|
||
" '_query_data2',\n",
|
||
" '_revenue_by_breakdown',\n",
|
||
" '_statement',\n",
|
||
" 'annual_balance_sheet',\n",
|
||
" 'annual_cash_flow',\n",
|
||
" 'annual_ebitda_margin',\n",
|
||
" 'annual_ebitda_yoy_growth',\n",
|
||
" 'annual_fcf_margin',\n",
|
||
" 'annual_fcf_yoy_growth',\n",
|
||
" 'annual_gross_margin',\n",
|
||
" 'annual_income_statement',\n",
|
||
" 'annual_net_income_yoy_growth',\n",
|
||
" 'annual_net_margin',\n",
|
||
" 'annual_operating_income_yoy_growth',\n",
|
||
" 'annual_operating_margin',\n",
|
||
" 'annual_revenue_yoy_growth',\n",
|
||
" 'asset_turnover',\n",
|
||
" 'beta',\n",
|
||
" 'calendar',\n",
|
||
" 'company_meta',\n",
|
||
" 'config',\n",
|
||
" 'currency',\n",
|
||
" 'dcf',\n",
|
||
" 'dividends',\n",
|
||
" 'download_data_performance',\n",
|
||
" 'duckdb_client',\n",
|
||
" 'earning_call_transcripts',\n",
|
||
" 'equity_multiplier',\n",
|
||
" 'http_proxy',\n",
|
||
" 'huggingface_client',\n",
|
||
" 'industry_asset_turnover',\n",
|
||
" 'industry_equity_multiplier',\n",
|
||
" 'industry_pb_ratio',\n",
|
||
" 'industry_ps_ratio',\n",
|
||
" 'industry_quarterly_ebitda_margin',\n",
|
||
" 'industry_quarterly_gross_margin',\n",
|
||
" 'industry_quarterly_net_margin',\n",
|
||
" 'industry_roa',\n",
|
||
" 'industry_roe',\n",
|
||
" 'industry_ttm_pe',\n",
|
||
" 'info',\n",
|
||
" 'log_level',\n",
|
||
" 'market_capitalization',\n",
|
||
" 'news',\n",
|
||
" 'officers',\n",
|
||
" 'pb_ratio',\n",
|
||
" 'peg_ratio',\n",
|
||
" 'price',\n",
|
||
" 'ps_ratio',\n",
|
||
" 'quarterly_balance_sheet',\n",
|
||
" 'quarterly_cash_flow',\n",
|
||
" 'quarterly_ebitda_margin',\n",
|
||
" 'quarterly_ebitda_yoy_growth',\n",
|
||
" 'quarterly_eps_yoy_growth',\n",
|
||
" 'quarterly_fcf_margin',\n",
|
||
" 'quarterly_fcf_yoy_growth',\n",
|
||
" 'quarterly_gross_margin',\n",
|
||
" 'quarterly_income_statement',\n",
|
||
" 'quarterly_net_income_yoy_growth',\n",
|
||
" 'quarterly_net_margin',\n",
|
||
" 'quarterly_operating_income_yoy_growth',\n",
|
||
" 'quarterly_operating_margin',\n",
|
||
" 'quarterly_revenue_yoy_growth',\n",
|
||
" 'quarterly_ttm_eps_yoy_growth',\n",
|
||
" 'revenue_by_geography',\n",
|
||
" 'revenue_by_product',\n",
|
||
" 'revenue_by_segment',\n",
|
||
" 'roa',\n",
|
||
" 'roe',\n",
|
||
" 'roic',\n",
|
||
" 'sec_filing',\n",
|
||
" 'shares',\n",
|
||
" 'splits',\n",
|
||
" 'ticker',\n",
|
||
" 'treasure',\n",
|
||
" 'ttm_eps',\n",
|
||
" 'ttm_fcf',\n",
|
||
" 'ttm_net_income_common_stockholders',\n",
|
||
" 'ttm_pe',\n",
|
||
" 'ttm_revenue',\n",
|
||
" 'wacc']"
|
||
]
|
||
},
|
||
"execution_count": 32,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"dir(dbt)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 33,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/html": [
|
||
"<div>\n",
|
||
"<style scoped>\n",
|
||
" .dataframe tbody tr th:only-of-type {\n",
|
||
" vertical-align: middle;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe tbody tr th {\n",
|
||
" vertical-align: top;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .dataframe thead th {\n",
|
||
" text-align: right;\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"<table border=\"1\" class=\"dataframe\">\n",
|
||
" <thead>\n",
|
||
" <tr style=\"text-align: right;\">\n",
|
||
" <th></th>\n",
|
||
" <th>symbol</th>\n",
|
||
" <th>address</th>\n",
|
||
" <th>city</th>\n",
|
||
" <th>country</th>\n",
|
||
" <th>phone</th>\n",
|
||
" <th>zip</th>\n",
|
||
" <th>industry</th>\n",
|
||
" <th>sector</th>\n",
|
||
" <th>long_business_summary</th>\n",
|
||
" <th>full_time_employees</th>\n",
|
||
" <th>web_site</th>\n",
|
||
" <th>report_date</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>AAPL</td>\n",
|
||
" <td>One Apple Park Way</td>\n",
|
||
" <td>Cupertino</td>\n",
|
||
" <td>United States</td>\n",
|
||
" <td>(408) 996-1010</td>\n",
|
||
" <td>95014</td>\n",
|
||
" <td>Consumer Electronics</td>\n",
|
||
" <td>Technology</td>\n",
|
||
" <td>Apple Inc. designs, manufactures, and markets ...</td>\n",
|
||
" <td>150000</td>\n",
|
||
" <td>https://www.apple.com</td>\n",
|
||
" <td>2026-04-18</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" symbol address city country phone zip \\\n",
|
||
"0 AAPL One Apple Park Way Cupertino United States (408) 996-1010 95014 \n",
|
||
"\n",
|
||
" industry sector \\\n",
|
||
"0 Consumer Electronics Technology \n",
|
||
"\n",
|
||
" long_business_summary full_time_employees \\\n",
|
||
"0 Apple Inc. designs, manufactures, and markets ... 150000 \n",
|
||
"\n",
|
||
" web_site report_date \n",
|
||
"0 https://www.apple.com 2026-04-18 "
|
||
]
|
||
},
|
||
"execution_count": 33,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"dbt.info()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"dbt"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 29,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"yft = yf.ticker.Ticker(sym)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 31,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"['__class__',\n",
|
||
" '__delattr__',\n",
|
||
" '__dict__',\n",
|
||
" '__dir__',\n",
|
||
" '__doc__',\n",
|
||
" '__eq__',\n",
|
||
" '__format__',\n",
|
||
" '__ge__',\n",
|
||
" '__getattribute__',\n",
|
||
" '__getstate__',\n",
|
||
" '__gt__',\n",
|
||
" '__hash__',\n",
|
||
" '__init__',\n",
|
||
" '__init_subclass__',\n",
|
||
" '__le__',\n",
|
||
" '__lt__',\n",
|
||
" '__module__',\n",
|
||
" '__ne__',\n",
|
||
" '__new__',\n",
|
||
" '__reduce__',\n",
|
||
" '__reduce_ex__',\n",
|
||
" '__repr__',\n",
|
||
" '__setattr__',\n",
|
||
" '__sizeof__',\n",
|
||
" '__str__',\n",
|
||
" '__subclasshook__',\n",
|
||
" '__weakref__',\n",
|
||
" '_analysis',\n",
|
||
" '_data',\n",
|
||
" '_download_options',\n",
|
||
" '_earnings',\n",
|
||
" '_earnings_dates',\n",
|
||
" '_expirations',\n",
|
||
" '_fast_info',\n",
|
||
" '_fetch_ticker_tz',\n",
|
||
" '_financials',\n",
|
||
" '_fundamentals',\n",
|
||
" '_funds_data',\n",
|
||
" '_get_earnings_dates_using_scrape',\n",
|
||
" '_get_earnings_dates_using_screener',\n",
|
||
" '_get_ticker_tz',\n",
|
||
" '_holders',\n",
|
||
" '_isin',\n",
|
||
" '_lazy_load_price_history',\n",
|
||
" '_message_handler',\n",
|
||
" '_news',\n",
|
||
" '_options2df',\n",
|
||
" '_price_history',\n",
|
||
" '_quote',\n",
|
||
" '_shares',\n",
|
||
" '_tz',\n",
|
||
" '_underlying',\n",
|
||
" 'actions',\n",
|
||
" 'analyst_price_targets',\n",
|
||
" 'balance_sheet',\n",
|
||
" 'balancesheet',\n",
|
||
" 'calendar',\n",
|
||
" 'capital_gains',\n",
|
||
" 'cash_flow',\n",
|
||
" 'cashflow',\n",
|
||
" 'dividends',\n",
|
||
" 'earnings',\n",
|
||
" 'earnings_dates',\n",
|
||
" 'earnings_estimate',\n",
|
||
" 'earnings_history',\n",
|
||
" 'eps_revisions',\n",
|
||
" 'eps_trend',\n",
|
||
" 'fast_info',\n",
|
||
" 'financials',\n",
|
||
" 'funds_data',\n",
|
||
" 'get_actions',\n",
|
||
" 'get_analyst_price_targets',\n",
|
||
" 'get_balance_sheet',\n",
|
||
" 'get_balancesheet',\n",
|
||
" 'get_calendar',\n",
|
||
" 'get_capital_gains',\n",
|
||
" 'get_cash_flow',\n",
|
||
" 'get_cashflow',\n",
|
||
" 'get_dividends',\n",
|
||
" 'get_earnings',\n",
|
||
" 'get_earnings_dates',\n",
|
||
" 'get_earnings_estimate',\n",
|
||
" 'get_earnings_history',\n",
|
||
" 'get_eps_revisions',\n",
|
||
" 'get_eps_trend',\n",
|
||
" 'get_fast_info',\n",
|
||
" 'get_financials',\n",
|
||
" 'get_funds_data',\n",
|
||
" 'get_growth_estimates',\n",
|
||
" 'get_history_metadata',\n",
|
||
" 'get_income_stmt',\n",
|
||
" 'get_incomestmt',\n",
|
||
" 'get_info',\n",
|
||
" 'get_insider_purchases',\n",
|
||
" 'get_insider_roster_holders',\n",
|
||
" 'get_insider_transactions',\n",
|
||
" 'get_institutional_holders',\n",
|
||
" 'get_isin',\n",
|
||
" 'get_major_holders',\n",
|
||
" 'get_mutualfund_holders',\n",
|
||
" 'get_news',\n",
|
||
" 'get_recommendations',\n",
|
||
" 'get_recommendations_summary',\n",
|
||
" 'get_revenue_estimate',\n",
|
||
" 'get_sec_filings',\n",
|
||
" 'get_shares',\n",
|
||
" 'get_shares_full',\n",
|
||
" 'get_splits',\n",
|
||
" 'get_sustainability',\n",
|
||
" 'get_upgrades_downgrades',\n",
|
||
" 'get_valuation_measures',\n",
|
||
" 'growth_estimates',\n",
|
||
" 'history',\n",
|
||
" 'history_metadata',\n",
|
||
" 'income_stmt',\n",
|
||
" 'incomestmt',\n",
|
||
" 'info',\n",
|
||
" 'insider_purchases',\n",
|
||
" 'insider_roster_holders',\n",
|
||
" 'insider_transactions',\n",
|
||
" 'institutional_holders',\n",
|
||
" 'isin',\n",
|
||
" 'live',\n",
|
||
" 'major_holders',\n",
|
||
" 'mutualfund_holders',\n",
|
||
" 'news',\n",
|
||
" 'option_chain',\n",
|
||
" 'options',\n",
|
||
" 'quarterly_balance_sheet',\n",
|
||
" 'quarterly_balancesheet',\n",
|
||
" 'quarterly_cash_flow',\n",
|
||
" 'quarterly_cashflow',\n",
|
||
" 'quarterly_earnings',\n",
|
||
" 'quarterly_financials',\n",
|
||
" 'quarterly_income_stmt',\n",
|
||
" 'quarterly_incomestmt',\n",
|
||
" 'recommendations',\n",
|
||
" 'recommendations_summary',\n",
|
||
" 'revenue_estimate',\n",
|
||
" 'sec_filings',\n",
|
||
" 'session',\n",
|
||
" 'shares',\n",
|
||
" 'splits',\n",
|
||
" 'sustainability',\n",
|
||
" 'ticker',\n",
|
||
" 'ttm_cash_flow',\n",
|
||
" 'ttm_cashflow',\n",
|
||
" 'ttm_financials',\n",
|
||
" 'ttm_income_stmt',\n",
|
||
" 'ttm_incomestmt',\n",
|
||
" 'upgrades_downgrades',\n",
|
||
" 'valuation',\n",
|
||
" 'ws']"
|
||
]
|
||
},
|
||
"execution_count": 31,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"dir(yft)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": []
|
||
}
|
||
],
|
||
"metadata": {
|
||
"kernelspec": {
|
||
"display_name": "Python 3 (ipykernel)",
|
||
"language": "python",
|
||
"name": "python3"
|
||
},
|
||
"language_info": {
|
||
"codemirror_mode": {
|
||
"name": "ipython",
|
||
"version": 3
|
||
},
|
||
"file_extension": ".py",
|
||
"mimetype": "text/x-python",
|
||
"name": "python",
|
||
"nbconvert_exporter": "python",
|
||
"pygments_lexer": "ipython3",
|
||
"version": "3.12.12"
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 4
|
||
}
|