qis.PortfolioAccounting

class qis.PortfolioAccounting(positions, net_equity, reporting_basis=ReportingBasis.NET_EQUITY, fixed_notional=None, tolerance=0.01)[source]

Bases: object

Reconciled reference-currency account ledger, independent of fitted coverage.

The ledger is complete even when some positions have no risk model. All marks include accrued amounts exactly once. Short and derivative liabilities remain separate from declared borrowing. Values describe accounting marks, not gross derivative risk exposure. Scenario equity includes P&L from valued holdings; missing risk coverage remains disclosed.

Variables:
  • positions (pandas.DataFrame) – Unique holding-ID index; columns mtm and role (PositionRole). Optional asset_class (AccountAssetClass or its display value) and currency columns map each position to its allocation category and currency. Both columns must be supplied together. Marks remain in reference currency; allocation currency is independent of fitted-return currency.

  • net_equity (float) – Explicit positive account equity, reconciled to signed marks.

  • reporting_basis (qis.portfolio.stress.accounting.ReportingBasis) – Meaning of the portfolio’s reporting denominator.

  • fixed_notional (float | None) – Positive explicit denominator when using FIXED_NOTIONAL.

  • tolerance (float) – Absolute reference-currency reconciliation tolerance.

Parameters:
__init__(positions, net_equity, reporting_basis=ReportingBasis.NET_EQUITY, fixed_notional=None, tolerance=0.01)
Parameters:
Return type:

None

Methods

__init__(positions, net_equity[, ...])

allocation_with_borrowing()

Add signed financing to gross invested-asset allocations by currency.

gross_asset_allocation()

Aggregate positive marks by declared asset class and allocation currency.

reconcile_holdings(holdings)

Check that every valued holding belongs to the complete dated ledger.

summary()

Return reconciled balance-sheet levels and funding leverage ratios.

Attributes

borrowing

Return positive drawn borrowing from declared financing rows.

denominator

Return the amount specified by the declared reporting basis.

denominator_label

Return the factual caption shared by report headers and exports.

fixed_notional

gross_assets

Return positive accounting marks including cash and accrued amounts.

reporting_basis

tolerance

positions

net_equity

positions: DataFrame
net_equity: float
reporting_basis: ReportingBasis = 'net_equity'
fixed_notional: float | None = None
tolerance: float = 0.01
gross_asset_allocation()[source]

Aggregate positive marks by declared asset class and allocation currency.

Returns:

Class-by-currency reference-currency amounts in the five standard buckets. An empty table indicates that the caller supplied no allocation mapping. Liabilities remain in the reconciled balance sheet, outside gross allocation.

Return type:

DataFrame

allocation_with_borrowing()[source]

Add signed financing to gross invested-asset allocations by currency.

Returns:

Class-by-currency amounts. Positive asset classes sum to gross assets; Borrowing is negative. Dividing each row by gross assets shows funding leverage without changing the 100% total invested-asset allocation.

Return type:

DataFrame

property gross_assets: float

Return positive accounting marks including cash and accrued amounts.

property borrowing: float

Return positive drawn borrowing from declared financing rows.

property denominator: float

Return the amount specified by the declared reporting basis.

property denominator_label: str

Return the factual caption shared by report headers and exports.

reconcile_holdings(holdings)[source]

Check that every valued holding belongs to the complete dated ledger.

Parameters:

holdings – PortfolioHolding sequence with signed reference-currency marks.

summary()[source]

Return reconciled balance-sheet levels and funding leverage ratios.

Return type:

Series