On 9 October 2026 the 10-year Treasury yield was 5.24%, a rate quoted for payments twice a year. The same growth of money, counted with one payment a year, is a rate of 5.31%, and counted continuously it is 5.17%. Three numbers for one fact: a rate is not a number until you say how it compounds. The two-year yield of 4.80% and the one-year yield of 4.47% also imply a rate for the second year alone: 5.13%. This topic builds the functions that move between all of these.
Money grows by a rule
Where we are. The last topic gave you the dates and the amounts of a bond. To say what the bond is worth, you need to know what one dollar on one date is worth on another date, and that depends on the interest rate and on a rule for compounding: how often the interest is added to the money so that it earns interest itself. The same 5% gives three different results over two years, depending on the rule.
With simple interest the money grows in a straight line: after t years it is worth 1 + rate × t. With compounded interest the interest is added frequency times a year (1 for annual, 2 for semiannual, 4 for quarterly, 12 for monthly), and each addition earns interest. With continuous compounding the interest is added at every instant, which is the limit of compounding more and more often, and the growth is the exponential exp(rate × t). A discount factor is the reverse: the value today of one dollar paid in t years, which is one divided by the growth.
Worked example 1. *Problem:* find the growth and the discount factor of 1 dollar over 2 years at 5%, with simple interest, annual, semiannual and monthly compounding, and continuous compounding. *Plan:* use compound_factor and discount_factor. *Steps:* below.
rules = [("simple", 1), ("compounded", 1), ("compounded", 2), ("compounded", 12), ("continuous", 1)]for name, frequency in rules: print(name, frequency, round(compound_factor(0.05, 2, name, frequency), 6), round(discount_factor(0.05, 2, name, frequency), 6))1
simple 1 1.1 0.909091 compounded 1 1.1025 0.907029 compounded 2 1.103813 0.905951 compounded 12 1.104941 0.905025 continuous 1 1.105171 0.904837
- 1Growth and discount factor of one dollar.
*Check:* the growth is 1.1 for simple interest, 1.1025 for annual compounding (1.05 × 1.05), 1.103813 for semiannual, 1.104941 for monthly and 1.105171 for continuous; the discount factors are 0.909091, 0.907029, 0.905951, 0.905025 and 0.904837. *What to notice:* more frequent compounding always gives more growth, but by less and less: from annual to monthly it adds 0.0024, and from monthly to continuous only 0.0002. Continuous compounding is the upper limit.
The same growth under another rule
Two rates under different rules are the same rate if they give the same growth. That makes it possible to convert. The tool is the implied rate: the rate of a given rule that turns one dollar into a given amount in t years. It is the inverse of the growth formulas: (growth − 1) / t for simple interest, m × (growth^(1 / (m t)) − 1) for compounded interest, and ln(growth) / t for continuous interest. To convert a rate, grow one dollar at the first rate, then read off the implied rate of the other rule.
Worked example 2. *Problem:* convert 5% compounded twice a year into an annual rate and a continuous rate over a year; convert 5% continuous into an annual rate; convert 5% simple interest over 2 years into an annual rate; and find the implied rates for a growth of 1.1 over 2 years under each rule. *Plan:* use convert_rate and implied_rate. *Steps:* below.
print(round(convert_rate(0.05, 1, "compounded", 2, "compounded", 1), 6), round(convert_rate(0.05, 1, "compounded", 2, "continuous"), 6))1print(round(convert_rate(0.05, 1, "continuous", 1, "compounded"), 6), round(convert_rate(0.05, 2, "simple", 1, "compounded"), 6))2print([round(implied_rate(1.1, 2, name), 6) for name in COMPOUNDINGS])3
0.050625 0.049385 0.051271 0.048809 [0.05, 0.048809, 0.047655]
- 1Semiannual 5% is a little more than 5% a year.
- 2Continuous 5% is 5.127% a year.
- 3A growth of 10% over 2 years, as a rate of each kind.
*Check:* 5% compounded twice a year is 0.050625 compounded once a year and 0.049385 compounded continuously. 5% continuous is 0.051271 annually. 5% simple interest over 2 years is 0.048809 annually: the growth of 1.1 is the same, but a compounded rate needs less to reach it. A growth of 1.1 over 2 years is a rate of 0.05 simple, 0.048809 annual and 0.047655 continuous. *What to notice:* the compounded and the continuous rates are lower than the simple one for the same growth, because they earn interest on interest; when you compare two rates, first put them under the same rule.
What the curve implies: forward rates
Rates depend on how long the money is lent. Suppose that a 1-year loan pays 4% and a 2-year loan pays 5% a year. You could lend for 2 years, or lend for 1 year and then lend again for a second year; the two must grow the money by the same amount, or there would be a free lunch. The rate for the second year that makes the two equal is the forward rate. It is the rate the market already agrees to for a period in the future.
Worked example 3. *Problem:* find the forward rate from year 1 to year 2 when the 1-year rate is 4% and the 2-year rate is 5%, with annual, simple, continuous and semiannual compounding. Then do the same for a falling curve, 5% for 1 year and 4% for 2 years. *Plan:* use forward_rate. *Steps:* below.
print(round(forward_rate(0.04, 1, 0.05, 2), 6), round(forward_rate(0.04, 1, 0.05, 2, "simple"), 6), round(forward_rate(0.04, 1, 0.05, 2, "continuous"), 6), round(forward_rate(0.04, 1, 0.05, 2, "compounded", 2), 6))1print(round(forward_rate(0.05, 1, 0.04, 2), 6))2
0.060096 0.057692 0.06 0.060049 0.030095
- 1The same two rates, four compounding rules.
- 2A falling curve has a low forward.
*Check:* the forward rate is 0.060096 with annual compounding (1.05² ÷ 1.04 − 1), 0.057692 with simple interest, 0.06 with continuous compounding and 0.060049 with semiannual compounding. For the falling curve it is 0.030095. *What to notice:* with continuous rates the forward rate is just 2 × 5% − 1 × 4% = 6%, a subtraction; that is why many models use continuous rates. With any other rule you must divide the growths, and the answer depends on the rule.
The value of a list of cash flows
A bond is a list of cash flows, each with a time in years and an amount. Its value today is the sum of the amounts times their discount factors. The simplest model uses one rate for all of them, the yield of the bond. A bond whose coupon rate equals its yield is worth exactly its face value, and a higher yield gives a lower value: the amounts are the same, and they are discounted more.
Worked example 4. *Problem:* value a 2-year bond with face value 100 and a 5% coupon paid twice a year (cash flows of 2.5 every half year, and 102.5 at the end) at yields of 4%, 5% and 6% compounded twice a year; then at a 5% continuous rate and at a 5% rate compounded once a year. *Plan:* use present_value. *Steps:* below.
bond = [(0.5, 2.5), (1.0, 2.5), (1.5, 2.5), (2.0, 102.5)]print([round(present_value(bond, rate, "compounded", 2), 4) for rate in (0.04, 0.05, 0.06)])1print(round(present_value(bond, 0.05, "continuous"), 4), round(present_value(bond, 0.05, "compounded", 1), 4))2
[101.9039, 100.0, 98.1415] 99.8815 100.1148
- 1Par at its own yield, and a lower value at a higher yield.
- 2The same 5% under two other rules.
*Check:* the bond is worth 101.9039 at 4%, 100.0 at 5% and 98.1415 at 6%. At 5% continuous it is worth 99.8815, and at 5% compounded once a year 100.1148. *What to notice:* the same "5%" gives three different values, so the bond price is only defined when the rate comes with its compounding rule. Market quotes always do.
Real yields on three days
Worked example 5. *Problem:* take the 1, 2, 5 and 10-year Treasury yields of three days, as rates compounded twice a year. For each day find the discount factors, the equivalent continuous and annual rates, the 1y1y forward (year 1 to year 2) and the 5y5y forward (year 5 to year 10), and the value of a 10-year bond with a coupon equal to the 10-year yield: first with that one yield for every cash flow, then with each cash flow discounted at a rate interpolated from the four yields. *Plan:* study combines all the functions. *Steps:* below.
out = study(load_data())for date, row in out.items(): print(date, [round(r, 4) for r in row["rates"]], round(row["forward_1y1y"], 4), round(row["forward_5y5y"], 4), round(row["flat_value"], 4), round(row["curve_value"], 4))1
2007-07-02 [0.0497, 0.0486, 0.049, 0.05] 0.0475 0.051 100.0 100.1153 2020-08-03 [0.0012, 0.0011, 0.0022, 0.0056] 0.001 0.009 100.0 100.0579 2026-10-09 [0.0447, 0.048, 0.0502, 0.0524] 0.0513 0.0546 100.0 100.3328
- 1Yields, two forwards, and the bond valued two ways.
*Check:* on 2 July 2007 the yields were almost flat (4.97% to 5.00%); on 3 August 2020 they were near zero (0.12% to 0.56%); on 9 October 2026 they rise from 4.47% to 5.24%. The 1y1y forward is 4.75%, 0.10% and 5.13%, and the 5y5y forward is 5.10%, 0.90% and 5.46%. The 10-year bond is worth exactly 100.0 with its own yield in all three days, but 100.1153, 100.0579 and 100.3328 when each cash flow has its own rate. The discount factor of the 10-year cash flow on 9 October 2026 is 0.5962, and the 10-year rate is 5.17% continuous. *What to notice:* in 2020 the 5-year rate is 0.22% and the forward rate for years 5 to 10 is 0.90%, four times higher: the curve expected rates to rise. And one rate is not a curve: the same bond has two values, and the difference grows with the slope.
The Treasury quotes the yields of bonds that sell at par. A par yield is a kind of average of the rates for all the cash flows of the bond, so it is not the rate for a single payment at the same date. This topic treats the yields as if they were spot rates, to show how the formulas work; the topic on yield curves shows how to get the real spot rates from them.
- FunctionQuestion it answers
- compound_factor(rate, t, compounding, frequency)How much does one dollar grow into?QuantLib: InterestRate.compoundFactor
- discount_factor(rate, t, compounding, frequency)What is a future dollar worth today?uses compound_factorQuantLib: InterestRate.discountFactor
- implied_rate(factor, t, compounding, frequency)Which rate gives this growth?QuantLib: InterestRate.impliedRate
- convert_rate(rate, t, from, from_frequency, to, to_frequency)What is the same rate under another rule?uses the two functions aboveQuantLib: equivalentRate
- forward_rate(rate1, t1, rate2, t2, compounding, frequency)What rate do two rates imply for the period between them?uses compound_factor and implied_rateQuantLib: forwardRate
- present_value(cashflows, rate, compounding, frequency)What is a list of cash flows worth at one rate?uses discount_factor
What you will build
The lab follows the lecture. Task 1 is the compound factor and task 2 the discount factor. Task 3 is the implied rate, the inverse of task 1, and task 4 converts a rate from one rule to another. Task 5 is the forward rate, and task 6 is the value of a list of cash flows at one rate. Task 7 applies them all to the real Treasury yields of three days.
Next topic: Fixed-rate bonds priced from a yield. You can now discount a list of cash flows at one rate. The next topic puts the dates of the schedule together with the discounting: it prices a real bond from its yield, finds the yield from a price, and measures how the price moves when the yield moves. It also ends with the limit of this topic, a single rate for every payment, which the topics on curves will remove.
Lab · what's graded
7 tasks · 100 pts- The compound factor12 pts
- The discount factor6 pts
- The implied rate14 pts
- Converting a rate12 pts
- The forward rate14 pts
- The value of cash flows12 pts
- Three days of Treasury yields30 pts