The economics of a loan: cost of funds, risk, operating cost, margin
A loan earns interest and fees, and four costs eat them: money, defaults, servicing and overhead. Small loans fail first because servicing costs the same whatever you lend
A lender makes 30-day advances of ₦25,000 and charges 5% interest plus a 1% fee (₦1,500 in all). Its money costs 18% a year and it spends ₦800 to make and collect each loan. Roughly what share of its loans can default, losing the whole ₦25,000, before the lender stops making money?
A loan is a trade. The lender hands over money now and gets back more money later, and the difference is the lender’s pay. The word for the gap between what comes in and what goes out is margin, and everything in this chapter is the arithmetic of finding it. A lender can charge a price that sounds high, grow fast and still lose money on every loan. This chapter shows how to see that before it happens.
You work with the lab’s loan book at the end, so the figures here are Owoleaf’s illustrative ones: the prices, fees and cost inputs are invented for the lab, as the code says, and are neither the CBN’s, the FCCPC’s nor any lender’s. Money in the lab is integer kobo (one hundredth of a naira), so ₦1,500 is 150,000 kobo and no float ever holds an amount. The Payments chapter money in software explains why.
What a loan earns
A lender earns money from the borrower in three ways.
Interest is the charge for using the money over time. In the lab, the salary advance (SAL) charges 5% for its 30-day period, and the personal loan (PL) charges 4.5% a month on the balance still owed. How interest is worked out, and what a stated rate really costs, is the next chapter’s subject.
Fees are charged once. The lab’s loans each take a fee from the amount at disbursement (the day the lender pays the money out): 1% for SAL and PL, 1.5% for SME, none for BNPL. A ₦17,000 salary advance with a ₦170 fee puts ₦16,830 into the borrower’s wallet, and the borrower owes ₦17,000. The fee is income on day one, before anything can go wrong, which is why lenders like it. It also raises the true cost to the borrower, a point the next chapter measures.
Late fees are charged when an instalment is paid late. The lab charges ₦500 to ₦2,000 depending on the product. They are real income, and a poor basis for a business: a lender who needs late fees to make a margin is counting on borrowers failing.
Add these three and divide by the money lent, and you have the product’s yield. The lab’s salary advance has a yield of 5.5%: ₦265,770 of fees, interest and late fees on ₦4,837,000 lent. The 5% interest and 1% fee on the whiteboard come to 6%, and the book collects less than that, because borrowers who default pay neither.
There is a fourth source in real lending that the lab’s data does not have. A buy now, pay later (BNPL) product often charges the customer nothing and is paid by the merchant, which gives the lender a share of each sale. The lab’s BNPL product has no such income, and that missing income is one reason its margin below is negative; you add a merchant fee in the last lab step and watch the sign change.
What a loan costs
Four costs sit against the income. Three are specific to the loan; the fourth belongs to the whole business.
| Cost | What it is | Scales with | In the lab |
|---|---|---|---|
| Cost of funds | What the money lent costs the lender | Amount lent and days outstanding | 18% a year, illustrative |
| Expected loss | Principal that borrowers will not repay | Amount lent and borrower risk | Measured from the book |
| Cost to serve | Making, disbursing, collecting and supporting one loan | Number of loans | ₦800 to ₦6,000 a loan, illustrative |
| Overhead and return | Rent, management, tax and what owners require | The size of the company | Left out |
Cost of funds
A lender does not have the money it lends. It borrows it, or takes it from deposits, or puts in its owners’ money, and each source has a price. A bank such as Northmere Bank, with 9.2 million retail customers, takes deposits. Most of that money comes from current and savings accounts that pay the depositor little. A start-up such as Owoleaf has no such supply: it funds loans with the owners’ money (equity) and with money borrowed from investors or other lenders (debt).
The three sources are priced differently.
- Deposits are the cheapest, because depositors accept a low rate for safety and convenience. The bank pays something for them and also holds part of each deposit back as cash and liquid assets for withdrawals, so the cost on each naira it can actually lend is higher than the rate it pays.
- Debt costs the interest on the loan, and it must be repaid on a date whatever happens to the loans it funded.
- Equity has no interest date, and costs the most: owners take the first losses, so they require a high return for the risk. Equity is also what keeps the lender alive when losses arrive.
A lender’s cost of funds is the blend, weighted by how much of each it uses. With invented figures: 70% deposits at 6%, 20% debt at 22% and 10% equity at 30% give 0.70 × 6 + 0.20 × 22 + 0.10 × 30 = 4.2 + 4.4 + 3.0 = 11.6% a year. A lender funded only by equity and expensive debt, as Owoleaf’s lending would be, sits nearer the lab’s 18%. Neither figure is a real quote. Both show the same fact: a bank’s funding advantage is large, and a new lender must make its loans pay despite a higher cost of money. How a lender funds a book, and which funding a licence allows, is module 4’s subject; here the cost is an input you can change.
The lab charges the cost of funds on principal-days: each kobo of principal multiplied by the days it was out. A ₦17,000 loan out for 195 days is 17,000 × 195 = 3,315,000 naira-days, and at 18% a year the funding cost is 3,315,000 × 0.18 ÷ 365 = ₦1,634.79. Lenders quote the rate as basis points, one hundredth of a percent, so 18% is 1,800 bps, and the code divides by 10,000 × 365.
Expected loss
Some borrowers do not repay. A lender cannot know which, so it prices for the average and tries to keep the average low. Three terms describe the average. They are standard, and you meet them properly in module 3.
- Probability of default (PD): the chance that a loan goes bad. In the lab a loan is in default when its oldest unpaid instalment is 90 or more days past its due date, and it is written off at 180 days. Those thresholds are the lab’s own.
- Loss given default (LGD): the share of the loan that is not recovered once it has defaulted. This chapter measures it against the amount lent, so a defaulter who paid two instalments and stopped has an LGD below 100%. Lenders more often measure it against the amount owed at default, counting only what comes back afterwards; on that basis this lab’s defaulters lose almost all of it, as the expected-loss chapter shows.
- Exposure at default (EAD): the amount owed when the default happens.
Expected loss is their product: PD × LGD × EAD. For a lender with 1,000 identical ₦25,000 loans, a PD of 10% and an LGD of 80%, the expected loss is 0.10 × 0.80 × ₦25,000 = ₦2,000 a loan, which is 8% of the money lent.
IFRS 9, the international accounting standard a lender reporting under it must follow, measures a loan’s loss allowance as the 12-month expected credit loss, and as the lifetime expected credit loss once the loan’s credit risk has increased significantly since it was madeas of 2026-11. So the lender books the expected loss when it lends, not when the borrower stops paying. The standard’s own text could not be opened when this was checked: the sentence rests on search-result summaries, among them HMRC’s guidance manual, so read the standard before relying on its wording. Module 3 reads it in full.
Cost to serve
Making a loan costs money whatever its size. Someone checks identity, a system asks a credit bureau about the applicant, a payment goes out, a reminder is sent, a customer asks where their money is, and a collections agent calls. Much of this is software and people that cost the same for a ₦20,000 loan as for a ₦200,000 one. This is the operating cost per loan, and the lab holds it as an input: ₦800 for a salary advance, ₦2,500 for a personal loan, ₦1,200 for BNPL and ₦6,000 for an SME loan. Those are invented. A real lender computes its own by dividing the year’s costs of the lending team and systems by the loans made.
Overhead and return
The last cost is the company: salaries of people who do not touch any single loan, rent, tax, and the return the owners require. This chapter stops before it. A product whose margin after the first three costs is zero cannot pay for any of it. Unit economics, the accounting of a whole lending business, is module 4.
Margin and the break-even rate
Put the pieces together for the money lent in one product.
margin = income − principal lost − cost of funds − cost to serve
Divide each term by the amount lent and the result is a set of percentages that add up. The price at which margin is exactly zero is the break-even rate:
break-even rate = expected loss rate + cost of funds rate + cost-to-serve rate
Below it every loan loses money on average, and the lender is paying its borrowers to take the loans. This is the number behind every sensible price. It does not say what to charge, because the market and the rules limit that; it says what the price must at least cover.
Work one loan from the Predict. A ₦25,000 advance for 30 days at 18% a year costs ₦25,000 × 0.18 × 30 ÷ 365 = ₦369.86 to fund. If it repays, income is ₦250 (fee) plus ₦1,250 (5% interest) = ₦1,500, and the margin is 1,500 − 369.86 − 800 = ₦330.14. If it defaults, the lender keeps the ₦250 fee, spends ₦800 to serve it and loses ₦25,000: a margin of 250 − 800 − 25,000 = −₦25,550 (leaving out the funding cost, which a default makes larger). One bad loan costs as much as 25,550 ÷ 330.14 = 77.4 good ones earn. The break-even default rate is p where (1 − p) × 330.14 = p × 25,550, so p = 330.14 ÷ 25,880.14 = 1.28%.
That is the whole reason lenders obsess over who they lend to. The price cannot fix a 15% default rate; a price that did would be so large that few borrowers who can repay would accept it.
Why small loans carry high rates
The diagram shows a bad product. Now look at where size matters. The cost to serve does not shrink with the loan. Compare two one-month loans on the same terms: a PD of 10% and an LGD of 80% (an expected loss of 8%), funding at 18% and ₦800 to serve.
| ₦20,000 loan | ₦200,000 loan | |
|---|---|---|
| Expected loss at 8% | ₦1,600.00 | ₦16,000.00 |
| Funding, 30 days at 18% | ₦295.89 | ₦2,958.90 |
| Cost to serve | ₦800.00 | ₦800.00 |
| Break-even, naira | ₦2,695.89 | ₦19,758.90 |
| Break-even, as a share of the loan | 13.48% | 9.88% |
Loss and funding scale with the loan, so they take the same percentage of each. The ₦800 does not: it is 4.00% of the small loan and 0.40% of the large one. That 3.6-point gap is the whole difference. At a loan of ₦2,000 the ₦800 is 40% of it, and below some amount no sensible price covers the cost to serve. This is why small loans are usually priced above bank loans, and why the lenders that serve them work to cut the cost per loan with software, agents and phone applications. The CGAP study in the reading list, of microlenders in many countries, finds that operating costs are much higher on very small loans than on ordinary bank loans, and that most microcredit rates track lenders’ costs.
It is also why a lender should be wary of a bigger rate as the answer. A higher price can attract the borrowers who will not repay: those who expect to default accept any price. This effect is called adverse selection, and the Stiglitz and Weiss paper in the reading list is its classic statement. A lender facing a PD that is too high must usually lend to different people, not charge them more.
Reading a loan book
Now to what you will do in the lab. The lab gives you a book, not a forecast. It lists every loan made in six months and what happened to it until 28 October 2026, the cut-off. You compute income and losses from the tables, add the two cost inputs, and get a margin for each product.
Three traps wait there, and each has caught real lenders.
The book is young. A salary advance falls due after 30 days, so by the cut-off every advance has had time to be repaid or to default. A personal loan runs up to twelve months, and many are still current. A current loan has earned part of its interest and has shown no loss. The lab’s personal loans have 38.3% of their principal still out, and no loan in default yet, so the product’s margin looks like 9.4% of what was lent, the best in the book. That number will fall. Count the eight loans now in arrears (late, but not yet 90 days) as lost and the personal-loan margin drops to 1.8%. Neither figure is right: one is too kind and the other too harsh. The answer lies between them, and a lender finds it by watching how loans of each age behave, which is module 3’s vintage analysis.
Losses are not all lost. The lab’s data has no record of money recovered after default, so it counts the whole outstanding principal as lost. Real LGD is lower when a lender recovers something from collections, a guarantor or a sale of collateral. You will see that lenders’ LGD figures depend on how long they wait to count.
Income is not all received. A loan earns interest as time passes, and it pays it as instalments fall due. A lender that counts interest earned instead of interest paid is counting on the borrowers. The lab counts only what was paid.
A fourth caution is about averages. A margin of ₦1,760,305.50 on the whole book hides a salary advance that loses ₦750,956.09 and an SME product that makes ₦2,005,191.41. The total is a sum of products, and the sign of each one is the information. Never let a total stand where the parts disagree.
Owoleaf’s decision
Back to the whiteboard. Chiedu’s table says the salary advance loses 15.5 kobo of margin on every naira lent, the personal loan seems to make 9.4 and the book as a whole makes money only because of the larger SME loans. He does not conclude that Owoleaf should or should not lend. He lists the questions the table raises, and each one is a chapter of this course.
- Is a 15% loss rate a feature of salary advances or of who was approved? Module 2 builds the scoring that answers it.
- Which of Owoleaf’s costs are really fixed per loan? The lifecycle chapter lists what each stage of a loan costs.
- What may Owoleaf charge, and how must it say so? The next chapter and module 2’s consumer-protection chapter cover the cost-of-credit rules.
- Where does the money come from, and may Owoleaf lend it? Module 4.
The decision is the board’s, and it belongs to people who have the full numbers. The method is the same for any lender, from a village cooperative to a bank: write the income, write the four costs, compute the break-even and compare it with the price.
You work in labs/finance. Every file you write goes in that folder, next to generate.py. All inputs are illustrative, as the code says. Money is integer kobo inside the scripts and printed as naira.
1. Build the loan book. If data/loans.csv already exists, you can skip the first two commands.
cd labs/finance
python3 generate.py
python3 loans.py
python3 check.pyThe generator writes the wallet company’s tables, loans.py adds the book, and check.py proves the ledger and the book are sound:
customers 2,000
accounts 2,005
transactions 83,887
entries 191,103
bank_statement 56,008
planted breaks 9 (answers/breaks.csv)
852 applications, 372 loans, 1127 instalments, 891 repayments
loan status at 2026-10-28: arrears 8, closed 288, current 40, default 34, written_off 2
loan book: 372 loans, 850,258,479 kobo of principal outstanding; checks 7-11 run
accounts by type (debit-positive kobo): {'asset': 17355054889, 'equity': -5000000000, 'expense': 110590267, 'income': -221782321, 'liability': -12243862835}
settlement_bank in ledger 17,189,646,589 kobo; on the statement 17,192,741,324 kobo
OK: all invariants holdAlways the same, because the seed is 42. The status counts are the book at the cut-off, 28 October 2026. In the book, 36 of the 372 loans are defaulted or written off (34 and 2), and 48 are not yet finished (40 current, 8 in arrears).
2. Total what each product earned and lost. Save this as economics.py. It reads loans.csv and repayments.csv and adds up, for each product, the fees, the interest and late fees the borrowers paid, and the principal still owed on loans that are in default or written off. It also keeps principal-days for step 3.
import csv
from datetime import date
CUT_OFF = date(2026, 10, 28)
PRODUCTS = ("SAL", "PL", "BNPL", "SME")
LOST = ("default", "written_off") # statuses whose outstanding principal we call lost
def rows(name):
with open(f"data/{name}.csv", newline="") as f:
return list(csv.DictReader(f))
def naira(kobo):
sign = "-" if kobo < 0 else ""
kobo = abs(kobo)
return f"{sign}{kobo // 100:,}.{kobo % 100:02d}"
def load():
"""Per product: loans, principal lent, fees, interest and late fees received, principal lost,
and principal-days (kobo of principal out, times days out, to the cut-off)."""
loans = rows("loans")
owner = {l["id"]: l["product"] for l in loans}
book = {p: dict(n=0, lent=0, fees=0, interest=0, late=0, lost=0, lost_n=0, lost_lent=0, live=0, pdays=0)
for p in PRODUCTS}
for l in loans:
b = book[l["product"]]
b["n"] += 1
b["lent"] += int(l["principal_kobo"])
b["fees"] += int(l["fee_kobo"])
b["interest"] += int(l["paid_interest_kobo"])
b["late"] += int(l["paid_late_fees_kobo"])
b["pdays"] += int(l["principal_kobo"]) * (CUT_OFF - date.fromisoformat(l["disbursed_at"])).days
if l["status"] in LOST:
b["lost"] += int(l["outstanding_principal_kobo"])
b["lost_n"] += 1
b["lost_lent"] += int(l["principal_kobo"])
else:
b["live"] += int(l["outstanding_principal_kobo"]) # not lost, not yet repaid: still at risk
for r in rows("repayments"):
b = book[owner[r["loan_id"]]]
b["pdays"] -= int(r["principal_kobo"]) * (CUT_OFF - date.fromisoformat(r["paid_at"])).days
return book
if __name__ == "__main__":
book = load()
print(f"{'':5}{'loans':>6}{'lent':>16}{'fees':>12}{'interest':>14}{'late fees':>11}{'lost':>14}{'lost/lent':>10}")
for p in PRODUCTS:
b = book[p]
print(f"{p:5}{b['n']:>6}{naira(b['lent']):>16}{naira(b['fees']):>12}{naira(b['interest']):>14}"
f"{naira(b['late']):>11}{naira(b['lost']):>14}{b['lost'] / b['lent']:>10.1%}")python3 economics.py loans lent fees interest late fees lost lost/lent
SAL 190 4,837,000.00 48,370.00 208,400.00 9,000.00 742,238.00 15.3%
PL 52 8,124,000.00 81,240.00 1,254,820.24 16,000.00 0.00 0.0%
BNPL 85 3,955,000.00 0.00 0.00 14,500.00 92,938.00 2.3%
SME 45 46,254,000.00 693,810.00 4,453,208.64 22,000.00 895,724.95 1.9%Check one row by hand. SAL income is 48,370 + 208,400 + 9,000 = ₦265,770, which is 5.5% of ₦4,837,000. Its loss is 15.3%, nearly three times its income. BNPL charges the customer nothing, so its only income is late fees. PL shows no loss, but wait for step 5.
3. Add the costs and find the margin. Save this as margin.py. The three inputs at the top are the illustrative ones; you change them in step 6. Funding is principal-days times the rate in basis points, divided by 10,000 × 365, in integer arithmetic.
import sys
from economics import PRODUCTS, load, naira
# ILLUSTRATIVE inputs, not Owoleaf's or anyone's real costs. Money is integer kobo.
COST_OF_FUNDS_BPS = 1800 # 18% a year, in basis points
COST_PER_LOAN = {"SAL": 80_000, "PL": 250_000, "BNPL": 120_000, "SME": 600_000} # kobo a loan
MERCHANT_FEE_BPS = {"SAL": 0, "PL": 0, "BNPL": 0, "SME": 0} # the data has none; step 6 tries one for BNPL
def margins(book, cof_bps=COST_OF_FUNDS_BPS, merchant_bps=MERCHANT_FEE_BPS):
out = {}
for p in PRODUCTS:
b = book[p]
income = b["fees"] + b["interest"] + b["late"] + b["lent"] * merchant_bps[p] // 10_000
funds = b["pdays"] * cof_bps // (10_000 * 365)
ops = b["n"] * COST_PER_LOAN[p]
out[p] = dict(income=income, lost=b["lost"], funds=funds, ops=ops,
margin=income - b["lost"] - funds - ops)
return out
if __name__ == "__main__":
# optional arguments: cost of funds in bps, BNPL merchant fee in bps
cof = int(sys.argv[1]) if len(sys.argv) > 1 else COST_OF_FUNDS_BPS
mdr = dict(MERCHANT_FEE_BPS, BNPL=int(sys.argv[2]) if len(sys.argv) > 2 else 0)
book = load()
m = margins(book, cof, mdr)
print(f"{'':5}{'income':>14}{'lost':>14}{'funds':>14}{'ops':>12}{'margin':>15}{'margin/lent':>12}")
for p in PRODUCTS:
r = m[p]
print(f"{p:5}{naira(r['income']):>14}{naira(r['lost']):>14}{naira(r['funds']):>14}"
f"{naira(r['ops']):>12}{naira(r['margin']):>15}{r['margin'] / book[p]['lent']:>12.1%}")
print("total margin", naira(sum(r["margin"] for r in m.values())))python3 margin.py income lost funds ops margin margin/lent
SAL 265,770.00 742,238.00 122,488.09 152,000.00 -750,956.09 -15.5%
PL 1,352,060.24 0.00 459,037.58 130,000.00 763,022.66 9.4%
BNPL 14,500.00 92,938.00 76,514.48 102,000.00 -256,952.48 -6.5%
SME 5,169,018.64 895,724.95 1,998,102.28 270,000.00 2,005,191.41 4.3%
total margin 1,760,305.50Redo the first row: 265,770.00 − 742,238.00 − 122,488.09 − 152,000.00 = −₦750,956.09, because 190 loans × ₦800 is ₦152,000. The salary advance and BNPL lose money; SME and PL make it. The total is positive only because the larger loans carry the book. The salary advance’s funding cost (₦122,488.09 on ₦4,837,000, 2.5%) is more than 30 days’ worth because the 28 defaulted loans stayed out until the cut-off.
4. Take one loan apart. Save this as one_loan.py. It does the same sum for a single loan, so you can see where each kobo goes.
import sys
from datetime import date
from economics import CUT_OFF, LOST, naira, rows
from margin import COST_OF_FUNDS_BPS, COST_PER_LOAN
loan = next(l for l in rows("loans") if l["id"] == sys.argv[1])
days = lambda iso: (CUT_OFF - date.fromisoformat(iso)).days
pdays = int(loan["principal_kobo"]) * days(loan["disbursed_at"])
for r in rows("repayments"):
if r["loan_id"] == loan["id"]:
pdays -= int(r["principal_kobo"]) * days(r["paid_at"])
income = int(loan["fee_kobo"]) + int(loan["paid_interest_kobo"]) + int(loan["paid_late_fees_kobo"])
lost = int(loan["outstanding_principal_kobo"]) if loan["status"] in LOST else 0
funds = pdays * COST_OF_FUNDS_BPS // (10_000 * 365)
ops = COST_PER_LOAN[loan["product"]]
print(f"{loan['id']} {loan['product']} {loan['status']}, principal {naira(int(loan['principal_kobo']))}")
for label, k in (("income", income), ("lost", -lost), ("cost of funds", -funds), ("cost to serve", -ops)):
print(f" {label:<14}{naira(k):>12}")
print(f" {'margin':<14}{naira(income - lost - funds - ops):>12}")python3 one_loan.py L000002
python3 one_loan.py L000005L000002 SAL default, principal 17,000.00
income 170.00
lost -17,000.00
cost of funds -1,634.79
cost to serve -800.00
margin -19,264.79
L000005 SAL closed, principal 18,000.00
income 1,080.00
lost 0.00
cost of funds -275.17
cost to serve -800.00
margin 4.83L000002 was paid out on 16 April 2026: ₦16,830 net of its ₦170 fee, ₦17,000 owed, never repaid. It has been out 195 days, so funding is 1,700,000 × 195 × 1,800 ÷ (10,000 × 365) = 163,479 kobo, which is ₦1,634.79. L000005 repaid in full a day late, with ₦900 of interest and a ₦180 fee. It cost 31 days of funding (₦275.17) and ₦800 to serve, and it earned ₦4.83. That is the lesson of the whole chapter in two loans: it takes about 4,000 loans like L000005 to pay for one like L000002.
5. Compute the break-even rate and the PD and LGD. Save this as breakeven.py. It splits each product’s loss into the two factors a lender models, and compares the price actually collected with the price needed.
from economics import PRODUCTS, load, naira
from margin import COST_OF_FUNDS_BPS, COST_PER_LOAN, margins
book = load()
m = margins(book)
print(f"{'':5}{'avg loan':>12}{'PD':>7}{'LGD':>7}{'EL rate':>9}{'funds':>8}{'ops':>7}{'break-even':>12}{'charged':>9}{'still out':>11}")
for p in PRODUCTS:
b = book[p]
pd_value = b["lost_lent"] / b["lent"] # share of the money lent that went to defaulters
lgd = b["lost"] / b["lost_lent"] if b["lost_lent"] else 0 # share of a defaulter's principal not repaid
el = pd_value * lgd # equals lost / lent
funds = m[p]["funds"] / b["lent"]
ops = m[p]["ops"] / b["lent"]
charged = m[p]["income"] / b["lent"]
print(f"{p:5}{naira(b['lent'] // b['n']):>12}{pd_value:>7.1%}{lgd:>7.1%}{el:>9.1%}"
f"{funds:>8.1%}{ops:>7.1%}{el + funds + ops:>12.1%}{charged:>9.1%}{b['live'] / b['lent']:>11.1%}")python3 breakeven.py avg loan PD LGD EL rate funds ops break-even charged still out
SAL 25,457.89 15.8% 97.4% 15.3% 2.5% 3.1% 21.0% 5.5% 0.0%
PL 156,230.76 0.0% 0.0% 0.0% 5.7% 1.6% 7.3% 16.6% 38.3%
BNPL 46,529.41 4.1% 57.4% 2.3% 1.9% 2.6% 6.9% 0.4% 0.0%
SME 1,027,866.66 2.9% 67.8% 1.9% 4.3% 0.6% 6.8% 11.2% 7.9%Read down the ops column: 3.1% for the ₦25,458 salary advance and 0.6% for the ₦1,027,867 SME loan, although an SME loan is costed at more than seven times as many naira to serve. Small loans pay a larger share of their size for servicing. PD here is by value (the share of the money lent that went to borrowers who defaulted), so PD × LGD equals the lost-to-lent column of step 2. Last, SAL charges 5.5% against a break-even of 21.0%, while PL charges 16.6% against 7.3% and still has 38.3% of its principal out: the table has not finished judging it. PL’s PD is 0.0% only because no personal loan has reached 90 days past due yet.
6. Change the inputs. The script takes the cost of funds in basis points and a merchant fee for BNPL in basis points.
python3 margin.py 2800
python3 margin.py 1800 300A cost of funds of 28% a year (2,800 bps) takes PL from 9.4% to 6.3% of the money lent and SME from 4.3% to 1.9%, and the book’s total from ₦1,760,305.50 to ₦284,670.81. Every product loses margin when money gets dearer, and the products that tie money up longest lose most:
SAL 265,770.00 742,238.00 190,537.03 152,000.00 -819,005.03 -16.9%
PL 1,352,060.24 0.00 714,058.46 130,000.00 508,001.78 6.3%
BNPL 14,500.00 92,938.00 119,022.53 102,000.00 -299,460.53 -7.6%
SME 5,169,018.64 895,724.95 3,108,159.10 270,000.00 895,134.59 1.9%
total margin 284,670.81A 3% merchant fee on BNPL (300 bps; 3% of ₦3,955,000 is ₦118,650) lifts its income from ₦14,500.00 to ₦133,150.00 and its margin from −₦256,952.48 to −₦138,302.48. It is still negative: the fee helps and does not fix a product whose losses and servicing together cost about ₦195,000 on this book. The number is invented; the point is that the merchant’s fee is a real income line the data does not have.
In economics.py, change LOST = ("default", "written_off") to LOST = ("arrears", "default", "written_off") and run python3 margin.py again. Eight personal and SME loans that are late but under 90 days past due now count as lost. PL falls from ₦763,022.66 (9.4%) to ₦142,993.50 (1.8%), SME from ₦2,005,191.41 to ₦1,613,758.77 (3.5%), and the total from ₦1,760,305.50 to ₦748,843.70. Nothing about the loans changed, only the definition of lost. A margin is only as honest as its definition of a loss, which is why a lender states its definition and keeps it fixed. Change it back before you go on.
Template
# Loan pricing sheet: <product>, <lender>, <date>
Prepared by <analyst>, <team>. Owned by <product owner>. Approved by <who signs the price>.
## 1. The product
<amount, term, interest, fee, loans in the book, money lent, cut-off date and how old the loans are>
## 2. Per ₦100 lent
| Line | ₦ per ₦100 | Kobo in all | Where it comes from |
|---|---|---|---|
| Charged (fees, interest, late fees) | | | |
| Expected loss (PD x LGD) | | | |
| Cost of funds | | | |
| Cost to serve | | | |
| Margin | | | |
## 3. The rate
Break-even rate: <expected loss + funds + serve>. Charged: <rate>. Gap: <points>.
## 4. What makes it unprofitable
- Default rate at which one loan stops paying: <p>, from <repaid margin> and <defaulted margin>
- Actual default rate: <PD>
- Input that moves the margin most, and by how much: <input, change, result>
## 5. How this could be wrong
<one way, and what would show it>
## 6. Decision and sign-off
Decision needed: <what, from whom, by when>. Out of scope: <what this sheet does not cover>.
Prepared <name, date>. Approved <name, date>. WORKED EXAMPLE
A product analyst on Bunmi’s team at Owoleaf writes this sheet; Bunmi, who owns the product, presents it, and the board signs any change of price or volume. These are the lab’s figures at the 28 October 2026 cut-off, from margin.py and breakeven.py.
Product. Salary advance (SAL): 30 days, 5% interest and a 1% fee. 190 loans, ₦4,837,000.00 lent, ₦25,457.89 on average. Every advance is past its due date, so the book is old enough to judge.
Per ₦100 lent. Charged ₦5.5 (₦265,770.00). Expected loss ₦15.3 (PD 15.8%, LGD 97.4%, ₦742,238.00 lost). Funding ₦2.5 (₦122,488.09 at 18%, an illustrative rate). Cost to serve ₦3.1 (190 × ₦800 = ₦152,000.00, also illustrative). Margin −₦15.5, which is −₦750,956.09.
The rate. Break-even is 21.0% of the money lent. Charged is 5.5%. Gap: 15.5 points. This is what the price must cover, not a proposal to charge 21%.
Unprofitable when. On a ₦25,000 advance a repaid loan earns ₦330.14 and a defaulted one loses ₦25,550, so 1.28% of loans defaulting is break-even. The book has 15.8%. Loss is the driver: L000002 lost ₦19,264.79 and L000005 earned ₦4.83. At 28% funding the margin falls from −15.5% to −16.9%.
Could be wrong. Funding and cost to serve are invented inputs, and the lab counts the whole unpaid principal as lost, with no recoveries. Finance’s real cost per loan, or any money recovered after default, would show it.
Decision. Bunmi asks the board not to double the marketing yet, and to approve a review of which advances default. Chiedu checks the sums. Out of scope: overhead, the owners’ return and what Owoleaf may lawfully charge.
Now you
Northmere Bank, with 9.2 million retail customers, wants to offer its salary-account customers a ₦20,000 one-month loan. Its product team’s draft charges 10% for the month, interest and fees together, paid at the month’s end. You are the analyst who must write the pricing sheet.
Use these assumptions, all invented: a PD of 10% and an LGD of 80%, the chapter’s example (a defaulting borrower pays nothing and the bank loses 80% of the loan); cost to serve ₦800 a loan; and funding at 11.6% a year, the deposit-heavy blend the chapter works out. Cost of funds runs for 30 days. Run python3 margin.py 1160 to see how the lab’s own products move at that funding cost, and read the ops column of breakeven.py to say why a ₦20,000 loan needs a higher rate than an SME loan.
Your sheet goes to the head of retail lending, who signs the price, and it supports one decision: launch at 10%, change the price, or tighten who is offered the loan.
Self-check
Chiedu's table shows Owoleaf's salary advance losing 15.5% of the money lent and its personal loan making 9.4%, with 38% of personal-loan principal still out. Bunmi wants to double the marketing for salary advances, arguing that volume will spread the fixed costs. What should Owoleaf do first?
- PAPER The New Moneylenders: Are the Poor Being Exploited by High Microcredit Interest Rates? Richard Rosenberg, Adrian Gonzalez and Sushma Narain, CGAP, 2009
Rosenberg, Gonzalez and Narain test whether small-loan interest rates are explained by lenders' costs, using data from many countries. It is the evidence behind this chapter's claim that small loans cost more to serve per naira lent. Read the summary and conclusions; skip the detailed tables. Read: summary and conclusions.
- PAPER Credit Rationing in Markets with Imperfect Information Joseph Stiglitz and Andrew Weiss, American Economic Review 71(3), 1981
The classic statement of why a higher price can worsen a lender's pool of borrowers, so that lenders ration credit instead of raising the rate. It explains the Decide's second option. The mathematics is dense: read the introduction and the conclusion first. Read: introduction and conclusion.
- PAPER Six Randomized Evaluations of Microcredit: Introduction and Further Steps Abhijit Banerjee, Dean Karlan and Jonathan Zinman, American Economic Journal: Applied Economics 7(1), 2015
What six trials found when small loans were offered to some borrowers and not others. Use it to keep the economics of a loan, for the lender, apart from what the loan does for the borrower, which is a different question with a modest answer. Read the introduction and the summary of results. Read: introduction and summary of results.
- DOC IFRS 9 Financial Instruments
The standard behind expected credit loss accounting. Read section 5.5 on impairment, and keep the application guidance for module 3. It is the source of this chapter's rule that a lender books expected loss when it lends. Read: section 5.5, impairment.
- DOC Principles for the management of credit risk (2025 revision) Basel Committee on Banking Supervision, 2025
The Basel Committee's principles for how a bank grants, measures and monitors credit, revised in April 2025. Read it for the vocabulary a bank's risk team uses. The original 2000 version is at bis.org/publ/bcbs75.htm, and the two differ in detail.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.