Spreadsheets are fine until the model grows. When the same liquidity calculation runs every day across many entities, a few lines of Python pay for themselves quickly. Here is a small worked example that mirrors the LCR logic.
Start with a cash ladder. Each row is a bucket of outflow with a category that drives its run off rate.
import pandas as pd
ledger = pd.DataFrame({
"category": ["retail", "retail", "wholesale", "facility"],
"amount": [500_000, 250_000, 400_000, 300_000],
})
run_off = {"retail": 0.05, "wholesale": 1.0, "facility": 0.10}
ledger["run_off"] = ledger["category"].map(run_off)
ledger["outflow"] = ledger["amount"] * ledger["run_off"]
The Liquidity Management course walks through this end to end.
Now the coverage number. HQLA sits on one side, stressed outflows on the other.
hqla = 900_000
net_outflows = ledger["outflow"].sum()
lcr = hqla / net_outflows
print(f"LCR: {lcr:.0%}")
The point is not the arithmetic. It is that the run off rates now live in one dictionary you can version, test and reuse, rather than buried in a cell reference.
From here the path is obvious. Pull the ledger from your warehouse instead of hard coding it, load the run off rates from a config table the risk team owns, and write the result to a dashboard. The calculation stays readable, and the assumptions stay auditable.
That is the real win. Not speed, but a model a reviewer can actually follow.
The Liquidity Management course walks through this end to end.
Get the next one in your inbox
A weekly note on treasury, liquidity and practical Python. No spam, unsubscribe any time.
Practitioner notes on treasury, liquidity, regulatory reporting and practical Python.
