Source code · Python

report_data.py

124 lines · Part of AMD estimates report · All code · Read only; the files run as published

"""Build the data behind the AMD estimates report (app/lib/amdReport.json). The report carries no rating, price target or forecast of our own. It bringstogether, each with its source and date:  * reported figures from SEC XBRL (via ../common/secfacts.py) and the 10-K and    10-Q segment notes;  * what the company itself projects (Q4 2026 guidance, 2027 call commentary,    the November 2025 Financial Analyst Day targets);  * Wall Street consensus from Koyfin (6 Nov 2026 and 14 Oct 2026) and    S&P Capital IQ (4 Nov 2026). Usage: python report_data.py <companyfacts cache.json> <out.json>""" import jsonimport osimport sys HERE = os.path.dirname(os.path.abspath(__file__))sys.path.insert(0, os.path.join(HERE, "..", "common"))import secfacts as sf  # noqa: E402 load = lambda name: json.load(open(os.path.join(HERE, "data", name)))CIQ = load("capiq_inputs_2026_11.json")KOY = load("koyfin_2026_11_06.json")KOY_OCT = load("koyfin_2026_10_14.json") # Segments ($M). 2021-2022 from the FY2023 10-K (Client and Gaming were shown# separately then and are added here); 2023-2025 from the FY2025 10-K; nine# months and Q3 from the Q3 2026 10-Q, Note 4.SEGMENTS = {    "revenue": {        "Data Center": {"2021": 3694, "2022": 6043, "2023": 6496, "2024": 12579, "2025": 16635, "9M2025": 11255, "9M2026": 21039, "Q32025": 4341, "Q32026": 8546},        "Client and Gaming": {"2021": 12494, "2022": 13006, "2023": 10863, "2024": 9649, "2025": 14550, "9M2025": 10610, "9M2026": 11168, "Q32025": 4048, "Q32026": 3722},        "Embedded": {"2021": 246, "2022": 4552, "2023": 5321, "2024": 3557, "2025": 3454, "9M2025": 2504, "9M2026": 2959, "Q32025": 857, "Q32026": 1109},        "Total": {"2021": 16434, "2022": 23601, "2023": 22680, "2024": 25785, "2025": 34639, "9M2025": 24369, "9M2026": 35166, "Q32025": 9246, "Q32026": 13377},    },    "op_income": {        "Data Center": {"2021": 991, "2022": 1848, "2023": 1267, "2024": 3482, "2025": 3603, "9M2025": 1851, "9M2026": 6584, "Q32025": 1074, "Q32026": 2882},        "Client and Gaming": {"2021": 3022, "2022": 2143, "2023": 925, "2024": 1187, "2025": 2855, "9M2025": 2130, "9M2026": 1730, "Q32025": 867, "Q32026": 573},        "Embedded": {"2021": 44, "2022": 2252, "2023": 2628, "2024": 1421, "2025": 1243, "9M2025": 886, "9M2026": 1177, "Q32025": 283, "Q32026": 453},    },} # Q3 2026 (quarter to 26 Sep 2026): results release (R326) and 10-Q (Q326).Q3_2026 = {"revenue": 13377, "revenue_ly": 9246, "gaap_gm": 0.54, "nongaap_gm": 0.56, "gaap_op": 2832, "nongaap_op": 3923,           "nongaap_op_ly": 2238, "gaap_eps": 1.46, "nongaap_eps": 2.09, "nongaap_eps_ly": 1.20, "warrant_loss": 1097,           "client": 2900, "gaming": 773, "cash": 7404, "sti": 8372, "debt": 7125, "inventory": 11463} # What the company projects (each item carries its source key; see the report's source list).OUTLOOK = {    "q4_2026": {"revenue_mid": 17000, "band": 0.03, "yoy": 0.66, "qoq": 0.27, "nongaap_gm": 0.55, "src": "R326"},    "call_2027": [        "More than 80% company revenue growth in 2027, with the server business roughly doubling from a high 2026 base",        "Data center CPU revenue about +100% and data center AI revenue significantly more than double in 2027; Q4 2026 is the first quarter data center AI exceeds CPU",        "Demand exceeds supply; server CPU demand still above supply in 2027",        "Q3 2026 was the first quarter MI455 and Helios racks shipped for revenue, with a big step up in Q4",        "Client and Gaming down more than 20% in Q4; 2027 planning assumes a double-digit decline in PC units",        "Embedded to grow significantly in 2027 after normal first-quarter seasonality",    ],    "fad_targets": {"revenue_cagr": 0.35, "dc_cagr": 0.60, "dc_ai_cagr": 0.80, "other_cagr": 0.10, "op_margin": 0.35, "eps": 20.0,                    "server_cpu_share": 0.50, "horizon": "next three to five years", "date": "11 Nov 2025", "src": "FAD25"},}  def main(cache, out_path):    facts = sf.load("0000002488", cache)    G = facts["facts"]["us-gaap"]    DUR = {"revenue": ["Revenues", "RevenueFromContractWithCustomerExcludingAssessedTax"], "gross_profit": ["GrossProfit"],           "op_income": ["OperatingIncomeLoss"], "net_income": ["NetIncomeLoss"],           "cfo": ["NetCashProvidedByUsedInOperatingActivities"], "capex": ["PaymentsToAcquirePropertyPlantAndEquipment"]}    T = sf.annual_table(G, DUR, {}, range(2021, 2026))    hist = {k: sf.values(T, k) for k in DUR}    hist["fcf"] = {y: hist["cfo"][y] - hist["capex"][y] for y in hist["cfo"]}    hist["eps"] = {y: v["value"] for y, v in sf.annual_table(G, {"eps": ["EarningsPerShareDiluted"]}, {}, range(2021, 2026))["eps"].items()}     price = KOY["price"]["close_2026_11_05"]    shares = CIQ["market_snapshot"]["shares_outstanding"]["value"] / 1e6    mcap = price * shares    net_cash = Q3_2026["cash"] + Q3_2026["sti"] - Q3_2026["debt"]    a = KOY["annual"]    pe = {y: price / e for y, e in zip(a["years"], a["eps"])}     # Company targets turned into numbers: >35% a year from 2025 revenue.    r25 = SEGMENTS["revenue"]["Total"]["2025"]    fad_paths = {str(2025 + n): r25 * (1 + OUTLOOK["fad_targets"]["revenue_cagr"]) ** n / 1000 for n in (3, 4, 5)}     # Peers on Capital IQ consensus (4 Nov 2026 close): growth from the fiscal    # year nearest calendar 2026 to the one nearest calendar 2027.    rows = CIQ["peers"]["rows"]    peer_growth = {        "AMD": ("FY Dec 2026 to Dec 2027", rows["AMD"]["fy2_eps"] / rows["AMD"]["fy1_eps"] - 1),        "NVDA": ("FY Jan 2027 to Jan 2028", rows["NVDA"]["fy3_eps"] / rows["NVDA"]["fy2_eps"] - 1),        "AVGO": ("FY Oct 2026 to Oct 2027", rows["AVGO"]["fy2_eps"] / rows["AVGO"]["fy1_eps"] - 1),        "ARM": ("FY Mar 2027 to Mar 2028", rows["ARM"]["fy3_eps"] / rows["ARM"]["fy2_eps"] - 1),        "INTC": ("FY Dec 2026 to Dec 2027", rows["INTC"]["fy2_eps"] / rows["INTC"]["fy1_eps"] - 1),        "QCOM": ("FY Sep 2026 to Sep 2027", rows["QCOM"]["fy2_eps"] / rows["QCOM"]["fy1_eps"] - 1),    }    peers = [{"ticker": t, "price": rows[t]["price"], "period": peer_growth[t][0], "eps_growth": peer_growth[t][1],              "ntm_eps": CIQ["peers"]["ntm_eps"][t], "ntm_pe": CIQ["peers"]["ntm_pe"][t]} for t in peer_growth]     ciq = CIQ["consensus"]    q4_from_ciq = ciq["revenue_musd"]["FY2026E"]["mean"] - SEGMENTS["revenue"]["Total"]["9M2026"]    result = {        "meta": {"report_date": "6 November 2026", "price": price, "price_date": "5 Nov 2026", "prior_close": CIQ["market_snapshot"]["close_2026_11_04"]["value"],                 "shares_out": shares, "mcap": mcap, "net_cash": net_cash, "ev": mcap - net_cash, "latest_quarter": "Q3 2026 (10-Q filed 4 Nov 2026)",                 "week52_low": CIQ["market_snapshot"]["week52_low_close"], "week52_high": CIQ["market_snapshot"]["week52_high_close"]["value"]},        "history": hist, "segments": SEGMENTS, "q3": Q3_2026, "outlook": OUTLOOK, "fad_paths": fad_paths,        "koyfin": KOY, "koyfin_oct": KOY_OCT, "ciq": {"consensus": ciq, "call": CIQ["q3_2026_call_qa"], "pe_history": CIQ["pe_history_trailing"]},        "peers": peers, "valuation": {"pe": pe},        "checks": {"q4_from_ciq": q4_from_ciq, "q4_from_koyfin": KOY["quarterly"]["sales"]["FY2026"][3] * 1000,                   "q4_guide_low": OUTLOOK["q4_2026"]["revenue_mid"] * (1 - OUTLOOK["q4_2026"]["band"]),                   "q4_guide_high": OUTLOOK["q4_2026"]["revenue_mid"] * (1 + OUTLOOK["q4_2026"]["band"])},    }    with open(out_path, "w") as f:        json.dump(result, f, indent=1)    print("mcap", round(mcap), "ev", round(mcap - net_cash), "pe", {k: round(v, 1) for k, v in pe.items()})    print("fad paths", {k: round(v, 1) for k, v in fad_paths.items()}, "q4 ciq", round(q4_from_ciq))    print("peers", [(p["ticker"], round(p["eps_growth"], 3)) for p in peers])    print("hist", {k: {y: round(v) for y, v in hist[k].items()} for k in ("revenue", "op_income", "fcf")}, hist["eps"])  if __name__ == "__main__":    main(sys.argv[1], sys.argv[2])