Define the sweep logic: calculate end-of-day available balance from Modern Treasury's account balance endpoint, subtract the target operating balance, and determine the sweep amount (positive for sweep-out, negative for sweep-back)
Originate the sweep-out as a payment order in Modern Treasury with direction debit, targeting the money market fund's bank account; record the payment order ID and link it to a ledger transaction that debits the operating account and credits a money market investment account
On the morning sweep-back, check the money market fund's settlement confirmation (via webhook or polling); originate a reverse payment order to pull funds back into the operating account
Post corresponding ledger transactions for the sweep-back: debit the money market investment account and credit the operating account, recording the accrued interest as a separate credit to an interest income ledger account
Implement holiday and weekend handling: do not originate sweep transfers on days when ACH is not processing; maintain a business day calendar and skip sweep origination on non-settlement days
Run a daily reconciliation that compares the money market fund's reported NAV (from the fund's statement or API) against your internal investment ledger balance; alert on any discrepancy
Known gotchas
Money market funds settle T+0 or T+1 depending on the fund and share class; if your fund settles T+1, the funds swept out today are not available for the morning sweep-back until the following business day — design the sweep-back timing to account for settlement lag
Same-day ACH cutoffs constrain when sweep transfers can be originated to be effective the same day; if the end-of-day balance calculation runs after the last Same-Day ACH window, the sweep will settle the following business day
Interest income from the money market fund may arrive as a separate deposit or as an increase in share value; confirm with the fund provider which mechanism they use before designing the interest accrual ledger entries
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp