Borrower#
- class bamengine.roles.borrower.Borrower(net_worth, total_funds, wage_bill, credit_demand, projected_fragility, gross_profit, net_profit, retained_profit, loan_apps_head, loan_apps_targets)[source]#
Bases:
RoleBorrower role for firms.
Represents the financial and credit state for firms. Each array index corresponds to a firm ID (0 to n_firms-1).
- Parameters:
net_worth (
Float1D) – Firm equity/net worth (A = assets - liabilities).total_funds (
Float1D) – Available liquidity (shared view with Employer.total_funds).wage_bill (
Float1D) – Total wages to be paid (W, shared with Employer.wage_bill).credit_demand (
Float1D) – Amount of credit requested from banks (B).projected_fragility (
Float1D) – Financial fragility metric (B / A, leverage).gross_profit (
Float1D) – Revenue before debt service.net_profit (
Float1D) – Profit after debt service (π).retained_profit (
Float1D) – Profit retained after dividends.loan_apps_head (
Idx1D) – Queue head pointer for loan applications.loan_apps_targets (
Idx2D) – Queue of bank IDs to apply to, shape (n_firms, max_H).
Examples
Access from simulation:
>>> import bamengine as bam >>> sim = bam.Simulation.init(n_firms=100, seed=42) >>> bor = sim.bor >>> bor.net_worth.shape (100,) >>> bor.net_worth.mean() 105.3
Find firms with negative net worth (insolvent):
>>> import numpy as np >>> insolvent = bor.net_worth < 0 >>> insolvent.sum() 3
Calculate aggregate credit demand:
>>> total_credit_demand = bor.credit_demand.sum() >>> total_credit_demand 1250.0
Check financial fragility distribution:
>>> high_fragility = bor.projected_fragility > 0.5 >>> high_fragility.sum() 15
Notes
The Borrower role is one of three roles assigned to firms:
Producer: production and pricing (see Producer)
Employer: labor hiring and wages (see Employer)
Borrower: finance and credit
The total_funds and wage_bill arrays are shared with Employer role (same underlying NumPy array) for memory efficiency and consistency.
See also
- net_worth#
Firm equity (assets minus liabilities).
- total_funds#
Available liquidity (shared view with Employer.total_funds).
- wage_bill#
Total wages to be paid (shared with Employer.wage_bill).
- credit_demand#
Amount of credit requested from banks.
- projected_fragility#
Financial fragility metric (leverage ratio).
- __init__(net_worth, total_funds, wage_bill, credit_demand, projected_fragility, gross_profit, net_profit, retained_profit, loan_apps_head, loan_apps_targets)#
- name = 'Borrower'#
- gross_profit#
Revenue before debt service.
- net_profit#
Profit after debt service.
- retained_profit#
Profit retained after dividend payout.
- loan_apps_head#
Queue head pointer for loan applications.
- loan_apps_targets#
Queue of bank IDs to apply to, shape
(n_firms, max_H).