Recipe: Compare companies
Side-by-side financial comparison for 2–5 public companies, parallelized at the gateway, with citation URIs.
Tools used: compare_entities. Optionally resolve_entity first if you only have names.
Calls: 1.
Fast path
compare_entities({
type: "company",
values: ["AAPL", "MSFT", "GOOGL"]
})
Returns:
{
"type": "company",
"entities": [
{
"query": "AAPL", "resolved": true,
"ticker": "AAPL", "cik": "0000320193", "company_name": "Apple Inc.",
"facts": {
"Revenues": { "value": 383285000000, "unit": "USD", "period": "2023-09-30", "form": "10-K" },
"NetIncomeLoss": { "value": 96995000000, "unit": "USD", "period": "2023-09-30", "form": "10-K" },
"CashAndCashEquivalentsAtCarryingValue": { "value": 29965000000, ... },
"LongTermDebtNoncurrent": { "value": 95281000000, ... }
},
"resources": {
"edgar_filings": "pipeworx://edgar/company/0000320193/filings",
"edgar_facts": "pipeworx://edgar/company/0000320193/facts"
}
},
{ "query": "MSFT", ... },
{ "query": "GOOGL", ... }
],
"deltas": {
"Revenues": [{entity: "AAPL", value: 383B}, {entity: "MSFT", value: 211B}, ...],
"NetIncomeLoss": [...],
...
}
}
The deltas view is pivoted by concept for easy comparison.
Caveats
- Period mismatch. Apple’s fiscal year ends in September, Microsoft’s in June. The latest reported value for each may be 6 months apart. Read the
periodfield on each fact. - Concept-name drift. SEC filers sometimes change which XBRL concept they tag for revenue. The default
Revenuesconcept may return stale values for newer fiscal years. For deepest accuracy, additionally tryRevenueFromContractWithCustomerExcludingAssessedTax. - Tickers vs. CIKs. Both work as input. CIKs are stable across name changes; tickers change when companies rebrand.
Manual path (full control)
If you need different concepts, time windows, or stocks beyond US public:
// Resolve each
const apple = await resolve_entity({ type: "company", value: "AAPL" })
// Pull whichever XBRL concept you want
edgar_company_concept({ cik: apple.ids.cik, concept: "OperatingIncomeLoss" })
edgar_company_concept({ cik: apple.ids.cik, concept: "ResearchAndDevelopmentExpense" })
// Repeat for each company in parallel
Or use fintech_company_deep_dive per company (compound):
await Promise.all([
fintech_company_deep_dive({ ticker: "AAPL" }),
fintech_company_deep_dive({ ticker: "MSFT" }),
fintech_company_deep_dive({ ticker: "GOOGL" })
])
This gets you SEC + AlphaVantage + CFPB per company.
Citation pattern
AAPL (EDGAR) FY23 revenue $383.3B, net income $97.0B. MSFT (EDGAR) FY24 revenue $211.9B, net income $72.4B. Periods differ — Apple’s fiscal year ends Sept 30, Microsoft’s June 30.
Always disclose the period when comparing — it’s the most common analyst error in agent output.