Shore-up math: borrow target is bills + reserve, no double cash subtract (Closes #119) #128

Merged
robertismo merged 1 commit from 119-shoreup into master 2026-10-01 15:40:30 +00:00
Owner

The shore-up borrow target is now bills + reserveNeed. The old math (need = bills + (reserveNeed − cash), borrowed = need − cash) subtracted the bank's own cash twice: a bank whose cash covered its bills was never force-borrowed at all and got bankrupted with the market full, and a cash-short bank under-borrowed and ended below reserve. Now a short bank borrows bills + reserve − cash, pays its bills, and holds the reserve; only a position the market cannot shore up is insolvent.

Regression tests: the bills-covered-but-reserve-short bank with a full market borrows 3050 and survives holding the reserve; the shoreUpNeed math is pinned for the short, covered, and reserve-off cases. Full suite + vet clean.

The shore-up borrow target is now bills + reserveNeed. The old math (need = bills + (reserveNeed − cash), borrowed = need − cash) subtracted the bank's own cash twice: a bank whose cash covered its bills was never force-borrowed at all and got bankrupted with the market full, and a cash-short bank under-borrowed and ended below reserve. Now a short bank borrows bills + reserve − cash, pays its bills, and holds the reserve; only a position the market cannot shore up is insolvent. Regression tests: the bills-covered-but-reserve-short bank with a full market borrows 3050 and survives holding the reserve; the shoreUpNeed math is pinned for the short, covered, and reserve-off cases. Full suite + vet clean.
shore-up math: borrow target is bills + reserve, no double cash subtract (Closes #119)
All checks were successful
build / build (push) Successful in 27s
ad879bf288
The old need = bills + (reserveNeed - cash) subtracted the bank's own
cash twice: a bank whose cash already covered its bills was never
force-borrowed at all and got bankrupted without the bond market being
consulted, and a cash-short bank under-borrowed and ended the turn
below reserve. The borrow target is now bills + reserveNeed: after
paying bills the bank holds the reserve in cash, and only a position
the market cannot shore up is insolvent.

Regression tests: a bills-covered but reserve-short bank with a full
market now borrows 3050 and survives holding the reserve; shoreUpNeed
math pinned for the short, covered, and reserve-off cases.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Winnie/bankwars!128
No description provided.