Loan aqcuisition broken #149
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Okay currently filling loans does not at all work how it should. Review the code and give me the exact algorithm that defines how loans are filled, there is differently an issue with how it is functioning.
Reading the fill code end to end right now — I'll lay out the exact algorithm as implemented, with the line-level steps, and where the behavior you're seeing comes from.
Read the code, master
1bb49d8. The exact fill algorithm, line by line:PHASE 3 (bidding): every bank places bids into pendingLoanBids[bankID][loanID] = rate — the human via the sheet, the AIs via their hooks — all against the phase-start market. The sheet warns on overcommit but submits anyway; the engine's real enforcement happens at the award.
PHASE 3b (awardLoans, game.go:369): the shelf is processed in OFFER ORDER — the order the loans were drawn (loan ID order, the "market order"):
continue // cannot fund; offer dies unclaimed.Consequences of the current code:
The market summary line then reports the funded total, which hides the died-unclaimed loans (they count as neither taken nor funded). The human sees their own unfunded wins, but AI runners-up get no signal at all.
Yes I have seen that issue where the winner cannot commit so the loan just dies and nobody takes it, that is a bug.
Another one is the vickery should not be based on those who cannot fill the loan, this is a big issue where people are undercutting rates on loans that they themselves cannot fill. This cannot happen.
Explain how you plan on solving this.
Here's the plan, one coherent rule that fixes both bugs at once:
ELIGIBILITY FIRST, THEN THE AUCTION. For every loan, the only bidders who exist are the ones who can actually fund it. The award walk keeps the current shelf order, but at each loan it first filters the bidders to the ELIGIBLE set: bid on this loan AND current cash >= the loan amount, where current cash is their live cash after any loans they've already won this walk. Then:
Consequences, all intended:
I'll implement it exactly this way on a branch, with a regression test covering: the runner-up inherits a loan the winner can't fund; an unfundable bid can't set the second price; a drained bank drops out of later loans; the no-eligible case still dies unclaimed. Say go.
@Winnie do it.