How to Run Comps Analysis with AI (and Where the Data Actually Comes From)
Every AI comps demo starts with the numbers already in the sheet. Here is where trading comps data really comes from, what each source costs and misses, and a Claude Code workflow that builds the table with a clean EV bridge and honest gaps.
This post contains affiliate links. If you sign up through one, we may earn a commission at no extra cost to you. How we handle this.
Every demo of AI building a comps table skips the same step. It starts with a spreadsheet that already has the numbers in it, then shows the model computing multiples and a football field. Anyone who has built a comps sheet knows that is the easy part. The hard part is getting ten companies' enterprise values, trailing figures and estimates onto the same footing, from a source you can defend when the MD asks where a number came from.
This post answers that question first and builds the table second. We map what a comps table actually needs, the places that data can come from and what each one costs and leaves out, and then run a Claude Code workflow on a source anyone can use. You'll see why the answer for forward multiples is different from the answer for trailing ones, and why that matters more than any prompt.
What a Comps Table Needs, and Which Parts Are Hard
| Input | Difficulty | Why |
|---|---|---|
| Share price and shares outstanding | Easy | Widely available. Check the as-of date. |
| Debt, cash, minority interest, preferred | Medium | Needed for the EV bridge. Easy to omit one item and shift every multiple. |
| LTM revenue, EBITDA, net income | Medium | Built from the last four quarters. Definitions of EBITDA differ across vendors. |
| NTM / forward estimates | Hard | Consensus estimates are the most tightly licensed data in the stack. |
| The peer set | Judgment | No data source decides this for you. |
That last row is the one AI does worst without help and the one where a screening tool earns its keep. We'll get there in step one.
New Claude workflows for finance professionals, every week
One email a week with the newest playbooks. Free, like everything here.
No spam. Unsubscribe anytime.
Where the Data Can Come From
| Source | What you get | The catch |
|---|---|---|
| Institutional terminals (Capital IQ, FactSet, Bloomberg, PitchBook) | Standardized financials, EV, consensus estimates, transaction data | Licensed to your firm. Whether Claude may touch the data depends on your agreement. |
| Data APIs (Financial Modeling Prep, Fiscal.ai) | Standardized statements, ratios and market data you can call from code or MCP | Plan limits on history, coverage and call volume. You are trusting their standardization. |
| SEC filings (EDGAR XBRL API) | As-reported US figures, free, no key | No EV, no prices, and the same item can sit under different tags in different companies' filings. You do the standardizing. |
| Screening platforms (Koyfin) | Peer discovery, screens, a lookup for sanity checks | Fundamentals can't be downloaded, so it isn't a feed for your sheet. |
| Free scrapers (yfinance and similar) | Prices and statements at no cost | Unofficial and unsupported. Fine to learn on, risky to rely on. |
The pattern to take from this table: peer discovery, trailing numbers and forward estimates are three different data problems, and no free source solves all three. The SEC's XBRL API is free, needs no key, and asks for a declared User-Agent and a limit of about ten requests a second, but it gives you reported figures and nothing else. FMP's free plan allows 250 calls a day and covers statements and market data. Consensus forward estimates are what institutional platforms charge for, and we haven't found a free route that gives you the same thing.
So the honest options for forward multiples are to use a licensed source if you have one, to run trailing multiples only, or to use your own estimates and label them as yours. What you shouldn't do is let a model produce an NTM EBITDA that no source gave it. We'll hard-code that rule below.
The Workflow
Step 1: Pick the peers (a screen, then judgment)
Koyfin is useful here. Build a screen on sector, market cap range and growth or margin filters, and export the resulting list. The export won't include the fundamentals you screened on (Koyfin licenses them from Capital IQ and restricts download of financials, estimates and valuation data), but it doesn't need to: you only want the tickers. The screen is the peer-discovery step, and the numbers come from elsewhere. Our Koyfin screening workflow covers that split in more detail.
Then have Claude critique the list instead of accepting it. A screen finds companies that look similar on paper, not ones that compete for the same customers.
Here are 18 tickers from a Koyfin screen for [target], a [one-line business description]. Propose a peer set of 8 to 10. For each name, give one line on why it's comparable (business model, customer, scale, growth) and flag any that I should drop because the business is different. List any obvious peers the screen missed.
Step 2: Pull the inputs, with a source on every field
For the numbers, use an API with a free tier. With FMP, each peer needs the quarterly income statement, balance sheet and cash flow statement, plus the current quote or profile. That is about four calls per company, or roughly 40 calls for a ten-company set, well inside a free day's 250. The caching fetch helper from our FMP DCF walkthrough works unchanged: it never writes the key into the cache, and reruns cost nothing. If you prefer MCP to REST, the Fiscal.ai MCP setup gets you the same kind of statements through a hosted server.
Tell Claude to print real field names from one live response before it writes any model code. Do not let it assume them. Whether quarterly history and enough periods are available depends on your plan, so have it report how many quarters came back for each company and stop if there are fewer than four.
Step 3: Compute with plain, auditable code
The calculations are simple, which is why they should be code and not a model's mental arithmetic. Four functions cover the core of a comps table:
from statistics import median, quantiles
def enterprise_value(market_cap, total_debt, cash, minority_interest=0.0, preferred=0.0):
"""EV = equity value + debt + minority interest + preferred - cash."""
return market_cap + total_debt + minority_interest + preferred - cash
def ltm(quarters, field):
"""Sum the last four reported quarters. Refuse to guess if any are missing."""
last4 = sorted(quarters, key=lambda q: q["date"])[-4:]
if len(last4) < 4 or any(q.get(field) is None for q in last4):
raise ValueError(f"cannot build LTM {field}: need four reported quarters")
return sum(q[field] for q in last4)
def multiple(ev, metric):
"""Zero or negative denominators are not meaningful: report NM (None)."""
return ev / metric if metric and metric > 0 else None
def summarize(values):
vals = sorted(v for v in values if v is not None)
if len(vals) < 4:
return {"n": len(vals), "median": median(vals) if vals else None}
q1, q2, q3 = quantiles(vals, n=4)
return {"n": len(vals), "q1": q1, "median": q2, "q3": q3}Three design choices in there are deliberate. ltm raises an error instead of extrapolating when a quarter is missing. multiple returns None for a negative denominator, so a loss-making peer shows as NM and doesn't distort the median. And summarize reports how many companies the statistics rest on, because a median of three is a different claim from a median of ten.
One more rule: have Claude compute EBITDA the same way for every company, from operating income plus depreciation and amortization, instead of using whatever EBITDA field each source ships. Vendors define it differently, and mixing definitions is the most common reason two comps tables for the same sector disagree.
Step 4: Build the workbook with the playbook
With clean inputs, the Comparable Company Analysis Builder playbook handles the presentation layer: operating metrics, growth and margins, multiples, quartile statistics, an implied valuation range and a football field chart. Give it your computed table and the target's metrics and let it do the formatting and the bridge from enterprise value to implied share price.
Build the comps workbook from comps.json using the Comps Analysis Builder format. Show LTM multiples only, because we have no sourced forward estimates. Put the source and as-of date for each company's inputs on a separate tab. Mark any peer with a different fiscal year-end. Apply the implied range to [target]'s LTM EBITDA and show how much of the range comes from the top and bottom quartiles.
Step 5: Reconcile before anyone sees it
Pick two peers and tie their LTM revenue and net debt to the latest filings by hand. If the two match, the pipeline is probably sound. If one doesn't, you have found a field-mapping or period problem before the MD did. Ask Claude to list every adjustment it made and every field it could not source. That list is your review checklist.
The Four Ways AI Comps Go Wrong
- Invented forward numbers. A model asked for NTM multiples without an estimates source will often produce plausible ones. Require a source on every estimate, and default to trailing-only.
- Incomplete EV bridges. Leaving out minority interest or preferred stock, or counting leases inconsistently, shifts multiples without any visible error. Use one bridge definition for every company and state it on the sheet.
- Mismatched periods. A peer with a September year-end next to one with December, or a price from today next to a balance sheet from nine months ago. Show the as-of date on every row.
- Mixed definitions. EBITDA from three vendors, with and without stock-based compensation and one-offs. Compute it yourself from the statements.
Where the Comps Go Next
A comps table is rarely the end of the work. It feeds three other deliverables:
- Buyer lists. Once you have the peers and the strategic universe, the Company Strip Profile Generator turns each buyer into a one-page profile with financials, rationale and M&A history.
- Exit assumptions. The median and quartile multiples are the evidence behind an exit multiple. Feed them into the PE Returns Analysis playbook to see how returns move if the exit lands at the 25th percentile instead of the median.
- The qualitative story. Multiples say what the market pays, not why. The Competitive Landscape Analysis Deck playbook supplies positioning and moat analysis to explain why your target should trade at the high or low end.
Which Data Route Fits You
You have a Capital IQ or FactSet seat
Use it for estimates and transaction data, subject to what your licence and your firm's AI policy allow. Use the workflow above to structure and check the output.
No terminal, and trailing multiples are enough
A free screen for the peers and an API free tier for the numbers get you a defensible LTM comps table at no cost. Add a paid tier only when plan limits start to block you.
You need forward multiples without a terminal
Check whether a paid tier of the API you use includes analyst estimates, and confirm the licence allows your use. Otherwise present your own estimates, clearly labeled as such.
The broader tool landscape for banking analysts is covered in our AI tools for investment banking analysts guide, and the data-first comparison of Koyfin and Fiscal.ai is in Koyfin vs Fiscal.ai.
This article is for education, not investment advice or a valuation opinion. Plan limits and data terms come from vendor documentation as of October 2026 and change, so confirm them, along with the licence terms for any data you load into an AI tool, before you rely on them.