report
Module for financial statements and reports.
Classes:
-
BalanceSheet
–Class representing a balance sheet.
-
IncomeStatement
–Class representing an income statement.
-
Report
–Class for generating financial reports.
-
Statement
–Abstract base class for statements.
-
TrialBalance
–Class representing a trial balance.
BalanceSheet
dataclass
BalanceSheet(
assets: AccountBalances,
liabilities: AccountBalances,
equities: AccountBalances,
)
Bases: Statement
Class representing a balance sheet.
Methods:
-
accept
–Accept a StatementVisitor to generate a view of the statement.
-
from_ledger
–Create a BalanceSheet from the given ledger.
accept
accept(visitor: StatementVisitor) -> str
Accept a StatementVisitor to generate a view of the statement.
from_ledger
classmethod
from_ledger(ledger: Ledger) -> BalanceSheet
Create a BalanceSheet from the given ledger.
IncomeStatement
dataclass
IncomeStatement(
income: AccountBalances, expenses: AccountBalances
)
Bases: Statement
Class representing an income statement.
Methods:
-
accept
–Accept a StatementVisitor to generate a view of the statement.
-
from_ledger
–Create an IncomeStatement from the given ledger.
accept
accept(visitor: StatementVisitor) -> str
Accept a StatementVisitor to generate a view of the statement.
from_ledger
classmethod
from_ledger(ledger: Ledger) -> IncomeStatement
Create an IncomeStatement from the given ledger.
Report
Report(
ledger: Ledger, viewer: StatementVisitor, date: date
)
Class for generating financial reports.
Methods:
-
get_cet1
–Calculate and return the bank's CET1 capital.
-
get_cet1_ratio
–Calculate and return the bank's CET1 ratio.
-
get_liquidity_coverage_ratio
–Calculate and return the bank's Liquidity Coverage Ratio (LCR).
-
get_net_stable_funding_ratio
–Calculate and return the bank's Net Stable Funding Ratio (NSFR).
-
get_tier1_capital_ratio
–Calculate and return the bank's Tier 1 capital ratio.
-
get_total_assets
–Calculate and return the bank's total assets.
-
get_total_capital_ratio
–Calculate and return the bank's total capital ratio.
-
get_total_equity
–Calculate and return the bank's total equity.
-
get_total_liabilities
–Calculate and return the bank's total liabilities.
-
print_balance_sheet
–Generate the balance sheet view.
-
print_income_statement
–Generate the income statement view.
-
print_trial_balance
–Generate the trial balance view.
get_cet1
get_cet1() -> float
Calculate and return the bank's CET1 capital.
get_cet1_ratio
get_cet1_ratio() -> float
Calculate and return the bank's CET1 ratio.
get_liquidity_coverage_ratio
get_liquidity_coverage_ratio() -> float
Calculate and return the bank's Liquidity Coverage Ratio (LCR).
get_net_stable_funding_ratio
get_net_stable_funding_ratio() -> float
Calculate and return the bank's Net Stable Funding Ratio (NSFR).
get_tier1_capital_ratio
get_tier1_capital_ratio() -> float
Calculate and return the bank's Tier 1 capital ratio.
get_total_assets
get_total_assets() -> float
Calculate and return the bank's total assets.
get_total_capital_ratio
get_total_capital_ratio() -> float
Calculate and return the bank's total capital ratio.
get_total_equity
get_total_equity() -> float
Calculate and return the bank's total equity.
get_total_liabilities
get_total_liabilities() -> float
Calculate and return the bank's total liabilities.
print_balance_sheet
print_balance_sheet() -> None
Generate the balance sheet view.
print_income_statement
print_income_statement() -> None
Generate the income statement view.
print_trial_balance
print_trial_balance() -> None
Generate the trial balance view.
Statement
Bases: ABC
Abstract base class for statements.
Methods:
-
accept
–Accept a StatementVisitor to generate a view of the statement.
-
from_ledger
–Create a statement from the given ledger.
accept
abstractmethod
accept(visitor: StatementVisitor) -> str
Accept a StatementVisitor to generate a view of the statement.
TrialBalance
Bases: UserDict['TAccount', tuple[float, float]]
, Statement
Class representing a trial balance.
Methods:
-
accept
–Accept a StatementVisitor to generate a view of the statement.
-
from_ledger
–Create a TrialBalance from the given ledger.
-
get_credit_and_debit_values
–Get the debit and credit values for the given account.
accept
accept(visitor: StatementVisitor) -> str
Accept a StatementVisitor to generate a view of the statement.
from_ledger
classmethod
from_ledger(ledger: Ledger) -> TrialBalance
Create a TrialBalance from the given ledger.
get_credit_and_debit_values
staticmethod
get_credit_and_debit_values(
account: TAccount,
) -> tuple[float, float]
Get the debit and credit values for the given account.