Skip to content

gorajing/ib-deck-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IB Deck Engine

A Python template library for generating investment banking presentations from structured data.

The core idea: AI is great at financial reasoning but bad at spatial layout. This library separates the two — the LLM (or human) writes a JSON spec, and a deterministic rendering engine handles every pixel. Right-alignment is guaranteed by the template, not hoped for.

What's in here

  • ib_deck_engine/ — The template library (12 IB slide types, JSON spec → PPTX rendering)
  • case_study/ — Complete worked example: Addus HomeCare Corp (ADUS) sell-side mandate
  • scripts/ — Build scripts that generate the case study artifacts from SEC EDGAR data
  • docs/ — Architecture proposal, plugin comparison, slide catalog
  • examples/ — Runnable demos

Why this exists

After building two complete IB workflows with AI (one for Medpace, one for ADUS), I noticed every failure mode came from the same root cause: the LLM was being asked to write deterministic code (Inches(2.5), Pt(11)) when it should have been filling a structured spec.

Specific failures I hit repeatedly:

  • Right-alignment inconsistent in financial table cells
  • Bar heights not proportional to underlying data ($951M bar nearly equal to $1,423M)
  • Reference line labels overlapping titles
  • Source text cut off below footer
  • Price labels wrapping to two lines because text boxes were 0.4" wide

The fix isn't better prompting — it's separation of concerns. This library is option #2 from the architecture proposal: a curated template library where the LLM picks a template and fills a JSON spec, and the engine handles every pixel.

For the Claude Code plugin packaging, the renderer-vs-prompt-guided comparison artifact, and the canonical schema / audit proposal built around this library, see gorajing/ib-deck-plugin.

Quick start

git clone https://github.com/gorajing/ib-deck-engine.git
cd ib-deck-engine
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt

# Build the full ADUS case study deck (14 slides)
python3 -m ib_deck_engine.demo_full_deck

# The deck will be saved to case_study/adus_full_deck.pptx

The 12 templates

# Template Purpose
1 render_cover Cover slide with confidential mark and bank badge
2 render_section_divider Full-bg navy section divider
3 render_toc Numbered agenda with light blue bands
4 render_exec_summary Callout bar + hierarchical bullets (■ / —)
5 render_investment_highlights 4-card grid with numbered headers
6 render_financial_summary Historical P&L table with margin rows
7 render_stacked_bar_table Moelis-style stacked bar + data table
8 render_dual_chart GS-style dual bar chart with CAGR labels
9 render_football_field Valuation summary with category pills
10 render_sensitivity WACC × Terminal Growth grid with base case highlight
11 render_sources_uses LBO capital structure (two-column)
12 render_trading_comps Peer multiples table with target highlighted

See ib_deck_engine/SLIDE_CATALOG.md for the full pattern catalog (15+ layouts referenced from real bank decks).

Example usage

from ib_deck_engine import IBRenderer

r = IBRenderer()

r.render_financial_summary({
    "title": "Consistent Revenue Growth with Expanding Profitability",
    "section_header": "Historical Financial Summary ($ in thousands)",
    "headers": ["Metric", "FY2023A", "FY2024A", "FY2025A", "3Y CAGR"],
    "rows": [
        {"label": "Revenue", "values": ["1,058,651", "1,154,599", "1,422,530", "14.4%"], "style": "bold"},
        {"label": "% Growth", "values": ["11.3%", "9.1%", "23.2%", ""], "style": "pct"},
        {"label": "EBITDA", "values": ["105,082", "116,221", "155,027", "21.4%"], "style": "highlight"},
        {"label": "% Margin", "values": ["9.9%", "10.1%", "10.9%", ""], "style": "pct"},
    ],
    "source": "Source: SEC EDGAR.",
})

r.save("output.pptx")

Notice what's NOT in this code: no Inches(2.5), no Pt(11), no EMU values. The LLM never has to guess pixel coordinates — it only describes what should be on the slide.

The case study

The case_study/ folder contains a complete IB workflow for Addus HomeCare Corp (ADUS), a public home health services company:

File What it is
adus_10k_master.json Single source of truth — all financial data extracted from SEC EDGAR 10-K
adus_dcf_model.xlsx 6-tab DCF model with 401 formulas, all referencing the JSON
adus_lbo_model.xlsx 6-tab LBO model with 244 formulas (TLB amort, value creation bridge)
adus_buyer_list.xlsx 20-buyer M&A list (8 strategic, 8 financial, 4 cross-border)
adus_pitch_deck.html HTML prototype (12 slides)
adus_pitch_deck.pptx First-pass PPTX conversion
adus_full_deck.pptx 14-slide deck built with the IBRenderer template library
adus_full_audit.md End-to-end audit: 50+ data points traced to source
adus_cross_model_audit.md Cross-model consistency audit (DCF vs LBO)

All numbers in the deck trace back to public SEC EDGAR filings.

Architectural principle: separate content from rendering

┌─────────────────────────────────────┐
│  CONTENT REASONING (LLM or human)   │
│                                     │
│  "I need a financial table with     │
│   3 historical years, EBITDA bold,  │
│   margins italic gray"              │
└────────────────┬────────────────────┘
                 │
                 ▼
┌─────────────────────────────────────┐
│  STRUCTURED SPEC (JSON)             │
│                                     │
│  {                                  │
│    "title": "...",                  │
│    "headers": [...],                │
│    "rows": [{"label", "values"}]    │
│  }                                  │
└────────────────┬────────────────────┘
                 │
                 ▼
┌─────────────────────────────────────┐
│  DETERMINISTIC RENDERER             │
│                                     │
│  - Right-aligns numerics ALWAYS     │
│  - Computes proportional bars       │
│  - Manages spacing/padding/colors   │
│  - Pixel-perfect by construction    │
└────────────────┬────────────────────┘
                 │
                 ▼
            output.pptx

This is the same pattern that Beautiful.ai, Gamma, and UpSlide use. Banks pay $50K+/year for tools like Macabacus and UpSlide for exactly this — pixel-perfect templates with data linking. This library is a minimal open-source version of that pattern, focused on IB use cases.

Reference materials

The slide patterns in this library are reverse-engineered from real bank decks (see ib_deck_engine/SLIDE_CATALOG.md):

  • Goldman Sachs board presentation format (cover, section dividers, financial tables, dual charts, investment highlights)
  • Moelis discussion materials format (stacked bar + data table, pill-label key terms, football field)
  • Evercore fairness opinion format (situation overview, valuation summary)

The actual PDFs are not included in this repo (they belong to their respective banks). The library implements the patterns — colors, spacing, layout rules — not the brand assets.

Disclaimer

This is a learning case study, not an investment recommendation or financial product. Models are simplified for demonstration. The valuation ranges, multiples, and assumptions are illustrative. Always verify financial data against primary sources before relying on it for any investment decision.

License

MIT — see LICENSE.

Acknowledgments

  • Built using python-pptx for PPTX generation
  • Built using xlsxwriter for Excel models (NOT openpyxl — see lessons learned in docs/plugin_comparison.md)
  • Financial data extracted via edgartools from SEC EDGAR
  • Slide patterns inspired by real Goldman Sachs, Moelis, and Evercore client decks

About

A Python template library for generating investment banking presentations from structured data. Separates content reasoning from spatial rendering.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors