equity-desk
Enables AI agents to perform grounded equity research by analyzing tickers from SEC filings and market data, producing citation-guarded memos with pre-computed fundamentals.
README
equity-desk
A grounded AI equity-research analyst — give it a ticker; it pulls the real SEC filings and market prices, computes the fundamentals itself, and writes a cited buy/hold/sell memo in which every number is enforced to trace to a source. The LLM is never allowed to invent a figure.

Why grounded?
Most "AI stock analyst" projects hand a ticker to an LLM and hope. An AI that invents numbers in a financial report isn't a demo problem — it's the reason enterprises don't ship LLM features. equity-desk inverts the trust:
- Hand-rolled Python computes every number — ratios, peer ranks, a DCF fair value — from SEC EDGAR filings and market prices.
- The LLM receives a fact sheet of pre-computed, source-tagged figures. Its only job is prose.
- A citation guard scans the finished memo and rejects it if any number matches no fact. Fail loud, not quiet.
Headline metric: 100% of numbers in every memo trace to source — enforced by a test, not a promise.
flowchart LR
T[ticker] --> D[data layer\nEDGAR + yfinance\nlive, cached fallback]
D --> A[analysis engine\nratios · peers · DCF\nhand-rolled]
A --> F[fact sheet\nevery number + its source]
F --> W[LLM writer\nqwen local / claude opt-in\nprose only]
W --> G{citation guard}
G -->|every number traces| M[cited memo ✓]
G -->|invented number| X[memo rejected ✗]
What the analysis engine computes (all hand-rolled)
| Axis | Metrics |
|---|---|
| Valuation | P/E, P/S, EV/EBITDA, market cap |
| Profitability | gross→net margins, return on equity |
| Growth | revenue YoY, EPS |
| Leverage | debt/equity, net debt |
| Peers | the same ratios computed from each peer's own filings; median comparison |
| Intrinsic value | 5-year DCF over EDGAR free cash flow → fair value vs price, assumptions stated |
| Verdict | a stated rule over DCF gap + peer valuation — decided by code, never by the LLM |
The interesting parts are deliberately framework-free (~600 lines of plain Python): XBRL tag extraction from EDGAR company-facts, the ratio math, the DCF, and the guard's number-matching are all in equitydesk/, readable and defensible line by line.
Run it (no API key, no network needed)
pip install -r requirements.txt
python -m equitydesk AAPL --offline # bundled SEC snapshots, deterministic writer
python -m equitydesk AAPL # live EDGAR + yfinance
python -m equitydesk AAPL --provider ollama # a local LLM writes the prose
python -m equitydesk AAPL --provider claude # opt-in; only the fact sheet is sent, never the vault of filings
python -m equitydesk AAPL --json # just the grounded fact sheet
python -m equitydesk.web # the dashboard → http://127.0.0.1:8000
Sample output: memos/AAPL-sample.md
When the guard catches an invented number, the memo is rejected with the receipt:
CITATION GUARD FAILED — memo rejected:
✗ 31.2 does not trace to any fact in the AAPL fact sheet
The recommendation is a rule, not a vibe
buy: DCF upside > +15% AND not richer than peer median P/E sell: DCF downside < −15% AND not cheaper than peer median P/E hold: everything else
The LLM explains the verdict; it cannot change it. The DCF's assumptions (FCF growth clamped to 2–15%, WACC 9%, terminal 2.5%, 5 years) are printed in every memo — conservative by design, and honestly stated rather than hidden.
MCP server
The desk doubles as an MCP server, so AI agents on your machine can use grounded equity research as a tool:
python mcp_server.py
{"mcpServers": {"equity-desk": {"command": "python", "args": ["/path/to/equity-desk/mcp_server.py"]}}}
Tools: analyze_ticker(ticker, provider) → citation-guarded memo · fact_sheet(ticker) → grounded numbers as JSON.
Measured, not vibed
- Citation-integrity test — generates a memo from real (frozen) AAPL data and asserts the guard finds 0 un-sourced numbers. This is the repo's headline claim, running in CI on every push.
- Hand-worked math tests — every ratio and the DCF are asserted against fixtures computed by hand first.
- Golden-ticker CI — a committed EDGAR/yfinance snapshot makes the whole pipeline run offline and identically every time.
pip install -r requirements-dev.txt && python -m pytest # 28 tests
Honest limitations
- Supported universe is the 8 tickers in
data/peers.json(v1) — add a ticker by adding its CIK and peers. - FCF growth is proxied by revenue growth (clamped 2–15%); WACC is a fixed 9%. A conservative DCF will call every richly-valued growth stock overvalued — the point is that the assumptions are stated, not that they're clairvoyant.
- EDGAR tag mapping trusts
fp=FYlabelling; odd fiscal calendars may misparse. - The guard checks numeric provenance, not narrative truth — it stops invented figures, not bad arguments.
Phase 2 (documented, not built)
10-K risk-factor mining · multi-ticker comparison memos · PDF export · broader universe
Not investment advice. Data: SEC EDGAR company facts + Yahoo Finance. MIT.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。