abaquant.reports.exportable

Import path: abaquant.reports.exportable

Domain: Structured analytical reports and Markdown, HTML, or lightweight PDF export.

Purpose

Exportable Markdown, HTML, and PDF reports for AbaQuant objects.

When to use it

Use these objects after calculations are complete and results must be packaged for review, storage, or distribution.

Public objects

  • class: ReportTable — One tabular block inside an exportable report. * ReportTable.frame — Return this table as a defensive pandas DataFrame copy.

  • class: ReportSection — One titled narrative section inside an exportable report.

  • class: ExportableReport — Structured report that can be exported as Markdown, HTML, or PDF. * ExportableReport.to_markdown — Return the report as Markdown and optionally write it to disk. * ExportableReport.to_html — Return the report as standalone HTML and optionally write it to disk. * ExportableReport.to_pdf — Write a simple text PDF representation of the report. * ExportableReport.save — Export this report to several formats in one directory. * ExportableReport.as_dict — Return a serialization-friendly nested representation of the report.

  • function: generated_metadata — Return standard metadata used by AbaQuant generated reports.

  • function: build_option_model_report — Build an exportable report for one vanilla option pricing model.

  • function: build_portfolio_allocator_report — Build an exportable report for a portfolio allocator object.

  • function: build_backtest_report — Build an exportable report for a deterministic portfolio backtest result.

  • function: build_credit_report — Build an exportable report for a credit-proxy assessment.

  • function: build_risk_dashboard_report — Build an exportable report for an integrated risk dashboard.

Detailed reference

Exportable Markdown, HTML, and PDF reports for AbaQuant objects.

Purpose

The module provides one small dependency-light reporting primitive used by option models, portfolio objects, credit assessments, and integrated risk summaries. Reports are intentionally structured as plain text, scalar mappings, and tabular data so they can be exported consistently without requiring a web framework or notebook runtime.

Conventions

Markdown and HTML exports are always available. PDF export writes a compact text-based PDF using the standard library only. The PDF output is designed for portable archival of report contents, not pixel-perfect chart reproduction.

Scope and limitations

The reporting layer formats already-computed diagnostics. It does not recalculate prices, portfolio allocations, financial-statement metrics, or market data.

class abaquant.reports.exportable.ExportableReport(title, subtitle=None, sections=<factory>, metadata=<factory>, provenance=None)

Bases: object

Structured report that can be exported as Markdown, HTML, or PDF.

Parameters:
  • title (str) – Report title.

  • subtitle (str, optional) – Short subtitle shown beneath the title.

  • sections (Sequence[ReportSection], optional) – Ordered report sections.

  • metadata (Mapping[str, object], optional) – Report-level metadata such as object type, generated-at timestamp, or model convention details.

  • provenance (DataProvenance | None)

to_markdown(path=None)

Return the report as Markdown and optionally write it to disk.

Parameters:

path (str or pathlib.Path, optional) – Destination path. Parent directories are created when needed.

Returns:

Markdown representation of the report.

Return type:

str

to_html(path=None)

Return the report as standalone HTML and optionally write it to disk.

Parameters:

path (str or pathlib.Path, optional) – Destination path. Parent directories are created when needed.

Returns:

Standalone HTML document.

Return type:

str

to_pdf(path)

Write a simple text PDF representation of the report.

Parameters:

path (str or pathlib.Path) – Destination PDF path. Parent directories are created when needed.

Returns:

Resolved destination path.

Return type:

pathlib.Path

save(directory, stem, formats=('markdown', 'html'))

Export this report to several formats in one directory.

Parameters:
  • directory (str or pathlib.Path) – Destination directory.

  • stem (str) – Base filename without extension.

  • formats (Sequence[str], default=("markdown", "html")) – Output format labels. Supported values are "markdown", "md", "html", and "pdf".

Returns:

Mapping from requested format label to written path.

Return type:

dict[str, pathlib.Path]

as_dict()

Return a serialization-friendly nested representation of the report.

Return type:

dict[str, object]

class abaquant.reports.exportable.ReportSection(title, body=None, metrics=<factory>, tables=<factory>)

Bases: object

One titled narrative section inside an exportable report.

Parameters:
  • title (str) – Section heading.

  • body (str, optional) – Narrative body text.

  • metrics (Mapping[str, object], optional) – Scalar key-value diagnostics displayed below the body.

  • tables (Sequence[ReportTable], optional) – Tables rendered within this section.

class abaquant.reports.exportable.ReportTable(title, data, description=None, max_rows=None)

Bases: object

One tabular block inside an exportable report.

Parameters:
  • title (str) – Human-readable table title.

  • data (pandas.DataFrame or mapping or sequence of mappings) – Table-like content converted to a pandas DataFrame for rendering.

  • description (str, optional) – Short explanatory text printed before the table.

  • max_rows (int, optional) – Maximum number of rows to render. Remaining rows are omitted from the exported preview rather than changing the underlying data object.

frame()

Return this table as a defensive pandas DataFrame copy.

Return type:

DataFrame

abaquant.reports.exportable.build_backtest_report(backtest)

Build an exportable report for a deterministic portfolio backtest result.

Parameters:

backtest (object)

Return type:

ExportableReport

abaquant.reports.exportable.build_credit_report(assessment)

Build an exportable report for a credit-proxy assessment.

Parameters:

assessment (object)

Return type:

ExportableReport

abaquant.reports.exportable.build_option_model_report(model, option_type='call')

Build an exportable report for one vanilla option pricing model.

Parameters:
  • model (object)

  • option_type (str)

Return type:

ExportableReport

abaquant.reports.exportable.build_portfolio_allocator_report(allocator, *, backtest_kwargs=None)

Build an exportable report for a portfolio allocator object.

Parameters:
  • allocator (object)

  • backtest_kwargs (Mapping[str, object] | None)

Return type:

ExportableReport

abaquant.reports.exportable.build_risk_dashboard_report(dashboard)

Build an exportable report for an integrated risk dashboard.

Parameters:

dashboard (object)

Return type:

ExportableReport

abaquant.reports.exportable.generated_metadata(report_type, **extra)

Return standard metadata used by AbaQuant generated reports.

Parameters:
  • report_type (str)

  • extra (object)

Return type:

dict[str, object]