revenue#
Revenue events for collection, debt repayment, and dividend distribution.
This module defines the revenue phase events that execute after goods market. Firms collect sales revenue, repay or write off debts, and distribute dividends to shareholders.
Event Sequence#
The revenue events execute in this order:
FirmsCollectRevenue - Calculate revenue from sales and add to funds
FirmsValidateDebtCommitments - Repay debts or write off if insufficient funds
FirmsPayDividends - Distribute profits as dividends (if positive)
Design Notes#
Events operate on borrower, lender, producer, and loanbook
Revenue: R = P × (Y - S) where Y - S = units sold
Gross profit: R - W (revenue minus wage bill)
Net profit: gross_profit - interest_paid
Dividend payout: δ × net_profit (if positive), else retain all losses
Debt write-off: if funds < debt, proportional reduction up to net worth
Examples
Execute revenue events:
>>> import bamengine as be
>>> sim = be.Simulation.init(n_firms=100, seed=42)
>>> # Revenue events run as part of default pipeline
>>> sim.step()
Execute individual revenue event:
>>> event = sim.get_event("firms_collect_revenue")
>>> event.execute(sim)
>>> sim.bor.gross_profit.sum()
2450.0
See also
bamengine.events._internalSystem function implementations (in revenue module)
BorrowerFinancial state with profits
ProducerProduction state with revenue calculation
LoanBookDebt relationships
Event Classes#
Firms collect revenue from sales and calculate gross profit. |
|
Firms repay debts or write off if insufficient funds. |
|
Firms distribute dividends from positive profits to households. |