Reports¶
Tearsheet is the single report object — one class, three renderers (render_html, render_pdf, render_excel) — fed a Portfolio and an optional benchmark. The fundcloud.reports.formatting module exposes the shared building blocks (StatCard, StatRow, stat_cards, stats_rows, format_stat) so custom templates and bespoke reports can reuse the exact formatting the default tear sheet uses. See the Tear sheets guide for output structure and the PDF/Excel extras.
fundcloud.reports
¶
Tear-sheet output — HTML, PDF, Excel.
The primary public object is :class:Tearsheet. Renderer modules are
lazy-loaded via :class:Tearsheet.render_* methods, so installing
fundcloud without [reports] stays cheap.
Tearsheet
dataclass
¶
Tearsheet(
portfolio: Portfolio,
benchmark: Series | str | None = None,
template: Literal["strategy"] = "strategy",
title: str | None = None,
meta: dict[str, str] = dict(),
)
A renderable tear sheet.
benchmark accepts a :class:pandas.Series or a column name to look
up on the portfolio's underlying returns (set at construction). The
lookup runs in __post_init__ so every downstream renderer sees a
plain pd.Series.
render_html
¶
Render to HTML.
path is None → returns the HTML string.
path is a path → writes the file and returns the :class:Path.
Returning the Path (instead of the 5 MB+ inline-plotly string) avoids flooding REPL / notebook output when a path is provided.
Source code in python/fundcloud/reports/tearsheet.py
render_pdf
¶
render_pdf(
path: str | Path,
*,
engine: Literal["matplotlib", "weasyprint"]
| None = None,
) -> Path
Render a PDF.
engine="matplotlib" (default) uses pure-Python matplotlib PdfPages —
no system libraries required. engine="weasyprint" uses HTML + CSS
paged media; needs Pango / GLib installed on the host.
Source code in python/fundcloud/reports/tearsheet.py
fundcloud.reports.formatting
¶
Tear-sheet formatting helpers — shared by HTML, PDF, and Excel renderers.
stat_cards
¶
Top-of-page stat cards — four high-signal metrics.
Source code in python/fundcloud/reports/formatting.py
stats_rows
¶
Row-per-metric table for the bottom of the tear sheet.