How to calculate the P/E ratio in Python from SEC filings
Updated 23 November 2026.

Alphabet’s trailing price-to-earnings ratio was 15.6x on 12 November 2026: a close of $298.70 from Market Data divided by $19.16 of diluted earnings per share over the four quarters to September 2026, taken from the company’s SEC filings. The Python below shows how to calculate the P/E ratio that way for Alphabet, check the EPS against the filing, and chart the ratio over time. Swap in another company’s XBRL tags and split dates and the same code works for other US companies that file 10-Ks.
Then the code asks where the E came from, and the answer is awkward for a ratio that’s supposed to be about earnings. Gains on Alphabet’s equity investments made up 45% of its pre-tax income over those four quarters. Take them out at the company’s own tax rate and the same close works out to 28.4x. That second step is the point of fundamental analysis in Python. The ratio’s one division. The work is knowing what sits on each side of it.
What changed since April 2025
The first version of this post read a ready-made trailing EPS and P/E for Apple out of a summary dictionary and printed them. You got a number and no way to check where it came from. This version builds both from primary sources. Earnings per share come from the XBRL data in Alphabet’s 10-K and 10-Q filings, the price is a dated close, and the code prints the date of each.
What’s new: trailing EPS built from quarterly filings and checked against the 10-K and the latest 10-Q, earnings split into operating income and investment gains, a daily P/E since 2020 that uses each filing only once it was public, and the 2022 stock split breaking EPS data that isn’t restated.
Step 1: diluted EPS from SEC EDGAR
The SEC publishes every company-wide XBRL fact in the standard taxonomies through its free companyfacts API. There’s no key, though the SEC asks automated requests to identify themselves in the User-Agent header. The SEC EDGAR API tutorial on this site walks through the endpoints, and the XBRL parser post shows what the raw JSON looks like.
Filings report three-month figures for the first three quarters, and the 10-K reports the full year. So the quarterly function takes the three-month values and backs out the fourth quarter as the fiscal year minus the first nine months. durations keeps the latest filing’s value for each period and divides per-share amounts filed before the July 2022 split by 20; “What can go wrong” shows why.
import os
import requests
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# The SEC asks every automated request to identify itself. Set your own contact first:
# export SEC_USER_AGENT="Your Name you@example.com"
HEADERS = {"User-Agent": os.environ["SEC_USER_AGENT"]}
# Alphabet's 20-for-one split took effect on 15 July 2022 (10-K for 2022, Note 11)
SPLITS = {"2022-07-15": 20}
def company_facts(ticker):
"""All XBRL facts a company has filed with the SEC, plus its CIK."""
tickers = requests.get("https://www.sec.gov/files/company_tickers.json", headers=HEADERS, timeout=30).json()
cik = next(v["cik_str"] for v in tickers.values() if v["ticker"] == ticker)
url = f"https://data.sec.gov/api/xbrl/companyfacts/CIK{cik:010d}.json"
return requests.get(url, headers=HEADERS, timeout=30).json(), cik
def durations(facts, concept, unit="USD", splits=None):
"""One row per reported period: the latest filing's value, per-share values restated for later splits."""
df = pd.DataFrame(facts["facts"]["us-gaap"][concept]["units"][unit])
df = df[df["form"].isin(["10-K", "10-Q"])].copy()
df["days"] = (pd.to_datetime(df["end"]) - pd.to_datetime(df["start"])).dt.days
for date, ratio in (splits or {}).items():
df.loc[df["filed"] < date, "val"] /= ratio
first_filed = df.groupby(["start", "end"])["filed"].min().rename("first_filed")
df = df.sort_values("filed").drop_duplicates(["start", "end"], keep="last")
return df.join(first_filed, on=["start", "end"]).set_index(["start", "end"])
def quarterly(facts, concept, unit="USD", splits=None):
"""Three-month values; the fourth quarter is the fiscal year minus the first nine months."""
df = durations(facts, concept, unit, splits).reset_index()
out = df[df["days"].between(80, 100)].set_index("end")[["val", "first_filed"]]
for _, fy in df[df["days"].between(350, 380)].iterrows():
nine = df[(df["start"] == fy["start"]) & df["days"].between(260, 285)]
if len(nine) and fy["end"] not in out.index:
out.loc[fy["end"]] = [fy["val"] - nine["val"].iloc[0], fy["first_filed"]]
return out.sort_index()
facts, cik = company_facts("GOOGL")
eps_q = quarterly(facts, "EarningsPerShareDiluted", "USD/shares", splits=SPLITS)
ttm_eps = eps_q["val"].rolling(4).sum()
print(eps_q.tail(4).round(2).rename(columns={"val": "diluted_eps"}).to_string())
print(f"trailing-twelve-month diluted EPS to {eps_q.index[-1]}: ${ttm_eps.iloc[-1]:.2f}")
diluted_eps first_filed
end
2025-12-31 2.82 2026-02-05
2026-03-31 5.11 2026-04-30
2026-06-30 9.11 2026-07-23
2026-09-30 2.12 2026-10-29
trailing-twelve-month diluted EPS to 2026-09-30: $19.16
The four quarters add up to $19.16 of diluted EPS. One quarter is doing most of the lifting: $9.11 in the three months to June 2026, almost twice the quarter before it and more than four times the quarter after it. That’s an odd shape for a company whose operating income barely moved over the same months, and Step 4 shows what did move.
Alphabet has three classes of common stock whose rights are identical except for voting. Diluted EPS still differs by a cent or two between them, courtesy of how the two-class method in the EPS note allocates earnings and dilutive shares. For 2025 the EPS note in the 10-K shows $10.82 for Class A (GOOGL), $10.80 for Class C (GOOG) and $10.81 consolidated. Companyfacts carries only company-wide facts, so its value is the consolidated one, and that is the figure the code uses for GOOGL. Rebuilt from Class A totals ($10.82, plus $16.34 for the nine months of 2026, minus $8.00 a year earlier), the trailing figure is also $19.16, so the choice doesn’t move the P/E.
Step 2: the price from Market Data and the P/E ratio
Install the client with pip install marketdata-sdk-py. Market Data serves Apple without a token; for GOOGL and most other tickers, create a Market Data account (affiliate link) and set MARKETDATA_TOKEN to its token. Daily candles come adjusted for splits and dividends by default. The request passes adjustdividends=False, so the closes are adjusted for splits only and match the prices that traded since July 2022.
from marketdata import MarketDataClient # pip install marketdata-sdk-py
# Market Data serves AAPL without a token; GOOGL needs one. Set yours first:
# export MARKETDATA_TOKEN=YOUR_TOKEN
client = MarketDataClient(token=os.environ.get("MARKETDATA_TOKEN"))
def daily_closes(ticker, start, end):
"""Daily closes from Market Data, adjusted for splits only (the prices that traded, in today's share terms)."""
df = client.stocks.candles(ticker, resolution="D", from_date=start, to_date=end, output_format="dataframe",
adjustdividends=False)
if not isinstance(df, pd.DataFrame):
raise RuntimeError(df)
close = df["c"].rename(ticker)
close.index = close.index.tz_localize(None).normalize().rename("date")
return close
close = daily_closes("GOOGL", "2020-01-01", "2026-11-12")
price, price_date = close.iloc[-1], close.index[-1]
pe = price / ttm_eps.iloc[-1]
print(f"GOOGL close on {price_date:%Y-%m-%d}: ${price:.2f}")
print(f"trailing P/E: {price:.2f} / {ttm_eps.iloc[-1]:.2f} = {pe:.1f}x")
GOOGL close on 2026-11-12: $298.70
trailing P/E: 298.70 / 19.16 = 15.6x
On 12 November 2026 a GOOGL share closed at $298.70, 15.6x the diluted earnings per share of the previous four reported quarters. That’s the whole calculation. The harder question is whether either input measures what you think it does.
Step 3: check the EPS against the 10-K and the 10-Q
Summing quarters is one way to get a trailing twelve months. The other uses only reported totals: the last annual figure, plus this year’s year-to-date figure, minus last year’s figure for the same months. The block below does that and prints the filing folders it read.
def ytd(facts, concept, start, end, unit="USD/shares"):
"""One reported value for one period, with the filing it came from."""
row = durations(facts, concept, unit).loc[(start, end)]
link = f"https://www.sec.gov/Archives/edgar/data/{cik}/{row['accn'].replace('-', '')}/"
return row["val"], row["form"], link
fy, fy_form, fy_link = ytd(facts, "EarningsPerShareDiluted", "2025-01-01", "2025-12-31")
now, now_form, now_link = ytd(facts, "EarningsPerShareDiluted", "2026-01-01", "2026-09-30")
then, _, _ = ytd(facts, "EarningsPerShareDiluted", "2025-01-01", "2025-09-30")
ttm_check = fy + now - then
print(f"FY2025 ({fy_form}): {fy:.2f} 9M 2026 ({now_form}): {now:.2f} 9M 2025: {then:.2f}")
print(f"10-K year + this year's nine months - last year's nine months = {ttm_check:.2f}")
print(f"sum of the last four quarters = {ttm_eps.iloc[-1]:.2f}")
print(fy_link)
print(now_link)
FY2025 (10-K): 10.81 9M 2026 (10-Q): 16.33 9M 2025: 7.99
10-K year + this year's nine months - last year's nine months = 19.15
sum of the last four quarters = 19.16
https://www.sec.gov/Archives/edgar/data/1652044/000165204426000018/
https://www.sec.gov/Archives/edgar/data/1652044/000165204426000084/
The income statement in Alphabet’s 10-K for 2025 shows diluted EPS of $10.81 for the year, and its 10-Q for the quarter to 30 September 2026 shows $16.33 for the nine months, against $7.99 a year earlier. Both routes land within a cent of each other ($19.15 against $19.16). Each quarter’s EPS is divided by that quarter’s average share count, so quarterly figures rounded to the cent do not add up exactly to the annual one. Use either, and say which.
Step 4: where Alphabet’s earnings came from
A P/E puts the price over net income per share, and net income picks up everything below operating income, including whatever Alphabet’s investment portfolio did that quarter. The block pulls pre-tax income, operating income, gains on equity securities, tax and net income for each quarter, and charts the split.
items = {
"pretax": "IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest",
"operating": "OperatingIncomeLoss",
"equity_gains": "EquitySecuritiesFvNiGainLoss",
"tax": "IncomeTaxExpenseBenefit",
"net_income": "NetIncomeLoss",
}
q = pd.DataFrame({k: quarterly(facts, c)["val"] for k, c in items.items()}).dropna()
ttm = q.tail(4).sum()
tax_rate = ttm["tax"] / ttm["pretax"]
gains_after_tax = ttm["equity_gains"] * (1 - tax_rate)
eps_ex_gains = ttm_eps.iloc[-1] * (1 - gains_after_tax / ttm["net_income"])
pe_ex_gains = price / eps_ex_gains
# Same adjustment at the 21% US federal statutory rate (10-K for 2025, Note 14)
eps_ex_21 = ttm_eps.iloc[-1] * (1 - ttm["equity_gains"] * (1 - 0.21) / ttm["net_income"])
print((q.tail(4) / 1e9).round(1).to_string())
print(f"equity-security gains / pre-tax income, last four quarters: {ttm['equity_gains'] / ttm['pretax']:.1%}")
print(f"effective tax rate: {tax_rate:.1%} EPS without the gains: {eps_ex_gains:.2f} P/E: {pe_ex_gains:.1f}x")
print(f"at a 21% tax rate instead: EPS {eps_ex_21:.2f}, P/E {price / eps_ex_21:.1f}x")
# Chart: each quarter's pre-tax income split into operating income, equity-security gains and the rest
last8 = q.tail(8) / 1e9
parts = {"Operating income": (last8["operating"], "#1f4e79"),
"Gains (losses) on equity securities": (last8["equity_gains"], "#e08214"),
"Other non-operating items": (last8["pretax"] - last8["operating"] - last8["equity_gains"], "#999999")}
fig, ax = plt.subplots(figsize=(11, 5))
x = np.arange(len(last8))
up, down = np.zeros(len(x)), np.zeros(len(x))
for name, (vals, color) in parts.items():
v = vals.to_numpy()
ax.bar(x, v, bottom=np.where(v >= 0, up, down), color=color, width=0.6, label=name)
up, down = up + v.clip(min=0), down + v.clip(max=0)
ax.plot(x, last8["pretax"], "ko", ms=5, label="Pre-tax income")
ax.axhline(0, color="black", lw=0.8)
ax.set_xticks(x, [f"Q{d.quarter} {d.year}" for d in pd.to_datetime(last8.index)])
ax.set_ylabel("US$ billion")
ax.set_title("Alphabet (GOOGL) quarterly pre-tax income by source, from its 10-K and 10-Q XBRL")
ax.legend(loc="upper left", fontsize=9)
ax.grid(axis="y", alpha=0.3)
fig.text(0.01, -0.02, "Data: SEC EDGAR XBRL. Q4 = fiscal year minus nine months. Code: pythonandfinancehub.com", fontsize=8, color="gray")
plt.savefig("googl-pretax-income-sources.png", dpi=150, bbox_inches="tight")
pretax operating equity_gains tax net_income
end
2025-12-31 39.1 35.9 2.3 4.7 34.5
2026-03-31 77.4 39.7 36.9 14.8 62.6
2026-06-30 138.8 40.8 99.0 26.6 112.2
2026-09-30 32.4 40.6 -8.7 5.9 26.5
equity-security gains / pre-tax income, last four quarters: 45.1%
effective tax rate: 18.1% EPS without the gains: 10.53 P/E: 28.4x
at a 21% tax rate instead: EPS 10.84, P/E 27.6x

Operating income stayed between $39.7 billion and $40.8 billion in each quarter of 2026. The gains on equity securities did the moving: $129.6 billion over the four quarters, 45% of $287.6 billion of pre-tax income, then a loss in the September quarter. The 10-Q attributes the nine-month increase in other income mainly to unrealized gains on non-marketable equity securities “largely from a private company, and SpaceX prior to its initial public offering”. Most of it revalues stakes Alphabet still holds, so a big chunk of the E in this P/E is a revaluation of investments, booked as income. None of Alphabet’s operating segments earned it. Of the $127.3 billion of nine-month gains in the 10-Q’s equity securities note, $1.6 billion came from securities it sold.
To see what the ratio looks like without them, the code taxes the gains at Alphabet’s trailing effective rate of 18.1%, removes them from net income and scales EPS down by the same proportion. That gives $10.53 per share and a P/E of 28.4x on the same close. The tax rate’s an approximation, because the filings don’t report the tax on these gains as a separate amount. The 10-Q says the deferred tax on them is booked at the statutory rate, and at the 21% US federal statutory rate the same adjustment gives 27.6x.
Step 5: chart the trailing P/E since 2020
A P/E history should only use earnings after they were published. The function below starts using each new trailing EPS on the day the filing for its last quarter was first submitted, so a day in early July 2026 still uses EPS through March. The values themselves are the latest reported ones, so a later restatement would leak back to the first filing date. The block checks for that first, then produces the chart at the top of this post.
def pe_history(eps_q, close):
"""Daily trailing P/E: each close over the TTM EPS, switched in on the day its last quarter was first filed."""
known = eps_q.assign(ttm=eps_q["val"].rolling(4).sum()).dropna()
steps = known.set_index(pd.to_datetime(known["first_filed"]))["ttm"]
steps = steps[~steps.index.duplicated(keep="last")].sort_index()
return close / steps.reindex(close.index, method="ffill")
# Did any later filing change a period's EPS, apart from the split? If not, first-filed and latest values agree.
eps_all = pd.DataFrame(facts["facts"]["us-gaap"]["EarningsPerShareDiluted"]["units"]["USD/shares"])
eps_all = eps_all[eps_all["form"].isin(["10-K", "10-Q"]) & (eps_all["end"] >= "2019-01-01")].copy()
for date, ratio in SPLITS.items():
eps_all.loc[eps_all["filed"] < date, "val"] /= ratio
revision = eps_all.groupby(["start", "end"])["val"].agg(lambda v: v.max() - v.min())
print(f"{len(revision)} periods since 2019, largest change after first filing: {revision.max():.3f} dollars")
pe_daily = pe_history(eps_q, close).dropna()
print(pe_daily.groupby(pe_daily.index.year).tail(1).round(1).to_string()) # last trading day of each year
print(f"low {pe_daily.min():.1f}x on {pe_daily.idxmin():%Y-%m-%d}, high {pe_daily.max():.1f}x on {pe_daily.idxmax():%Y-%m-%d}")
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(11, 7), sharex=True, gridspec_kw={"height_ratios": [1.4, 2]})
ax1.plot(close.loc[pe_daily.index[0]:], color="#1f4e79", lw=1.2)
ax1.set_ylabel("Close (US$, split-adjusted)")
ax1.set_title("Alphabet (GOOGL): daily close and trailing P/E on diluted EPS from SEC filings")
ax1.grid(alpha=0.3)
ax2.plot(pe_daily, color="#6a3d9a", lw=1.3)
ax2.annotate(f"{pe_daily.iloc[-1]:.1f}x on {pe_daily.index[-1]:%d %b %Y}", xy=(pe_daily.index[-1], pe_daily.iloc[-1]),
xytext=(-250, 2), textcoords="offset points", arrowprops={"arrowstyle": "->"}, fontsize=9,
va="center", bbox={"fc": "white", "ec": "none"})
ax2.set_ylabel("Trailing P/E (x)")
ax2.grid(alpha=0.3)
fig.text(0.01, 0.005, "Data: Market Data (marketdata.app) prices; SEC EDGAR XBRL diluted EPS. Code: pythonandfinancehub.com",
fontsize=8, color="gray")
plt.tight_layout()
plt.savefig("googl-chart.png", dpi=150, bbox_inches="tight")
47 periods since 2019, largest change after first filing: 0.003 dollars
date
2020-12-31 33.9
2021-12-31 27.9
2022-12-30 17.5
2023-12-29 26.8
2024-12-31 25.1
2025-12-31 30.9
2026-11-12 15.6
low 14.6x on 2026-11-02, high 39.4x on 2021-04-26
Across 47 reported periods since 2019, no filing changed an EPS figure by more than the rounding left over from dividing pre-split amounts by 20, so the latest values match what was public at the time. Since January 2020 the ratio has run from 14.6x to 39.4x. The drop in late July 2026 is the June-quarter 10-Q arriving with its gains: on the day it was filed, trailing EPS went from $13.11 to $19.91. The latest reading sits near the bottom of that range, and the reason is in the denominator: it still carries the gains from Step 4.
Fundamental analysis in Python: where the P/E fits
The P/E is the first ratio in this site’s Python for Fundamental Analysis series because it joins the market price to the accounts. The statements behind it come from financial statement retrieval in Python, and the next questions are about the quality of the E: how much of it is operating profit (profitability ratios) and how much turns into cash (free cash flow in Python). For Alphabet in 2026, Step 4 already answers the first.
What can go wrong
The block below rebuilds the trailing EPS without the split restatement, prints the quarters from 2020 to early 2022, where the two versions diverge, and charts both.
# The same TTM EPS without the split restatement: values from before July 2022 stay in pre-split dollars
raw_q = quarterly(facts, "EarningsPerShareDiluted", "USD/shares")
both = pd.DataFrame({"raw": raw_q["val"].rolling(4).sum(), "restated": ttm_eps}).loc["2019-12-31":"2023-12-31"]
print(both.loc["2020-12-31":"2022-03-31"].round(2).to_string())
fig, ax = plt.subplots(figsize=(11, 4.5))
dates = pd.to_datetime(both.index)
ax.step(dates, both["raw"], where="post", color="#b2182b", lw=1.3, label="latest reported value, no split restatement")
ax.step(dates, both["restated"], where="post", color="#6a3d9a", lw=1.6, label="restated for the 20-for-1 split")
ax.axhline(0, color="black", lw=0.8)
ax.axvline(pd.Timestamp("2022-07-15"), color="gray", ls=":", lw=1)
ax.set_ylabel("TTM diluted EPS (US$)")
ax.set_title("Alphabet (GOOGL) trailing-twelve-month EPS from XBRL, with and without the split restatement")
ax.legend(loc="upper right", fontsize=9)
ax.grid(alpha=0.3)
fig.text(0.01, -0.02, "Data: SEC EDGAR XBRL companyfacts. Dotted line: split effective 15 July 2022. Code: pythonandfinancehub.com",
fontsize=8, color="gray")
plt.savefig("googl-split-pitfall.png", dpi=150, bbox_inches="tight")
figures = {
"price": float(price),
"ttm_eps": float(ttm_eps.iloc[-1]),
"pe": float(pe),
"eps_fy2025": float(fy),
"eps_9m_2026": float(now),
"eps_9m_2025": float(then),
"ttm_check": float(ttm_check),
"q2_eps": float(eps_q["val"].iloc[-2]),
"gain_share": float(ttm["equity_gains"] / ttm["pretax"]),
"ttm_gains": float(ttm["equity_gains"]),
"ttm_pretax": float(ttm["pretax"]),
"tax_rate": float(tax_rate),
"eps_ex_gains": float(eps_ex_gains),
"pe_ex_gains": float(pe_ex_gains),
"pe_ex_21": float(price / eps_ex_21),
"pe_min": float(pe_daily.min()),
"pe_max": float(pe_daily.max()),
"raw_neg": float(-both["raw"].min()),
"restated_sep21": float(both.loc["2021-09-30", "restated"]),
"ttm_mar26": float(ttm_eps.loc["2026-03-31"]),
"ttm_jun26": float(ttm_eps.loc["2026-06-30"]),
"n_periods": len(revision),
"op_min": float(q["operating"].loc["2026-01-01":].min()),
"op_max": float(q["operating"].loc["2026-01-01":].max()),
}
raw restated
end
2020-12-31 2.95 2.93
2021-03-31 19.37 3.75
2021-06-30 10.60 4.61
2021-09-30 -4.40 5.19
2021-12-31 30.58 5.60
2022-03-31 5.52 5.52
Stock splits in XBRL data. Alphabet split its stock 20-for-one on 15 July 2022. Later filings restate the periods they show, but companyfacts keeps older periods at the value from the last filing that reported them, and for 2020 and early 2021 that filing came before the split. Mix the two and the quarterly figures stop making sense. Without the restatement the code computes a fourth quarter of 2020 from a post-split annual figure and a pre-split nine-month figure, and the trailing EPS for the four quarters to September 2021 turns into a loss of $4.40 a share. Restated, the same four quarters earned $5.19. Alphabet didn’t lose money in 2021. The data did. The SPLITS dictionary fixes it. Look up each company’s split dates in its 10-K, or compare the same period across two filings. A jump by the split ratio gives it away.

Prices and EPS on different bases. Market Data’s default candles are also adjusted for dividends, which pulls every close before an ex-dividend date down a little. The code asks for split-only closes in post-split share units, and SPLITS puts the EPS in the same units.
Negative or tiny earnings. A P/E on a loss is meaningless, and one on near-zero earnings is a very large number that tells you nothing. Check the sign of the trailing EPS before dividing and report “not meaningful” when it is negative.
Concepts that differ by company. EarningsPerShareDiluted and the income concepts in Step 4 are what Alphabet files. Other companies use other tags, and durations raises a KeyError for a tag the company has never filed; list facts["facts"]["us-gaap"].keys() to find the one a company uses. Companies reporting under IFRS have their facts under ifrs-full instead.
Fiscal years. The fourth-quarter rule needs a nine-month figure that starts on the fiscal year’s first day. The code matches on that date, so 52/53-week years work, but check the output for a missing quarter.
Rate limits and tokens. The SEC allows up to 10 requests per second. Market Data needs a token outside a few unlocked demo symbols such as AAPL; check the plan limits on Market Data’s site (affiliate link) before running many tickers.
What to watch
Alphabet filed its 2025 10-K on 5 February 2026, so the 2026 10-K should arrive in early 2027. It replaces the December 2025 quarter in the trailing sum and will show whether the September quarter’s loss on equity securities continued. Each new 10-Q moves the trailing EPS and the P/E the day it is filed; rerun the script with a later end date in daily_closes to update them. If Alphabet moves to a different XBRL tag for EPS or for gains on equity securities, companyfacts keeps the old tag’s history, so the code would quietly stop at the last quarter filed under it. Check that the last period Step 1 prints is the latest quarter.
My longer company research is published on the newsletter Sector Playbook, which is available by email subscription.
Sources
Alphabet Inc., Form 10-K for 2025 (diluted EPS for 2025), Form 10-Q for the quarter ended 30 September 2026 (nine-month EPS, other income, share classes) and Form 10-K for 2022 (20-for-one stock split). SEC, EDGAR application programming interfaces and accessing EDGAR data (User-Agent, request rate). Market Data, stock candles endpoint and authentication.
*Time: 20 minutes. Python 3.12.14, marketdata 1.3.0, matplotlib 3.11.2, numpy 2.5.4, pandas 3.1.0, requests 2.34.2. API key: none for the SEC, which only asks for a contact in the User-Agent; a Market Data token (affiliate link) for GOOGL (Apple works without one). Market Data provides this site’s data access. Tested 23 November 2026.*
Disclaimer
Disclosure: I hold long GOOGL shares. I have no position in the other companies discussed (AAPL). I also hold diversified funds (IWDA, QQQ, SPY, VWRL) that may include some of these companies. Positions checked on 23 November 2026.
Affiliate disclosure: some links in this post are affiliate links. If you buy through one, I may earn a commission at no extra cost to you. It does not change what I write about the product.
This article is general information about a listed company, written for educational purposes. It is not investment advice and not a personal recommendation to buy, sell or hold any security, and it does not take into account anyone’s financial situation or objectives. I am not a registered investment adviser or a licensed financial services provider. Figures come from company filings and the other sources linked in the text, as of the dates given, and may have changed since. I may hold positions in the securities discussed; see the disclosure above. Investment decisions call for independent research or the advice of a licensed professional.
This is my own research, done with the help of AI tools.