Python and AI for Financial Research
Python tutorials and AI research workflows on real listed companies, built from SEC filings and market data, with the code and the checks in every post.
-
Claude, GPT and Gemini summarized Alphabet’s Q3 2026 earnings call as eight claims each, citing numbered transcript sentences. A short Python check verified all 24 citations, mapped them to the CFO’s script, and filled in the net income the call never stated from the 10-Q’s XBRL.
-
One 50/200-day moving-average rule on ASML, written in backtesting.py, backtrader, vectorbt and a plain Python loop: identical results once the fill rules match, very different speeds, and three different answers when each library is left on its defaults.
-
A 130-line Python MCP server gives Claude Code SEC EDGAR data. Tested on 31 Alphabet figures: both runs matched the filings on 30, including Q3 2026 capex derived from year-to-date 10-Q figures, and both missed Google Cloud revenue, which the SEC’s companyfacts API leaves out.
-
Every yfinance call I use on Alphabet (GOOGL), replaced and timed: Market Data for prices and options chains, the SEC’s XBRL API and edgartools for revenue and shares, FRED for the 10-year yield, with the quirks each one showed.
-
Claude, OpenAI’s GPT model and Gemini were asked for twelve ASML fiscal 2025 figures without web search. A short Python check against the 20-F’s XBRL found Claude’s wrong capex, cash and R&D figures and a diluted EPS answer that equals the basic figure; with web search, Claude matched every filed figure.
-
A yfinance rate limit error can come from the session you pass in. Python code that counts the requests behind each yfinance call, backs off, catches empty downloads and caches results, worked on ASML.
-
Claude, OpenAI’s GPT model and Gemini read the same Alphabet 10-K with the same prompts, twice each. Every figure matched the filing and every run refused the trap questions; one run picked a different stock-based compensation figure.
-
Python code that flattens the SEC’s XBRL company facts into JSON and parses a filing’s XBRL instance for the regional and product figures the API leaves out, worked on ASML.
-
Claude Code built a DCF of Alphabet from SEC XBRL data in three minutes. Every input matched the filings; the balance sheet was a quarter old and $131.5 billion of securities were left out.
-
Free Python code that pulls a company’s XBRL financial data from the SEC EDGAR API, worked on Alphabet and checked against its 10-K.