How to automate mortgage warehouse funding and cash forecasting
TLDR
Reconcile warehouse draws, funding, and investor settlements into a dated cash forecast that flags buffer breaches.
Build a dated cash forecast from verified opening balances, approved funding schedules, expected investor settlements, and warehouse advances and repayments. Show unrestricted cash and drawable facility capacity as separate balances. The funding desk can then see which loans are ready, which requests need approval, and where a delayed receipt would take cash below its internal buffer.
The workflow below applies to an originate-to-sell lender that funds loans with warehouse facilities. The facility agreement and the lender's authorization process define eligibility, advance rates, cutoffs, and who can release funds. Public lender filings describe warehouse facilities as financing for mortgage loans held for sale, with sale proceeds used to repay amounts owed. UWM Holdings annual report
Follow a loan from scheduled closing to warehouse payoff
| Process | Inputs and operator | What to automate | Accepted output |
|---|---|---|---|
| Establish opening cash | Treasury controller, bank balances and ledger | Match entity, bank account, value date, and statement timestamp. Classify restricted cash and route stale or unmatched balances. | Reconciled unrestricted opening cash and a source manifest |
| Confirm facility headroom | Treasury manager, facility agreements, collateral and outstanding advances | Apply approved limits, eligibility, reserves, aging, and concentration rules to the relevant facility | Drawable capacity by facility and loan type with an explicit cutoff |
| Forecast fundings | Funding desk, approved closing schedule and capital markets forecast | Deduplicate loan versions, separate scheduled from expected fundings, and calculate the lender's cash portion by value date | Funding demand by date, status, and facility |
| Request and release | Funding desk and cash approver, approved instructions and lender response | Prepare draw packages, record approval and acknowledgements, match amounts, and reconcile uncertain status before retry | Confirmed draw and bank payment, or a hold with a named owner |
| Reconcile investor settlement | Treasury, purchase advice, warehouse and bank feeds | Match proceeds and payoff using loan, facility, settlement, and bank references. Separate partial or unmatched receipts. | Confirmed advance repayment and evidence for Finance |
| Forecast and monitor | Treasury controller, verified activity and payment calendar | Roll unrestricted cash forward by value date, run settlement-delay scenarios, and flag the earliest buffer breach | Daily cash curve with a traceable risk queue |
What to automate
Reconcile unrestricted opening cash
On the Treasury reporting schedule, ingest bank snapshots and the relevant ledger balance with the entity, account, value date, and statement timestamp. Map each account to the Treasury controller’s approved cash classification and separate restricted cash. Compare bank and ledger cash after documented timing items. Place stale balances and unexplained differences on a reconciliation register, and show the timestamp and affected accounts alongside any held or provisional forecast.
Calculate available headroom by warehouse facility
Load outstanding advances, approved facility terms, and eligible collateral into a facility ledger keyed by facility and loan. At the cutoff, apply the approved credit limit, borrowing base, aging and concentration rules, and reserves. Reconcile the advance balance with the lender statement and flag loans or terms that lack an effective rule. Provide drawable capacity by eligible loan type to the Treasury manager and display it separately from available cash.
Schedule funding demand by value date
Pull the closing calendar from the funding desk and any expected-volume forecast on the same cutoff. Select the current version of each scheduled loan and label expected deals distinctly. Use the approved advance assumptions to calculate gross loan funding, expected draw, and the residual lender contribution by value date. Send missing dates, amounts, and facility assignments to the funding desk. Keep commitments, probabilities, and cash amounts visible at the loan level.
Prepare draw packages and reconcile release acknowledgements
Assemble the proposed draw amount and supporting references from the approved funding packet. Give the authorized cash approver a queue showing bank instructions, funding date, and expected draw. Record request, approval, transmission, acknowledgement, and payment status under a stable draw ID. Match the bank and facility confirmations before marking the funding complete. If delivery status is unclear, reconcile the original request with the facility or bank before resubmitting.
Match investor settlement and warehouse payoff
Match purchase advice, facility payoff, and bank receipt using the loan ID, facility ID, settlement ID, and bank reference. Keep gross proceeds and repayments as separate dated events. Split partially matched receipts from confirmed settlements, and put unexplained timing or amount differences in a Treasury exception queue. Supply Finance with the matched source records for each confirmed repayment and leave partial positions visible until resolved.
Roll cash forward and surface the earliest buffer breach
Build a daily calendar from approved opening unrestricted cash and the signed cash movements at each value date. Track actual, confirmed, and expected movements separately. Apply settlement-delay scenarios using approved timing assumptions and show the earliest date below the internal buffer for each scenario. Give Treasury a dated exception containing the affected events, balance, threshold, and owner. Rerun on new settlement evidence and retain the earlier forecast and trigger.
Store gross cash events and derive a net view
Use a stable event ID, legal entity, loan ID where applicable, facility ID, value date, currency, signed amount, and state for every forecast event. Keep scheduled, approved, sent, acknowledged, settled, and failed statuses distinct. When an actual cash event arrives, link it to the forecast event and mark the forecast superseded so the roll-forward counts the cash once.
Model borrower funding as an outflow and the facility advance as a separate inflow. Model investor cash as an inflow and warehouse principal repayment as a separate outflow. If the parties settle net, preserve the gross breakdown for reconciliation and use the net bank event once in the cash forecast. Keep facility capacity in a separate model so it can inform a draw decision without increasing opening cash.
Use code for schedule versions, agreements, cash calculations, and idempotency. An assistant can extract candidate values from an agreement or summarize why the forecast changed, with source references. Treasury approves agreement terms, while authorized staff retain draw and payment release. A timeout sends the item to reconciliation before a second instruction can be issued.
Test a delayed investor settlement
This example assumes synthetic unrestricted opening cash of $1,000,000 and an internal buffer of $950,000.
| Value date | Cash movement | Running cash |
|---|---|---|
| Monday | $500,000 loan funded and $475,000 warehouse advance received | $975,000 |
| Tuesday | $50,000 operating payment | $925,000 |
| Wednesday | $510,000 investor settlement less $475,000 warehouse repayment | $960,000 |
The cash trough is $925,000 on Tuesday, $25,000 below the buffer, even though cash ends above the buffer on Wednesday. Moving the settlement and associated payoff to Thursday extends the breach by a day. If Treasury holds the payoff date fixed in the delay scenario, the forecast should show the resulting larger interim outflow separately. Test a partial receipt, a changed closing date, and an ambiguous bank acknowledgement using the same fixture.
Compare against the current Treasury run
Replay a signed forecast and reconcile opening cash, facility balances, actual advances, investor receipts, and repayments. Compare forecast error by horizon and funding status, active preparation and exception minutes, missed cutoffs, and the time between a risk flag and the earliest affected cash date. Keep cases with stale statements, unauthorized facility data, or fallback work in the denominator.
Implement the draw-to-payoff ledger
Use three separate inputs: the bank balance at a verified timestamp, the facility position at its lender cutoff, and a timeline of forecast and confirmed movements. A facility commitment is a borrowing constraint. Only actual cash events change confirmed bank cash.
- Register the opening snapshot. Record entity, account, currency, restriction class, ledger timestamp and bank availability timestamp. Reconcile outstanding deposits and payments using their expected value dates. Keep restricted balances outside unrestricted headroom.
- Create one gross event per leg. Store
event_key, loan_id, facility_id, value_date, kind, signed_cents, status, external_ref, supersedes_id. A funding event and its associated advance are two separate legs. The same applies to investor proceeds and warehouse payoff. Match bank evidence against the intended leg before promoting it to confirmed. - Calculate facility headroom under the contract. Start with outstanding principal and drawable commitment. Apply the authorized eligibility, advance rate, aging, facility haircut and concentration rules for the snapshot. Keep policy versions and reason codes per rejected loan. Prevent the same loan from reserving headroom at two facilities.
- Forecast scenarios without overwriting actuals. Shift only the legs affected by the scenario and document any causal dependency. If the payoff requires confirmed investor proceeds, shift both in a delayed-proceeds scenario. Model earlier mandatory repayment separately. Review same-day intraday liquidity if release timing precedes expected receipt.
- Prepare instructions and reconcile before retry. Bind each draw, payoff or wire to an approval and unique business reference. Write the intended action to a queue with a pending status. After a timeout use that reference to look up the bank or warehouse response. The funding desk resolves ambiguity before the next send.
Reproduce the liquidity floor and delayed settlement
from collections import defaultdict
def cash_curve(opening, events, dates):
movement = defaultdict(int)
seen = set()
for event_id, date, signed_amount in events:
if event_id in seen:
raise ValueError(f"Duplicate movement: {event_id}")
seen.add(event_id)
movement[date] += signed_amount
balance, output = opening, {}
for date in dates:
balance += movement[date]
output[date] = balance
return output
dates = ["Mon", "Tue", "Wed", "Thu"]
base = [
("fund", "Mon", -500_000), ("draw", "Mon", 475_000),
("ops", "Tue", -50_000), ("investor", "Wed", 510_000),
("payoff", "Wed", -475_000),
]
delayed = [
(key, "Thu" if key in {"investor", "payoff"} else day, amount)
for key, day, amount in base
]
base_curve = cash_curve(1_000_000, base, dates)
stress = cash_curve(1_000_000, delayed, dates)
assert list(base_curve.values()) == [975_000, 925_000, 960_000, 960_000]
assert [day for day in dates if stress[day] < 950_000] == ["Tue", "Wed"]
In production, run by currency in integer minor units. Compare actual versus predicted value dates and amounts by leg, and assign the risk queue to the treasury owner before the earliest breach cutoff.
Implement the work step by step
Build the cash event ledger before the forecast. Keep forecast, requested, acknowledged and settled legs distinct. Replace matched legs rather than counting both. Require current facility policy, reconciled opening cash and the existing approval workflow for payment instructions.
TR-01 · Establish opening cash and funding perimeter
TR-01.01Inventory bank accounts, entities and currencies. Join active entity/account/currency records to approved perimeter. Read Bank statements, ledger cash accounts, entities and calendar. Record Cash account inventory. Owner Treasury Controller accepts the opening cash basis. Check Exclude out-of-perimeter account.TR-01.02Classify unrestricted cash, restricted balances and escrow. Apply effective-dated cash restrictions. Read Bank statements, ledger cash accounts, entities and calendar. Record Unrestricted, restricted and escrow breakdown. Owner Treasury Controller accepts the opening cash basis. Check Exclude restricted balance from drawable cash.TR-01.03Align bank, ledger and loan references and cutoffs. Normalize account and loan IDs, currencies and as-of timestamps. Read Bank statements, ledger cash accounts, entities and calendar. Record Comparable bank and ledger snapshot. Owner Treasury Controller accepts the opening cash basis. Check Reject mismatched cutoffs.TR-01.04Tie the opening cash to bank evidence. Tie each opening amount to statement and control total. Read Bank statements, ledger cash accounts, entities and calendar. Record Reconciled opening cash. Owner Treasury Controller accepts the opening cash basis. Check Inject a $1 bank tie-out difference.TR-01.05Route stale or duplicate feeds. Detect missing, duplicate and stale feed records. Read Bank statements, ledger cash accounts, entities and calendar. Record Held or accepted manifest. Owner Treasury Controller accepts the opening cash basis. Check Distinguish valid empty feed from failed delivery.
TR-02 · Maintain facilities and available headroom
TR-02.01Version limits, advance rates, eligibility, concentration, covenants and cutoff rules. Version approved limit, eligibility, advance and covenant terms with effective dates. Read Executed facility agreements, draws, collateral, limits and reserves. Record Approved facility policy. Owner Treasury manager approves agreement interpretation and headroom. Check Replay an amendment without rewriting a prior cutoff.TR-02.02Load draws, reserves and collateral. Ingest draw, reserve and collateral balances at cutoff. Read Executed facility agreements, draws, collateral, limits and reserves. Record Facility use and collateral snapshot. Owner Treasury manager approves agreement interpretation and headroom. Check Reject duplicate draw or collateral ID.TR-02.03Calculate drawable headroom by facility and loan type. Compute capacity under the tightest applicable rule. Read Executed facility agreements, draws, collateral, limits and reserves. Record Drawable headroom by facility and loan type. Owner Treasury manager approves agreement interpretation and headroom. Check Reproduce approved example with binding concentration cap.TR-02.04Flag aging and limits. Compare loan age and usage to approved thresholds. Read Executed facility agreements, draws, collateral, limits and reserves. Record Aging and limit exceptions. Owner Treasury manager approves agreement interpretation and headroom. Check Flag a simulated breach with owner.TR-02.05Retain the approved agreement and calculations. Attach agreement version and inputs to each run. Read Executed facility agreements, draws, collateral, limits and reserves. Record Reproducible headroom evidence. Owner Treasury manager approves agreement interpretation and headroom. Check Trace amount to the governing terms.
TR-03 · Forecast funding demand
TR-03.01Ingest accepted closing schedule and pipeline forecast. Load signed closing schedule and forecast to separate typed feeds. Read Approved closing schedule, capital markets expected fundings, LOS loan versions. Record As-of schedule and forecast inputs. Owner Funding desk approves date/status corrections and schedule release. Check Hold when accepted schedule is missing.TR-03.02Distinguish confirmed and expected fundings. Classify records by confirmed or expected status. Read Approved closing schedule, capital markets expected fundings, LOS loan versions. Record Funding schedule by confidence state. Owner Funding desk approves date/status corrections and schedule release. Check Expected loan cannot appear as confirmed.TR-03.03Stage gross principal, expected advance and net lender cash by value date. Derive principal, expected advance and lender cash by value date. Read Approved closing schedule, capital markets expected fundings, LOS loan versions. Record Gross and net funding schedule. Owner Funding desk approves date/status corrections and schedule release. Check Check $500k funding and $475k advance produce $25k net demand.TR-03.04Dedupe loans and loan versions. Merge revisions using loan ID, effective time and available time. Read Approved closing schedule, capital markets expected fundings, LOS loan versions. Record One current version per eligible loan. Owner Funding desk approves date/status corrections and schedule release. Check Changed date does not add a second funding.TR-03.05Reconcile totals and alert on cutoff changes. Tie counts and principal to source and detect cutoff shifts. Read Approved closing schedule, capital markets expected fundings, LOS loan versions. Record Accepted daily funding requirement. Owner Funding desk approves date/status corrections and schedule release. Check New cutoff triggers review without changing the prior run.
TR-04 · Allocate facilities and request advances
TR-04.01Test loan and facility eligibility, collateral and available headroom. Evaluate permitted product, legal entity, collateral, aging and capacity. Read Approved funding batch, facility policy, current eligibility and collateral. Record Eligible loan-facility pairs with rejection reason. Owner Treasury approves assignment and draw. Warehouse lender accepts. Check Over-limit facility is excluded.TR-04.02Compare eligible capacity and carry. Compare eligible headroom and policy-approved estimated carry. Read Approved funding batch, facility policy, current eligibility and collateral. Record Candidate facility comparison. Owner Treasury approves assignment and draw. Warehouse lender accepts. Check Candidate without usable data remains flagged.TR-04.03Propose assignments. Construct draft assignments subject to approved constraints. Read Approved funding batch, facility policy, current eligibility and collateral. Record Reviewable allocation list. Owner Treasury approves assignment and draw. Warehouse lender accepts. Check Sum of proposed draws does not exceed capacity.TR-04.04Compile the request with evidence. Render request with loan facts and source versions. Read Approved funding batch, facility policy, current eligibility and collateral. Record Draft lender package. Owner Treasury approves assignment and draw. Warehouse lender accepts. Check Record exact inputs and hash before release.TR-04.05Route for approval and capture lender acknowledgement. Enforce authorization and store request ID and acknowledgment. Read Approved funding batch, facility policy, current eligibility and collateral. Record Accepted, rejected or pending draw. Owner Treasury approves assignment and draw. Warehouse lender accepts. Check Unauthorized user cannot release a draw.TR-04.06Reconcile proposed, approved and received advances. Match proposed, approved and received amounts separately. Read Approved funding batch, facility policy, current eligibility and collateral. Record Draw exception schedule. Owner Treasury approves assignment and draw. Warehouse lender accepts. Check Partial receipt remains unresolved.
TR-05 · Release and confirm loan funds
TR-05.01Tie executed closing instructions to authorized amount, payee and value date. Compare approved payee, amount and date to closing instruction. Read Executed closing instructions, authorized payee, bank and facility responses. Record Validated payment instruction. Owner Authorized cash approvers retain release. Funding verifies bank outcome. Check Changed destination causes hold.TR-05.02Verify received draw and equity funding. Tie advance and lender cash to the funding requirement. Read Executed closing instructions, authorized payee, bank and facility responses. Record Verified sources of funds. Owner Authorized cash approvers retain release. Funding verifies bank outcome. Check Do not release with missing draw evidence.TR-05.03Route required approvals. Enforce approval workflow and retain signed decision. Read Executed closing instructions, authorized payee, bank and facility responses. Record Authorized payment request. Owner Authorized cash approvers retain release. Funding verifies bank outcome. Check Same preparer cannot bypass configured approval.TR-05.04Track bank acknowledgement. Capture bank response by instruction ID and normalize state. Read Executed closing instructions, authorized payee, bank and facility responses. Record Acknowledged or pending bank instruction. Owner Authorized cash approvers retain release. Funding verifies bank outcome. Check Timeout is not a confirmed payment.TR-05.05Resolve uncertain status before retry. Query prior receipt and reconcile before retrying an uncertain write. Read Executed closing instructions, authorized payee, bank and facility responses. Record Resolved instruction status or escalation. Owner Authorized cash approvers retain release. Funding verifies bank outcome. Check Synthetic retry cannot create a second payment.TR-05.06Match confirmation to funded status. Link confirmed payment to loan event and notify Manufacturing/Finance. Read Executed closing instructions, authorized payee, bank and facility responses. Record Confirmed funding handoff. Owner Authorized cash approvers retain release. Funding verifies bank outcome. Check Unsettled response cannot create funded event.
TR-06 · Track collateral, open advances and carry
TR-06.01Match open advance to funded loan and collateral. Join advance, funded loan and collateral IDs. Read Funded-loan list, warehouse statement, facility terms and bank references. Record Advance-to-collateral register. Owner Treasury owns exposure and approves corrections. Check Unmatched advance remains visible.TR-06.02Compare bank and facility references. Reconcile facility transaction references with bank events. Read Funded-loan list, warehouse statement, facility terms and bank references. Record Matched advance movements. Owner Treasury owns exposure and approves corrections. Check Different legal entity cannot cross-match.TR-06.03Calculate interest and fees under approved terms. Apply approved interest and fee terms with effective date. Read Funded-loan list, warehouse statement, facility terms and bank references. Record Dated carry estimate. Owner Treasury owns exposure and approves corrections. Check Reproduce sample interest from independent calculation.TR-06.04Monitor aging, curtailment and collateral exceptions. Evaluate age, curtailment and collateral rules. Read Funded-loan list, warehouse statement, facility terms and bank references. Record Owned risk and aging queue. Owner Treasury owns exposure and approves corrections. Check Threshold boundary matches facility rule.TR-06.05Compare lender statement and accrued carry. Compare calculated carry with lender statement. Read Funded-loan list, warehouse statement, facility terms and bank references. Record Carry reconciliation. Owner Treasury owns exposure and approves corrections. Check Mismatched accrual is routed, not overwritten.
TR-07 · Match purchase receipts and repay advances
TR-07.01Link purchase advice, commitment, loan and advance. Join advice, commitment, loan and advance by approved crosswalk. Read Investor advice, commitment, collateral, warehouse payoff quote and bank actual. Record Matched sale-to-facility record. Owner Treasury approves payoff. Finance owns accounting and Capital Markets owns commercial differences. Check Unmatched commitment cannot be auto-closed.TR-07.02Forecast bank credit and calculate payoff with principal, interest and fees. Separate expected bank credit, principal, accrued interest and fees. Read Investor advice, commitment, collateral, warehouse payoff quote and bank actual. Record Dated cash and payoff calculation. Owner Treasury approves payoff. Finance owns accounting and Capital Markets owns commercial differences. Check Do not net a mismatched facility.TR-07.03Route payoff for approval. Generate payoff instruction for approved authority. Read Investor advice, commitment, collateral, warehouse payoff quote and bank actual. Record Pending/approved payoff request. Owner Treasury approves payoff. Finance owns accounting and Capital Markets owns commercial differences. Check Approval required before payment.TR-07.04Confirm receipt, actual payoff and collateral release. Reconcile receipt, repayment and collateral-release acknowledgments. Read Investor advice, commitment, collateral, warehouse payoff quote and bank actual. Record Confirmed payoff and release or partial state. Owner Treasury approves payoff. Finance owns accounting and Capital Markets owns commercial differences. Check Missing release evidence keeps collateral status open.TR-07.05Route purchase amount differences to Finance and commercial differences to Capital Markets. Route variance by amount type to the owning operation. Read Investor advice, commitment, collateral, warehouse payoff quote and bank actual. Record Settlement/cash handoff with source rows. Owner Treasury approves payoff. Finance owns accounting and Capital Markets owns commercial differences. Check Finance and Capital Markets each receive their applicable discrepancy.
TR-08 · Forecast cash and manage liquidity
TR-08.01Order unrestricted movements by value date. Sort authorized cash legs by value date and currency. Read Reconciled unrestricted cash, cash events, payable calendar and facility headroom. Record Dated unrestricted event sequence. Owner Treasury Controller owns forecast and mitigation. Check Test out-of-order booking date versus value date.TR-08.02Net linked draw, loan, sale and payoff legs once. Match related gross legs and supersede with accepted actual once. Read Reconciled unrestricted cash, cash events, payable calendar and facility headroom. Record Cash flow with duplicate protection. Owner Treasury Controller owns forecast and mitigation. Check Net settlement and gross components cannot both post.TR-08.03Add approved operating flows. Merge approved operating obligations and receipts. Read Reconciled unrestricted cash, cash events, payable calendar and facility headroom. Record Cash outlook including operating flows. Owner Treasury Controller owns forecast and mitigation. Check Proposed payable is not marked committed.TR-08.04Stress delayed receipts and changed fundings. Move modeled dates under delay and changed-funding scenarios. Read Reconciled unrestricted cash, cash events, payable calendar and facility headroom. Record Separate base and stress curves. Owner Treasury Controller owns forecast and mitigation. Check Scenario leaves the base curve unchanged.TR-08.05Compare trough to internal buffer and drawable headroom. Compare earliest trough with internal buffer and separate available capacity. Read Reconciled unrestricted cash, cash events, payable calendar and facility headroom. Record Dated shortfall alert. Owner Treasury Controller owns forecast and mitigation. Check A later recovery cannot hide an earlier breach.TR-08.06Record approved mitigation and variance. Record decision owner, mitigation, and actual versus forecast variance. Read Reconciled unrestricted cash, cash events, payable calendar and facility headroom. Record Signed action and forecast history. Owner Treasury Controller owns forecast and mitigation. Check Mitigation stays proposed until approval.
TR-09 · Reconcile Treasury close and monitor compliance
TR-09.01Tie bank, facility, loan and GL balances. Reconcile each control source with cutoff and entity checks. Read Bank, facility, funded-loan and GL balances, facility agreement, open exception register. Record Four-way reconciled schedule. Owner Treasury and Finance sign reconciliation. Compliance owner approves regulated outputs. Check Inject omitted draw and verify break.TR-09.02Investigate unreconciled principal, interest and fees. Isolate amount components and link contributing events. Read Bank, facility, funded-loan and GL balances, facility agreement, open exception register. Record Principal, interest and fee exception evidence. Owner Treasury and Finance sign reconciliation. Compliance owner approves regulated outputs. Check Do not use net change to hide offsetting errors.TR-09.03Roll open exceptions forward with owners. Carry forward unclosed exceptions with owner and age. Read Bank, facility, funded-loan and GL balances, facility agreement, open exception register. Record Stable exception queue. Owner Treasury and Finance sign reconciliation. Compliance owner approves regulated outputs. Check Closed exception does not recur absent new evidence.TR-09.04Prepare required lender or covenant reports. Prepare required report from governed schedule and approved definition. Read Bank, facility, funded-loan and GL balances, facility agreement, open exception register. Record Draft covenant/lender report. Owner Treasury and Finance sign reconciliation. Compliance owner approves regulated outputs. Check Manual approval retained and stale rule rejected.TR-09.05Retain cutoff, review and signoff evidence. Archive reconciled inputs, cutoff and approval version. Read Bank, facility, funded-loan and GL balances, facility agreement, open exception register. Record Reproducible close evidence. Owner Treasury and Finance sign reconciliation. Compliance owner approves regulated outputs. Check Prior period can be rerun without using later data.
Build it yourself with AI
Prototype the cash view before automating any payments
Create synthetic opening_cash.csv, cash_events.csv, and facility_rules.yml. Use separate columns for event ID, loan ID, facility ID, value date, signed amount, confirmation state, and source reference. Have Treasury set the internal buffer and calendar convention in cash_policy.md. Run the prototype against local files without bank or facility credentials.
Prompt 1. Design the ledger and checks
Review the fixtures, facility_rules.yml, and cash_policy.md. Propose a ledger that keeps loan fundings, draws, settlements, repayments, and operating payments as distinct events. Specify checks for duplicate IDs, unsupported cash status, missing dates, and unmatched settlement or draw references. Identify every decision the policy leaves to Treasury.
Prompt 2. Write the forecast and scenario runner
Implement a Python or SQL workflow that builds the daily unrestricted cash curve from opening cash and signed events by value date. Keep facility headroom in a separate output. Produce base and settlement-delay scenarios, earliest breach dates, and an exception CSV with owner, source reference, and reason. Use decimal arithmetic and create no payment, draw, or bank integration.
Prompt 3. Produce the Treasury review playbook
Draft a checklist for confirming opening cash, reviewing facility headroom, matching settlement receipts, and verifying the first day below buffer. Include how to investigate an uncertain draw without duplicating it. Use only the owners and thresholds in cash_policy.md and present any missing assignment for Treasury review.
Try it. Start Monday with $1,000,000. Record $500,000 of funding and a $475,000 draw on Monday, a $50,000 operating payment on Tuesday, and $510,000 of settlement proceeds and a $475,000 payoff on Wednesday. Closing cash should be $975,000, $925,000, and $960,000 respectively. Under a $950,000 test buffer, flag Tuesday. Then move the settlement and its paired payoff to Thursday and check that Wednesday stays at $925,000. Have the Treasury controller reconcile the prototype against a closed period before running it on the daily schedule.
Need help automating this?
See how Mage helps lending teams bring funding schedules, warehouse balances and investor settlements into a cash forecast. See Mage's mortgage cash flow forecasting solution.


