Funding a loan book: equity, debt, warehouse facilities, securitisation
A lender is a machine that turns other people's money into loans. The funder lends against the book, not against your plans, and the borrowing base is where its trust is tested every month
On 30 June 2026 Owoleaf's loan book has ₦438,468,149 of principal outstanding. ₦433,653,464 of it is not more than 30 days late. The funder advances 80% of eligible loans, but SME loans may be at most 70% of the eligible pool, and 77% of the eligible pool is SME. What is the borrowing base?
Where the money in a loan book comes from
A loan book is an asset. Someone paid for it. In the economics of a loan the cost of funds was one number, 18% a year, a placeholder the lab chose. This chapter opens that number. Three kinds of money sit behind a book, and each costs something different and asks for something different in return.
| Source | What it is paid | What it takes | What goes wrong |
|---|---|---|---|
| Equity | A share of the profits, and of the sale if there is one | Ownership, and often a say in how the business runs | It is the dearest money. A founder who funds every naira lent with equity is diluted before the book is large |
| Corporate or venture debt | Interest, plus sometimes the right to buy shares later (a warrant) | A promise to repay from the company’s cash, often with a charge over its assets | A lender to the company is repaid by the company. If the book loses money, the loan does not shrink with it |
| Asset-backed debt (a warehouse facility, later a securitisation) | Interest on what is drawn, set against the pool of loans | A charge over the loans, rules on which loans count, and reports | Rules that look like a formality turn out to set how much you can borrow |
Equity absorbs loss first. It is the cushion that makes every other kind of money safe to lend. A lender’s question, at every level of this chapter, is how much equity sits under me.
Venture debt is a loan to a company that investors have already backed, sized from the equity it has raised rather than from the loans it has made. A lender takes a charge over the company’s assets and often a warrant (the right to buy a small number of shares at a fixed price). It does not look at the loan book loan by loan. That makes it quick to arrange and poor at scaling: it is repaid from the company, so it is limited by the company’s balance sheet and not by the book.
A warehouse facility is the form that scales with the book. The lender advances a share of the loans’ value, the loans are the main security, and the amount available moves as the book moves. It is called a warehouse because the loans are held in it, like goods, until something larger (a bond sold to investors, a sale of the loans, or repayment alone) takes them out.
The anatomy of a warehouse facility
Five terms define the machine. All the figures in this chapter’s lab are invented for it, and are labelled so in the code.
- The commitment (the limit): the most the lender will ever have out. The lab’s is ₦250,000,000.
- The advance rate: the share of eligible loans the lender will fund. The lab’s is 80%. The other 20% is the owners’ equity in the pool, the first loss: the layer that takes losses first.
- Eligibility criteria: which loans count. A loan more than 30 days past due does not count, and nor does a defaulted one. A loan can also be ineligible for its product, tenor or borrower.
- Concentration limits: how much of the eligible pool may come from one product, borrower, employer or state. A loan inside the limit counts. A loan above it does not.
- The borrowing base: advance rate × eligible receivables after concentration limits. You may draw the lower of the commitment and the borrowing base.
Around those sit the reports and the promises. Each month the borrower signs a borrowing base certificate, a statement of the pool, its eligible part and the base, backed by a data tape of every loan. If the base falls below what is drawn, the difference is a borrowing base deficiency, and the borrower repays it, normally within days. The lender usually has the right to audit the tape. The pool is often held in a special purpose vehicle (SPV), a company that owns the loans and borrows against them, so that the lender’s claim does not depend on the originator’s other debts. The originator keeps collecting the loans as servicer for a fee. Everything else is negotiation.
The picture is the point of the chapter. The advance rate is 80%, the amount funded is 57.0% of the gross book, and the owners’ equity in the book is 43.0%. The gap is made by a concentration limit and a commitment, and neither shows in the headline rate.
Why the cap bites harder than the advance rate
A concentration limit is stated as a share of the final pool: SME loans at most 70% of what the funder counts. The calculation has a trap, and it is the kind that finds its way into a first certificate. Suppose the eligible pool is E, of which S is SME. The tempting excess is S − 0.7 × E, the SME above 70% of today’s pool. Remove it and the pool is smaller, so the SME share of what is left is higher than 70% again. The right calculation fixes the non-SME loans O = E − S and asks how much SME fits beside them: S′ = 0.7 ÷ 0.3 × O. On 30 June that is 7 ÷ 3 × ₦99,709,685 = ₦232,655,931, an excess of ₦101,287,848. The wrong formula takes out only ₦30.4m and leaves a pool that is still 75.3% SME. Lab step 3 prints the right one.
The cap is the biggest lever in this book, because Owoleaf’s lending is SME-heavy by value: 439 open SME loans are ₦333.9m of the ₦438.5m. That is a fact of this generated book, set in loans.py, where SME loans go to ₦5m and the others are small. A funder’s credit team would see it on the data tape in the first hour. Lab step 4 tests it. With no cap the base is ₦346.9m, and at 70% it is ₦265.9m. Moving the advance rate by five points moves it ₦16.6m. Moving the cap by ten points, from 70% to 60%, moves it ₦66.5m.
What a covenant is
A covenant is a promise the borrower makes in the agreement. There are three kinds, and a facility has all of them.
- Eligibility and base tests, as above: a base below the amount drawn is a deficiency, cured by repaying.
- Portfolio covenants, measured on the pool: portfolio at risk over 30 days (PAR30, from portfolio metrics) at most 8% of the pool, and loans 90 days or more past due at most 4%. The lab’s thresholds are invented.
- Financial covenants, measured on the company: a minimum of equity, a maximum of debt to equity, a minimum of cash. The lab does not model these, because the book does not carry Owoleaf’s balance sheet.
A trigger is different. It is an early-warning line, below the covenant, whose crossing changes how the facility works. A common one stops new advances and sweeps collections to the lender. A trigger crossed is not a default. A covenant breached is an event of default, which lets the lender stop advances and demand repayment unless it waives the breach, usually for a fee and a tighter term. The skill in a negotiation is that these are different words for different remedies, and the number matters less than what happens when the line is crossed.
Two things go wrong with a PAR covenant. First, it is a ratio, and a shrinking pool moves ratios. This generated book stops lending on 30 June, so after that every good loan repays and leaves, and the late ones stay. PAR30 is about ₦4.8m of ₦438.5m on 30 June, 1.1%, and about ₦15.7m of ₦135.9m on 30 September, 11.5%. The late balance more than tripled; the pool fell to 31% of its size. A real warehouse has a revolving period: new loans refill the pool, and the ratio is held down by growth. A lender that stops originating, or a lender whose growth slows, feels the covenant tighten with no new bad loans. Second, the covenant counts the lender’s own definition: a loan 30 days late is counted where a customer who paid on day 29 is not. Check whether a payment on day 30 counts as late, and how the agreement counts a restructured loan, before any number is agreed. The lab uses the days past due rule of the loan lifecycle.
A breach has three usual cures. The borrower can repay enough to bring the base back over what is drawn. It can repurchase the late loans at par, paying cash for them so the ratio improves: the lab prints the amount needed. Or it can ask the lender for a waiver. The first two need cash on the day the certificate is due. That is the connection to treasury, which treasury for a lender, the next chapter, treats in full.
What leverage does, and what it costs
Funding is not free because the lender asks for less than the owners do. Look at 30 June. Of ₦438.5m of book, ₦250.0m (57.0%) is debt, at 22% interest plus a 1.5% arrangement fee spread over a year: 23.5%. The other ₦188.5m (43.0%) is equity at the 30% the owners want. The blended cost of funds is (250.0 × 23.5% + 188.5 × 30%) ÷ 438.5 = 26.29% a year. For a 30-day loan that is 26.29% × 30 ÷ 365 = 2.16%, against the 1.48% the economics chapter used at 18%. The 0.68-point difference lands on a salary advance that charges 6% in all. The figures are invented, and the shape is not: a lender that borrows at 80% of what it counts but has only 57% funded pays the owners’ return on the rest, so the effective advance rate, not the headline one, sets the cost. Unit economics of a lending business, later in this module, uses a cost of funds as an input and reads it from here.
Leverage also moves risk. At 80% the owners’ 20% layer absorbs losses first: a pool loss of up to 20% of eligible loans is theirs, and the lender is paid in full. That is why the lender asks for it. It is also why a book with fat margins and one bad month can lose the owners their whole equity while the lender loses nothing. Funders do not care about the owners’ return. They care about the pool’s worst realistic month.
Securitisation: the same idea cut into layers
A warehouse has one lender and one line. A securitisation sells the pool, or the right to its cash flows, to a vehicle that issues notes to investors, in layers called tranches. The senior tranche is paid first and loses last. The mezzanine sits below it. The first-loss (equity) tranche is paid last and loses first. Losses on the pool fall from the bottom, and cash goes down from the top. The structure is rated, sold, and priced layer by layer, so it can cost the owners less than a warehouse, once the book is large and has a track record. A common route is a warehouse first, then a term securitisation that takes the loans out of it.
The lab cuts the 30 June pool into a 75% senior, a 10% mezzanine and a 15% first-loss layer (invented). It then loses the principal that was unpaid at the cut-off on every loan 90 or more days late: ₦13,599,354, or 3.1% of the pool. The first-loss layer takes it all, 20.7% of itself, and the senior and mezzanine lose nothing. At five times that loss, 15.5% of the pool, the first-loss layer is gone and the mezzanine has lost 5.1%. This is the pool’s bad month in a form a buyer can price. It is also an observation that applies to the lab’s data and not to securitisation: those loans have not all had time to default, and the pool’s SME loans (about 3 of every 4 naira) set the result.
What Nigeria says
Five facts set the frame for funding in Nigeria. Each rests on search results, not on the text of the rule, as the notes say, and none is advice about which instrument to use.
The Securities and Exchange Commission’s (SEC) Rules on Securitisation (2015), as search results quoting the text and law-firm summaries describe them, define asset-backed securities as certificates issued by a special purpose vehicle and repaid from the cash flow of a pool of assets, and require the SPV to be a public limited liability company, a trust created by written instrument or another entity the Commission permits, with SPV in its nameas of 2026-11. One legal practice guide says asset-backed securitisation has yet to gain wide acceptance in Nigeria, describes the Rules as amended, and lists the Investments and Securities Act 2025 among the governing instruments. The search results did not show the amendments or whether a lender’s consumer receivables fall within the Rules. The current text, and what the 2025 Act changed, are for the source and for legal advice to say.
The SEC’s December 2024 rules on commercial paper, as search results summarise them, define an issuing and placing agent as an SEC-registered issuing house or financial adviser. Search results about the FMDQ Exchange’s (FMDQ) commercial paper registration and quotation rules add that the agent must be an FMDQ registration member and that the rating agency must be recognised by the SEC; one commentary still describes the SEC requirement as proposed, so confirm against the executed textas of 2026-11. Commercial paper is short-term debt (the lab’s loans run for months, so a lender’s funding must match them: the next chapter). The FMDQ rules are at https://fmdqgroup.com/exchange/download/150/rules-market/6928/commercial-paper-registration-and-quotation-rules.pdf; search results showed more than one version, so check which is current.
A lender that takes a charge over its loans must register it. Two registers appear in the search results.
The Secured Transactions in Movable Assets Act 2017 set up a National Collateral Registry within the Central Bank of Nigeria. Search results, mostly law-firm commentary, report that a security interest in movable assets is perfected when a financing statement is filed and registered thereas of 2026-11. The section number (commentary says section 8) and the details come from that commentary, not from the Act’s text in the results. For a charge created by a company, the search results also describe law-firm commentary saying the Companies and Allied Matters Act 2020 (CAMA) keeps the rule that a charge is filed with the Corporate Affairs Commission within 90 days of its creation, and that a charge not filed is void against a liquidator and other creditors:
a law firm’s summary, not the Act, says the 90-day filing rule continues in CAMA 2020, and that the Commission’s total fees for filing, registering or releasing a charge are capped at 0.35% of the charge’s value unless the Minister sets another amountas of 2026-11. Other commentary puts the rule in different sections (222 in some, 209 in others) and says the two regimes rank priority differently, by date of registration under the 2017 Act and by date of creation, if filed in time, under CAMA. Check both against the Acts, and take legal advice on which applies to a given structure.
Last, funding does not only come from investors. A development bank can lend to a lender.
The Development Bank of Nigeria describes itself, on its website, as a wholesale lender that works through participating financial institutions. Its finance-to-finance on-lending scheme is described, in the search results, as for institutions that lend to micro, small and medium enterprises, with qualifying institutions listed as microfinance banks, microfinance institutions, financial NGOs, cooperatives, fintech companies and other non-bank financial institutions, for periods of up to 7 years, alongside a separate long-term productas of 2026-11. The results gave two different counts of participating institutions (25 on the bank’s own page, 29 in a press report), on pages with unclear dates. They do not say whether a given licence category qualifies or what the lender must meet: those are in the bank’s own criteria. Whether any of these routes suits a particular lender depends on its licence, which licences and structures, later in this module, treats.
Where it goes wrong
- Reading the advance rate as the share funded. The effective rate is debt divided by the gross book: 57.0% here, not 80%.
- A cap computed on today’s pool. Cap the final pool, not today’s, or the share is still above the cap after the excess comes out.
- Signing a certificate nobody has rebuilt. The first certificate is the first time the definition runs on real data. Run it on history before you sign.
- A covenant measured on a shrinking pool. A ratio rises when the denominator falls. Ask what the number was at the lowest point of the book’s size.
- No cash for a cure. A deficiency or a repurchase is owed in days. Plan where the cash comes from, including the case where collections are late too.
- Reading a stress as a forecast. The lab’s stress changes how loans are classed, not what borrowers pay. It finds a covenant, not a result.
- Buying funding on its headline price. Fee, undrawn-commitment charge, covenants, reporting duty and the cure rights are the price too.
You work in labs/finance. Every script reads data1/finance.sqlite and changes nothing. Every term of the facility is invented, and the code says so. Money is integer kobo.
1. Build and check the scale 1 book. If data1/ does not exist, build it with the README’s command (about 40 seconds). Then check it.
cd labs/finance
python3 generate.py --scale 1 --out data1 && python3 loans.py --out data1 \
&& python3 cards.py --out data1 && python3 collect.py --out data1
python3 check.py --db data1/finance.sqlite
python3 - <<'PY'
import sqlite3
db = sqlite3.connect("data1/finance.sqlite")
print(db.execute("SELECT COUNT(*) FROM loans").fetchone()[0], "loans,", db.execute("SELECT COUNT(*) FROM schedule").fetchone()[0], "instalments,", db.execute("SELECT COUNT(*) FROM repayments").fetchone()[0], "repayments")
print(", ".join(f"{p} {n}" for p, n in db.execute("SELECT product, COUNT(*) FROM loans GROUP BY 1 ORDER BY 1")))
print("cut-off", db.execute("SELECT value FROM loan_book_meta WHERE key = 'cut_off'").fetchone()[0])
PYcheck.py takes about 30 seconds and ends with OK: all invariants hold. The query prints:
3645 loans, 10735 instalments, 8457 repayments
BNPL 766, PL 451, SAL 1959, SME 469
cut-off 2026-10-282. Save the facility’s terms and a rebuilt book. Save this as facility.py. The Book class rebuilds days past due and principal outstanding on any date from the schedule and the repayments, counting only payments made by that date (the rule from the portfolio metrics chapter). pool returns the open loans on a date. borrowing_base is the funder’s test.
"""A warehouse facility on Owoleaf's loan book: terms, snapshots and the borrowing base.
Every term below is ILLUSTRATIVE: invented for this chapter, not any lender's, not the CBN's.
Money is integer kobo throughout. The scripts only read data1/finance.sqlite.
"""
import sqlite3
from collections import defaultdict
from datetime import date
DB = "data1/finance.sqlite"
# ---- the facility's terms (ILLUSTRATIVE)
LIMIT = 25_000_000_000 # commitment: ₦250,000,000
ADVANCE_BPS = 8000 # advance rate: 80% of eligible receivables
MAX_DPD = 30 # eligible only if not more than 30 days past due
SME_CAP_BPS = 7000 # SME loans may be at most 70% of the eligible pool
INTEREST_BPS = 2200 # 22% a year on what is drawn
ARRANGEMENT_BPS = 150 # 1.5% of the limit, paid once
COV_PAR30_BPS = 800 # covenant: loans over 30 days late at most 8% of the pool
COV_NPL_BPS = 400 # covenant: loans 90+ days late at most 4% of the pool
EQUITY_COST_BPS = 3000 # what Owoleaf's owners want on the equity in the book: 30% a year
WRITE_OFF_DPD = 180 # loans.py's write-off line: a written-off loan leaves the pool
SERVICE_KOBO = 80_000 # ₦800 to serve one loan, as in the economics chapter
DATES = [date(2026, 6, 30), date(2026, 7, 31), date(2026, 8, 31), date(2026, 9, 30), date(2026, 10, 28)]
def naira(kobo):
sign = "-" if kobo < 0 else ""
kobo = abs(kobo)
return f"{sign}₦{kobo // 100:,}"
def pct(num, den):
return f"{100 * num / den:.1f}%" if den else "n/a"
class Book:
def __init__(self, path=DB):
db = sqlite3.connect(f"file:{path}?mode=ro", uri=True)
self.loans = {}
for lid, product, principal, disbursed in db.execute(
"SELECT id, product, principal_kobo, disbursed_at FROM loans ORDER BY id"):
self.loans[lid] = dict(id=lid, product=product, principal=principal,
disbursed=date.fromisoformat(disbursed), due=[],
received=defaultdict(list), principal_paid=[])
for lid, n, due, total in db.execute(
"SELECT loan_id, instalment, due_date, total_kobo FROM schedule ORDER BY loan_id, instalment"):
self.loans[lid]["due"].append((n, date.fromisoformat(due), total))
self.payments = [] # (date, loan id, principal kobo, other kobo)
for lid, n, paid_at, amount, fee, principal in db.execute(
"SELECT loan_id, instalment, paid_at, amount_kobo, late_fee_kobo, principal_kobo FROM repayments"):
d = date.fromisoformat(paid_at)
self.loans[lid]["received"][n].append((d, amount - fee))
self.loans[lid]["principal_paid"].append((d, principal))
self.payments.append((d, lid, principal, amount - principal))
def state(self, loan, on):
"""(days past due, principal outstanding) on a date, from payments made by that date."""
if loan["disbursed"] > on:
return None
outstanding = loan["principal"] - sum(k for d, k in loan["principal_paid"] if d <= on)
oldest = None
for n, due, total in loan["due"]:
if due < on and sum(k for d, k in loan["received"][n] if d <= on) < total:
oldest = due
break
return ((on - oldest).days if oldest else 0), outstanding
def pool(self, on, shock_days=0):
"""Open loans on a date as (id, product, dpd, outstanding). The stress adds shock_days
to every loan that is already late. A loan at the write-off line leaves the pool."""
rows = []
for loan in self.loans.values():
s = self.state(loan, on)
if not s or s[1] == 0:
continue
dpd, out = s
if dpd >= 1:
dpd += shock_days
if dpd >= WRITE_OFF_DPD:
continue
rows.append((loan["id"], loan["product"], dpd, out))
return rows
def borrowing_base(rows, advance_bps=ADVANCE_BPS, sme_cap_bps=SME_CAP_BPS, max_dpd=MAX_DPD):
"""The funder's test of one date. Returns a dict of the steps, all in kobo."""
gross = sum(o for _, _, _, o in rows)
late30 = sum(o for _, _, d, o in rows if d >= 30)
npl = sum(o for _, _, d, o in rows if d >= 90)
eligible = [(p, o) for _, p, d, o in rows if d <= max_dpd]
e_all = sum(o for _, o in eligible)
sme = sum(o for p, o in eligible if p == "SME")
# Cap SME at a share c of the FINAL pool: S' / (S' + others) <= c gives S' = c / (1 - c) x others.
others = e_all - sme
sme_ok = sme if sme_cap_bps >= 10_000 else min(sme, sme_cap_bps * others // (10_000 - sme_cap_bps))
capped = others + sme_ok
return dict(gross=gross, late30=late30, npl=npl, eligible=e_all, sme=sme,
excess=sme - sme_ok, capped=capped, base=capped * advance_bps // 10_000)python3 -c "import facility; print(facility.naira(facility.LIMIT), facility.DATES[0])"₦250,000,000 2026-06-303. The borrowing base on 30 June. Save this as base_at.py.
from facility import *
book = Book()
on = DATES[0]
rows = book.pool(on)
b = borrowing_base(rows)
print(f"Borrowing base on {on}")
print(f" open loans in the pool {len(rows):>6}")
print(f" gross principal outstanding {naira(b['gross']):>16}")
print(f" more than 30 days late {naira(b['gross'] - b['eligible']):>16} (ineligible)")
print(f" eligible before the SME cap {naira(b['eligible']):>16} SME is {pct(b['sme'], b['eligible'])} of it")
print(f" excess SME over the cap {naira(b['excess']):>16}")
print(f" eligible after the cap {naira(b['capped']):>16}")
print(f" x advance rate {ADVANCE_BPS / 100:.0f}% {naira(b['base']):>16} the borrowing base")
print(f" commitment {naira(LIMIT):>16}")
avail = min(LIMIT, b["base"])
print(f" can draw {naira(avail):>16} = {pct(avail, b['gross'])} of the gross book")
print(f" owners' equity in the book {naira(b['gross'] - avail):>16} = {pct(b['gross'] - avail, b['gross'])}")python3 base_at.pyBorrowing base on 2026-06-30
open loans in the pool 2369
gross principal outstanding ₦438,468,149
more than 30 days late ₦4,814,684 (ineligible)
eligible before the SME cap ₦433,653,464 SME is 77.0% of it
excess SME over the cap ₦101,287,848
eligible after the cap ₦332,365,616
x advance rate 80% ₦265,892,493 the borrowing base
commitment ₦250,000,000
can draw ₦250,000,000 = 57.0% of the gross book
owners' equity in the book ₦188,468,149 = 43.0%Check it by hand. The cap removes ₦433,653,464 − ₦332,365,616 = ₦101,287,848. The non-SME loans are 30% of the capped pool, ₦99,709,685, so SME may be 7 ÷ 3 of that, ₦232,655,931. 80% of ₦332,365,616 is ₦265,892,493. The commitment is lower, so the draw is ₦250,000,000: 57.0% of the gross book, and the owners’ ₦188,468,149 is 43.0%.
4. Move the two levers. Save this as levers.py. The cap and the advance rate each set the base. It prints the base in ₦ million.
from facility import *
book = Book()
rows = book.pool(DATES[0])
gross = sum(o for _, _, _, o in rows)
print("Borrowing base on 2026-06-30 (₦ million), by SME cap (down) and advance rate (across)")
rates = (7000, 7500, 8000, 8500)
print(f" {'SME cap':>8}" + "".join(f"{r / 100:>8.0f}%" for r in rates) + " effective advance rate at 80%")
for cap in (10_000, 8000, 7000, 6000, 5000):
cells = []
for r in rates:
b = borrowing_base(rows, advance_bps=r, sme_cap_bps=cap)
cells.append(b["base"] / 100 / 1_000_000)
b = borrowing_base(rows, sme_cap_bps=cap)
print(f" {cap / 100:>7.0f}%" + "".join(f"{c:>9.1f}" for c in cells) + f" {pct(b['base'], gross)}")python3 levers.pyBorrowing base on 2026-06-30 (₦ million), by SME cap (down) and advance rate (across)
SME cap 70% 75% 80% 85% effective advance rate at 80%
100% 303.6 325.2 346.9 368.6 79.1%
80% 303.6 325.2 346.9 368.6 79.1%
70% 232.7 249.3 265.9 282.5 60.6%
60% 174.5 187.0 199.4 211.9 45.5%
50% 139.6 149.6 159.5 169.5 36.4%The 100% and 80% rows are the same because SME is 77.0% of the pool on 30 June: an 80% cap does not bite yet. A ten-point cut in the SME cap, from 70% to 60%, takes ₦66.5m off the base at 80% (₦265.9m to ₦199.4m). Five points of advance rate is worth ₦16.6m. The last column is the effective advance rate, the base as a share of the gross book.
5. Run the facility to the cut-off. Save this as run_facility.py. NPL in the table means non-performing loans, here loans 90 or more days late as a share of the pool. It draws the most available on 30 June, then at each month-end rebuilds the pool, tests the covenants, repays any deficiency out of collections and prints the cash left over. Interest is on the amount drawn at the last date.
import sys
from facility import *
SHOCK = int(sys.argv[1]) if len(sys.argv) > 1 else 0 # days added to every loan already late
book = Book()
def collected(start, end):
"""Cash the book paid in (start, end]: principal, and everything else (interest, late fees)."""
prin = sum(p for d, _, p, _ in book.payments if start < d <= end)
other = sum(o for d, _, _, o in book.payments if start < d <= end)
return prin + other
print(f"stress: loans already late are treated as {SHOCK} days later\n" if SHOCK else "base case: the book as it was\n")
print(f"{'date':<11}{'gross':>7}{'PAR30':>7}{'NPL':>7}{'eligible':>9}{'base':>7}{'drawn':>7}{'repay':>7}{'net cash':>9} covenants")
drawn, prev, cost = 0, None, ARRANGEMENT_BPS * LIMIT // 10_000
notes = []
for on in DATES:
b = borrowing_base(book.pool(on, SHOCK))
cap = min(LIMIT, b["base"])
if prev is None:
required, cash, drawn = 0, cap - cost, cap # first draw, less the arrangement fee
else:
interest = drawn * INTEREST_BPS * (on - prev).days // (10_000 * 365)
required = max(0, drawn - cap) # a borrowing base deficiency: repay it
cash = collected(prev, on) - interest - required
cost += interest
drawn -= required
par, npl = b["late30"] * 10_000 // b["gross"], b["npl"] * 10_000 // b["gross"]
flags = [n for n, v, lim in (("PAR30", par, COV_PAR30_BPS), ("NPL", npl, COV_NPL_BPS)) if v > lim]
print(f"{on!s:<11}{b['gross'] / 1e8:>7.1f}{par / 100:>6.1f}%{npl / 100:>6.1f}%{b['eligible'] / 1e8:>9.1f}"
f"{b['base'] / 1e8:>7.1f}{drawn / 1e8:>7.1f}{required / 1e8:>7.1f}{cash / 1e8:>9.1f} {'BREACH ' + ', '.join(flags) if flags else 'ok'}")
if "PAR30" in flags: # loans to buy back at par to bring PAR30 under the covenant
buyback = (b["late30"] * 10_000 - COV_PAR30_BPS * b["gross"]) // (10_000 - COV_PAR30_BPS)
notes.append(f" {on}: buying back {naira(buyback)} of loans 30+ days late brings PAR30 to the covenant")
prev = on
print("\n(₦ million. repay: what the borrowing base forces Owoleaf to repay. net cash: collections - facility interest - repay)")
print("\n".join(notes))
print(f"facility cost to the cut-off: {naira(cost)} (interest and the arrangement fee)")python3 run_facility.pybase case: the book as it was
date gross PAR30 NPL eligible base drawn repay net cash covenants
2026-06-30 438.5 1.1% 0.2% 433.7 265.9 250.0 0.0 246.2 ok
2026-07-31 307.1 2.7% 1.0% 299.0 160.5 160.5 89.5 52.5 ok
2026-08-31 207.6 6.7% 2.3% 193.6 115.7 115.7 44.8 62.4 ok
2026-09-30 135.9 11.5% 5.6% 120.3 93.7 93.7 21.9 54.4 BREACH PAR30, NPL
2026-10-28 94.8 16.7% 11.2% 79.0 63.2 63.2 30.5 11.1 BREACH PAR30, NPL
(₦ million. repay: what the borrowing base forces Owoleaf to repay. net cash: collections - facility interest - repay)
2026-09-30: buying back ₦5,216,145 of loans 30+ days late brings PAR30 to the covenant
2026-10-28: buying back ₦8,951,557 of loans 30+ days late brings PAR30 to the covenant
facility cost to the cut-off: ₦15,093,650 (interest and the arrangement fee)The base case holds until 31 August. On 30 September PAR30 is 11.5% and the 90-day ratio is 5.6%: both covenants breach with no new lending, because the pool has run off to 31% of its June size. Each month the base falls and Owoleaf repays the gap, ₦89.5m in July, from collections. Buying back ₦5,216,145 of loans 30 or more days late would bring September inside 8%: (₦15.7m − 8% × ₦135.9m) ÷ 92% is about ₦5.2m by this rounded arithmetic; the code works in kobo.
6. Stress it. The argument 30 treats every loan that is already late as 30 days later than it is: a month in which none of the late borrowers pays. It changes how loans are classed. It does not change the cash received.
python3 run_facility.py 30stress: loans already late are treated as 30 days later
date gross PAR30 NPL eligible base drawn repay net cash covenants
2026-06-30 438.5 2.9% 0.7% 425.8 251.9 250.0 0.0 246.2 ok
2026-07-31 306.8 8.3% 1.5% 281.2 143.0 143.0 107.0 35.0 BREACH PAR30
2026-08-31 207.2 10.0% 3.6% 186.5 112.1 112.1 30.9 76.6 BREACH PAR30
2026-09-30 133.8 13.4% 8.0% 115.9 91.3 91.3 20.8 55.6 BREACH PAR30, NPL
2026-10-28 92.9 19.0% 12.1% 75.2 60.2 60.2 31.1 10.6 BREACH PAR30, NPL
(₦ million. repay: what the borrowing base forces Owoleaf to repay. net cash: collections - facility interest - repay)
2026-07-31: buying back ₦1,149,721 of loans 30+ days late brings PAR30 to the covenant
2026-08-31: buying back ₦4,414,525 of loans 30+ days late brings PAR30 to the covenant
2026-09-30: buying back ₦7,808,243 of loans 30+ days late brings PAR30 to the covenant
2026-10-28: buying back ₦11,134,532 of loans 30+ days late brings PAR30 to the covenant
facility cost to the cut-off: ₦14,659,772 (interest and the arrangement fee)The first breach moves from September to July: PAR30 is 8.3% against the 8% covenant, and the base falls to ₦143.0m, so Owoleaf repays ₦107.0m instead of ₦89.5m, ₦17.5m more. The cure is small in naira, ₦1,149,721 of repurchase, and large in timing: the deficiency is due in days. A few late loans, classed a month worse, bring a covenant breach forward by two months. Loans 180 days late leave the pool as written off, so the stressed gross is ₦306.8m, not ₦307.1m.
7. Cost of money and the tranches. Save this as structure.py. Part 1 blends debt and equity. Part 2 cuts the 30 June pool into three tranches and loses what was unpaid at the cut-off on every loan 90 or more days late, then multiplies that loss.
from datetime import date
from facility import *
book = Book()
on, cut_off = DATES[0], DATES[-1]
rows = book.pool(on)
gross = sum(o for _, _, _, o in rows)
# 1. What the facility does to the cost of money (a full year, so the one-off fee is spread over 12 months)
debt = min(LIMIT, borrowing_base(rows)["base"])
equity = gross - debt
debt_cost = INTEREST_BPS + ARRANGEMENT_BPS * LIMIT // debt # basis points a year on what is drawn
blended = (debt * debt_cost + equity * EQUITY_COST_BPS) // gross
print("1. The cost of the money in the book on 2026-06-30")
print(f" debt {naira(debt):>14} {pct(debt, gross):>6} of the book at {debt_cost / 100:.2f}% (22% interest + the fee over a year)")
print(f" equity {naira(equity):>14} {pct(equity, gross):>6} of the book at {EQUITY_COST_BPS / 100:.2f}% (what the owners want)")
print(f" blended cost of funds: {blended / 100:.2f}% a year; for a 30-day loan {blended * 30 / 365 / 100:.2f}% (the economics chapter's placeholder was 18%: {1800 * 30 / 365 / 100:.2f}%)")
# 2. A securitisation in outline: the same pool cut into three tranches, losses taken from the bottom
loss = 0
for lid, product, dpd, out in rows:
d_end, o_end = book.state(book.loans[lid], cut_off)
if d_end >= 90: # 90 or more days late at the cut-off: treat what is unpaid as lost
loss += o_end
print()
print("2. Losses on the 30 June pool, unpaid principal at the cut-off on loans 90+ days late")
TRANCHES = [("senior", 7500), ("mezzanine", 1000), ("first loss", 1500)] # share of the pool, in bps (ILLUSTRATIVE)
print(f" realised: {naira(loss)} = {pct(loss, gross)} of the pool")
print(f" {'case':<14}{'pool loss':>11}" + "".join(f"{n:>14}" for n, _ in TRANCHES))
for label, mult in (("realised", 1), ("2 x realised", 2), ("5 x realised", 5), ("10 x realised", 10)):
left = loss * mult
cells = []
for name, share in reversed(TRANCHES): # the first loss tranche takes the loss first
size = gross * share // 10_000
hit = min(left, size)
left -= hit
cells.append((name, pct(hit, size)))
order = dict(cells)
print(f" {label:<14}{pct(loss * mult, gross):>11}" + "".join(f"{order[n]:>14}" for n, _ in TRANCHES))python3 structure.py1. The cost of the money in the book on 2026-06-30
debt ₦250,000,000 57.0% of the book at 23.50% (22% interest + the fee over a year)
equity ₦188,468,149 43.0% of the book at 30.00% (what the owners want)
blended cost of funds: 26.29% a year; for a 30-day loan 2.16% (the economics chapter's placeholder was 18%: 1.48%)
2. Losses on the 30 June pool, unpaid principal at the cut-off on loans 90+ days late
realised: ₦13,599,354 = 3.1% of the pool
case pool loss senior mezzanine first loss
realised 3.1% 0.0% 0.0% 20.7%
2 x realised 6.2% 0.0% 0.0% 41.4%
5 x realised 15.5% 0.0% 5.1% 100.0%
10 x realised 31.0% 8.0% 100.0% 100.0%Check part 1: (250.0 × 23.50% + 188.5 × 30%) ÷ 438.5 = 26.29%. Part 2: 15% of ₦438,468,149 is ₦65.8m, and ₦13,599,354 is 20.7% of it. At 5 times, ₦68.0m exceeds the first-loss layer by ₦2.2m, and that is 5.1% of the ₦43.8m mezzanine. The loss is a proxy: the loans that are 90 or more days late at the cut-off, and the loans that are still current are not yet counted.
A covenant is a number someone picked. Open facility.py, set COV_PAR30_BPS = 1200 and run python3 run_facility.py 30 again. The first stress breach moves from 31 July to 30 September, because 8.3% and 10.0% are now inside the line (on 30 September the 90-day ratio breaches its 4% as well), and the net cash column does not change at all. The facility was not safer in July; the line was drawn somewhere else. What you negotiate is the line, the cure period and the remedy, not only the figure. Set it back to 800 afterwards.
Template
# Funding options memo: <the book, the amount sought>
From <head of treasury> · To <CFO>, <owners or board> · Date · Decision needed by <date>
## Decision requested
<One sentence: which term sheet to sign, or to negotiate, and what you need approved.>
## The book (source: <lab step>)
- Gross principal <₦> · Eligible <₦> · After concentration limit <₦> · Date <date>
## The options side by side
| | Option A: <warehouse> | Option B: <term debt> |
|---|---|---|
| Commitment and advance rate | <₦, %> | <₦, n/a> |
| Amount we can draw | <₦> = <% of gross book> | <₦> |
| Cost a year (interest + fee) | <%> | <%> |
| Blended cost with equity | <%> | <%> |
| Covenants | <PAR30, NPL, financial> | <...> |
| Triggers and cure rights | <...> | <...> |
## Stress (source: <lab step>)
<First covenant breach in the base case and in the stress; repayment forced; cash to cure.>
## Recommendation and what would change it
<Option, owner, approver, review date. Triggers for revisiting: <ratio, price, growth>.>
## How this could be wrong
<One risk, and the evidence that would show it.>
## Out of scope
<What this memo does not decide: legal terms, security registration, which funder.> WORKED EXAMPLE
From Nonye, head of treasury and funding, Owoleaf at 200 people · To the CFO and the owners · Decision needed before the term sheet lapses. Nonye writes it; the CFO approves it before anything goes to the owners.
Decision requested. Negotiate the warehouse (80% advance, ₦250m commitment) and ask for a cure right on the PAR30 covenant before signing.
The book (lab step 3, 30 June 2026). Gross principal ₦438,468,149; eligible ₦433,653,464; after the 70% SME cap ₦332,365,616. The borrowing base is ₦265,892,493, so we draw the ₦250,000,000 commitment: 57.0% of the gross book, not 80%.
Cost (lab step 7). The warehouse costs 23.50% a year on what is drawn (22% plus the 1.5% fee over a year). With the owners’ ₦188,468,149 at 30%, the blended cost is 26.29%. Assume an unnamed term lender offers ₦150m at 26% with no borrowing base. By the same step 7 method, with no fee, that blends to about 28.6%: dearer per naira, smaller, and repaid from the company whatever the book does.
Stress (lab steps 5 and 6). In the base case PAR30 is 6.7% on 31 August and 11.5% on 30 September, a breach of the 8% line with no new bad loans, because the pool has run off. Classing late loans 30 days worse brings the first breach to 31 July (8.3%) and raises the repayment from ₦89.5m to ₦107.0m. Buying back ₦1,149,721 of late loans cures it, but the cash is due in days.
Recommendation. Sign only with a 30-day repurchase right. Nonye owns the negotiation, the CFO approves, and we review at the next month-end certificate. Revisit if the funder refuses the cure right.
How this could be wrong. The lab’s book stops lending on 30 June. If growth refills the pool, PAR30 will sit lower; the certificate on real data would show it.
Out of scope. Legal terms and registration of the charge.
Now you
You run treasury and funding at a lender whose book is the lab’s 30 June book (gross principal ₦438,468,149). Two unnamed funders have sent term sheets. Funder X offers a warehouse: ₦200m commitment, 75% advance, SME cap of 60%, 21% interest plus a 1% fee, PAR30 covenant at 10% with a trigger at 7% that stops new advances. Funder Y offers ₦150m of term debt at 25%, repaid in full at twelve months, with no borrowing base and a minimum-equity covenant.
Use the lab, changing the terms in facility.py for each sheet: step 4 prints the base at a 60% cap and a 75% advance rate (₦187.0m), step 5 shows when PAR30 crosses 7% and 10%, step 6 stresses it, and step 7 blends debt with equity at 30%. Write the memo for the CFO and the owners, who must choose which sheet to take forward to negotiation by the end of the month.
Self-check
Nonye and Odunayo have two unnamed funders' term sheets for a ₦250m commitment on the lab's book. The first advances 85% against a PAR30 covenant of 5% with no cure period. The second advances 75% against a PAR30 covenant of 12% with a 30-day right to repurchase late loans. At a 70% SME cap on 30 June the base is ₦282.5m at 85% and ₦249.3m at 75%, so Owoleaf would draw ₦250.0m under the first and ₦249.3m under the second. In the lab's base case PAR30 is 6.7% on 31 August and 11.5% on 30 September.
- DOC Securities and Exchange Commission Nigeria: Rules on Securitisation
The Rules as the SEC hosts them. Read the definitions of asset-backed securities and special purpose vehicle and the sections on who may issue; then check whether later amendments or the Investments and Securities Act 2025 changed them. Skip the schedules on first read.
- DOC Securities and Exchange Commission Nigeria: Executed Rules, December 2024
The December 2024 rules, reported to cover commercial paper and securitised debt. Read the parts on issuer eligibility and registration and confirm each against the text before relying on this chapter's summary.
- DOC FMDQ Exchange: Commercial Paper Registration and Quotation Rules
The exchange's rulebook for registering and quoting commercial paper, including the role of the issuing and placing agent. More than one version was found in search, so check the date on the version you read.
- DOC Central Bank of Nigeria: National Collateral Registry
The registry's own page. Read what it says about registering a security interest in movable assets, then read the Act itself for perfection and priority; skip the statistics.
- DOC Development Bank of Nigeria: wholesale lending
The bank's description of its on-lending schemes and tenors. Read it for the intermediaries it names and its criteria, and do not infer from it that any given lender qualifies.
- POST The Companies and Allied Matters Act 2020: registration of charges (Mondaq)
A law firm's summary of the changes to charge registration, useful as a map of what to look up in the Act. It is commentary, not the law: read the Act's sections on charges before acting.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.