| data_pull.py | Pulls prices, statements, estimates, earnings history, insider and holder data, short interest, peer data and FX from yfinance, ten years by default. | Each pull is wrapped so a failure is printed and recorded instead of stopping the run. Statement values are scaled to millions, FX is pulled only when the reporting currency differs from the trading currency, and its header lists yfinance's known defects. |
| event_scan.py | Flags the price moves that need attribution and splits each daily move into a sector component and an idiosyncratic residual. | The 15 largest absolute daily moves by default; runs are three or more same-direction days totalling more than 10%, drawdowns are falls of more than 15% from the running peak; the idiosyncratic return uses a trailing 250-day beta to the sector ETF; volume against the prior 20-day average and forward one-month and three-month returns are recorded. |
| technicals.py | Measures where the stock sits against its own history on each metric, with a z-score and percentile for each. | Returns over 1, 3, 6 and 12 months; Bollinger (20,2) %B and bandwidth; distance to the 50-day and 200-day averages and recent crosses; RSI(14), 12-1 momentum, 30-day and 90-day realised volatility; the monthly MACD (12,26,9) regime. |
| margin_bridge.py | Builds the margin bridges (each cost line shown as the share of gross profit or operating income it takes) and a waterfall chart for each period. | Exits unless it finds revenue, gross profit and operating income rows; shows each line as a share of revenue, of gross profit, of operating income and of the profit line above it. |
| build_exhibits.py | Builds the report's 36 numeric exhibits and the charts from the data folder, with no language model involved, in the renderer's block format. | Every exhibit carries a source note; a missing input skips the exhibit and is listed in exhibits_gaps.json. Growth shows n/m when the base or the result is negative and missing values show n/d; the quarterly table carries the note that trailing twelve-month revenue at fiscal year-end must equal the fiscal-year total, a tie the QA auditor checks. |
| flow_diagram.py | Draws the industry money-flow diagram for Section 1 from a JSON spec, in a fixed three-column layout of payers, company and payees, so nothing is placed by hand. | One horizontal arrow per flow, each label in its own box on its own lane, never over a node; return flows in red on a separate lane; node text wraps at a fixed width; 170 dpi. |
| dcf_build.py | Writes the 14-tab linked three-statement workbook from one JSON config with openpyxl. Everything company-specific lives in the config except the Drivers block, which implements the subscription-plus-advertising revenue build. | Writes the 17-row Checks tab, whose overall status reads ALL OK, REVIEW CHECK ITEMS or FAIL; charges interest on opening balances, so there are no circular references; builds the grids as SUMPRODUCT formulas rather than data tables; colours cells as it writes them, then runs one style pass over every sheet. |
| dcf_validate.py | Recalculates the workbook in LibreOffice, runs all four scenarios and three toggles, writes a static scenario snapshot onto the Cover and saves scen.json. | Stops on any formula error in the base recalculation and asserts zero errors in every scenario and toggle run; asserts that the exit toggle equals the side-by-side exit value within $0.05; resets the selector to the Street case and recalculates once more before saving. |
| dcf_builder_template.py | The Spotify reference builder with its inputs written into the code, kept as the annotated original and read only when adapting the Drivers block to a new revenue model. | Carries the same scaffold, 17 checks, sensitivity engine and style pass as dcf_build.py; its header lists the adaptation steps, which replace the scenario dictionary, the Drivers formulas, the history, the bridge items and the market data and keep everything else. |
| dcf_memo_builder.js | Renders the assumptions memo to Word from values read out of the recalculated workbook. The shipped file is the Spotify instance, so the prose is rewritten for each company and the structure kept. | Keeps a fixed eight-section structure, from what the model concludes to the sources, and gives each lever a five-column values table followed by Anchor, Mechanism and What would change it. |
| assemble_report.py | Merges the script exhibits and every research block into one report spec, in the order fixed by report_skeleton.json, with a contents block first and a page break before every H1. | Skips any exhibit or research key that does not exist and lists it as missing; merges blocks for the same section key across research files instead of overwriting them; prints the block count. |
| report_renderer.js | Turns the JSON report spec into a portrait Word document with numbered exhibits, a contents field, a header line and page numbers, and applies the table rules. | Portrait only, ignoring landscape markers in the spec; splits any table wider than six columns into parts (a) and (b); right-aligns a column when at least 60% of its cells look numeric; starts every H1 on a new page and gives every exhibit a numbered title and an italic note. |
| qa_gates.py | Runs mechanical checks on the rendered PDF and prints a table for the manifest, with exit code 1 on any FAIL. | Fails a standard report above 100 pages, any em dash, the label strings "Claim:", "Must be true:", "Evidence:" and "Deciding question:", landscape pages, and (est.) figures with no Appendix G. Warns outside 30 to 70 pages, when a section runs past 1.5 times its budget, and on placeholders such as [NEED and research pending. |
| two_pager_builder.js | Builds the internal two-pager in its fixed format from a JSON spec with company, sector, ticker, price, date, price target, analyst, overview, thesis, metrics, risks and an optional logo. | Garamond 11pt at 1.4 line spacing, left-aligned, 0.9-inch side margins; theses and risks as decimal-numbered items with lettered sub-points; key metrics as a two-row table between rules. |
| two_pager_check.py | Checks the rendered two-pager's length and how full its last page is, with exit code 1 on failure. | Passes only with exactly two pages and the second page at least 85% filled. |