APM466_Assignment_1___2024_Hint
pdf
keyboard_arrow_up
School
University of Toronto *
*We aren’t endorsed by this school
Course
APM466
Subject
Mathematics
Date
Feb 20, 2024
Type
Pages
5
Uploaded by GeneralPony1016
MAT1856/APM466: Mathematical Finance
Winter 2024
Assignment #1: Yield Curves
Professor: Luis Seco
Note
: Please bring any questions about this assignment to your TA’s weekly office hour.
1.1
Introduction
Due:
Monday, February 5th, 2024 at 11AM ET to be submitted online via Crowdmark.
For each weekday from Jan 8th, 2023, to January 22, 2023 (inclusive, 2 weeks worth, 10 days), collect all
historical close prices for all Canadian Government Bonds which have a maturity less than 10 years from
January 8, 2024 on the “Frankfurt” Exchange; I.e., all bonds listed via the following two links:
1.
https://markets.businessinsider.com/bonds/finder?borrower=71&maturity=shortterm&yield=
&bondtype=2%2c3%2c4%2c16&coupon=¤cy=184&rating=&country=19
2.
https://markets.businessinsider.com/bonds/finder?borrower=71&maturity=midterm&yield=
&bondtype=2%2c3%2c4%2c16&coupon=¤cy=184&rating=&country=19
The data surrounding the bonds found on the above two links will be used for calculating the
yield curve
(ytm curve),
spot curve
, and
forward curve
.
Please familiarize yourself with these definitions, as
per the links, as those will be the definitions used for this assignment.
For each bond, you will also need to collect the following information: coupon, ISIN, issue date, maturity
date. All this data is available on the “Snapshot” page before clicking through to the “Historical” page.
This assignment is split into 2 parts, the first asks questions about some fundamentals of fixed income and
mathematical finance. The second will be an empirical exercise in generating yield curves, and in particular
the 1, 2, 3, 4 and 5 year rates, and analyzing these rates through PCA.
1.2
Expectations
1. You may use R, Python, or any programming language (no Excel without approval from TA before-
hand) of your choice to answer the “empirical questions”.
2. Please have your final report typeset using L
A
T
E
Xand the following template
:
template
. The website:
www.overleaf.com
is particularly useful.
3.
Important/New:
Your report must be no longer than 3 pages long in total (excluding references)
.
4. Each of the “fundamental questions” must be answered in clear and coherent full sentences.
5. At the end of your report you must cite all references
and include a link to a GitHub repository with
all your code
used for the project.
6. You may, and are encouraged, to discuss how to do these questions with your peers. However, your
write-up must be done individually, and the sharing of your write-up or code before the deadline is
prohibited.
7. A 5% penalty per day past the deadline up until 1 week (35%) will apply for late submissions.
Additional Notes:
Marks will be awarded for each question as either full-, half-, or zero-marks according to if
the question was answered with a few small mistakes, substantial mistakes but fundamental idea still correct, or
fundamental idea wrong / no answer respectively. -10 marks (each) if expectations 2, 3, or 4 not adhered to.
1
Assignment 1: Yield Curves, Luis Seco
2
2
Questions
2.1
Fundamental Questions - 25 points
1.
(5 points total)
(One sentence each.)
(a)
(1 point)
Why do governments issue bonds and not simply print more money?
(b)
(2 points)
Give a hypothetical example of why the long-term part of a yield curve might flatten.
(c)
(2 points)
Explain what quantitative easing is and how the (US) Fed has employed this since
the beginning of the COVID-19 pandemic.
2.
(10 points)
We asked you to pull data for all bonds, but if you’d like to construct a yield a “0-5 year”
yield & spot curves, as the government of Canada issues all of its bonds with a semi-annual coupon,
when bootstrapping you’ll only need 10 or 11 bonds to perform this task. Ideally, the bonds in any
yield curve should be consistent in some way with one another so that yields are easier to compare.
Select (list) 10 bonds that you will use to construct the aforementioned curves with an explanation
of why you selected those 10 bonds based on the characteristics we asked you to collect for each bond
(coupon, issue date, maturity date, etc.).
(
Note:
1) There is a unique ideal answer, 2) To easily refer to a bond, please use the following
convention: “CAN 2.5 Jun 24” refers to the Canadian Government bond with a maturity in June 24
and a coupon of 2.5
)
.
3.
(10 points)
In a few plain English sentences, in general, if we have several stochastic processes for
which each process represents a unique point along a stochastic curve (assume points/processes are
evenly distributed along the curve), what do the eigenvalues and eigenvectors associated with the
covariance matrix of those stochastic processes tell us?
(
Hint: This is called Principal Component Analysis
)
2.2
Empirical Questions - 75 points
4.
(40 points total)
(a)
(10 points)
First, calculate each of your 10 selected bonds’ yield (ytm). Then provide a well-
labeled plot with a 5-year yield curve (ytm curve) corresponding to each day of data superim-
posed on-top of each other.
You may use any interpolation technique you deem appropriate
provided you include a reasonable explanation for the technique used.
(b)
(15 points)
Write a pseudo-code (explanation of an algorithm) for how you would derive the
spot curve with terms ranging from 1-5 years from your chosen bonds in part 2. (Please recall
the day convention simplifications provided in part 2 as well.) Then provide a well-labeled plot
with a 5-year spot curve corresponding to each day of data superimposed on-top of each other.
(c)
(15 points)
Write a pseudo-code for how you would derive the 1-year forward curve with terms
ranging from 2-5 years from your chosen bonds in part 2 (I.e., a curve with the first point being
the 1yr-1yr forward rate and the last point being the 1yr-4yr rate). Then provide a well-labeled
plot with a forward curve corresponding to each day of data superimposed on-top of each other.
5.
(20 points)
Calculate two covariance matrices for the time series of daily log-returns of yield, and
forward rates (no spot rates). In other words, first calculate the covariance matrix of the random
variables
X
i
, for
i
= 1
, . . . ,
5, where each random variable
X
i
has a time series
X
i,j
given by:
X
i,j
= log(
r
i,j
+1
/r
i,j
)
,
j
= 1
, . . . ,
9
then do the same for the following forward rates - the 1yr-1yr, 1yr-2yr, 1yr-3yr, 1yr-4yr.
6.
(15 points)
Calculate the eigenvalues and eigenvectors of both covariance matrices, and in one sen-
tence, explain what the first (in terms of size) eigenvalue and its associated eigenvector imply.
Assignment 1: Yield Curves, Luis Seco
3
3
Hints
Dear Students, please review the comments and guidelines below and if you still have any questions or
confusion, do not hesitate to email me directly. -Azin
azin.sharifi@utoronto.ca
.
3.1
Google Colab Template for Bootstrapping
Here is a template I uploaded for you in Google Colab to get started. You do not have to choose Python
or this template. You could do your assignment in R, C, or any other language you like. This is just for
you to have a rough idea of where to start.
-
Template Bootstrapping on Google Colab
3.2
Present Value of a Bond
First, it’s important to understand the present value formula for a bond. A bond’s present value (PV) is
calculated by discounting the future cash flows (both coupon payments and the face value) back to the
present time. The formula is:
PV
=
n
YYYYYYY
t
=1
C
(1 +
r
t
)
t
+
F
(1 +
r
n
)
n
Here
C
is the coupon payment,
F
is the face value of the bond (paid at maturity),
r
t
is the spot rate for
each period
t
,
n
is the number of periods until maturity.
3.3
Bootstrapping Method
The bootstrapping method is used to derive the spot rate curve from the prices of coupon-bearing bonds.
The spot rate for a particular maturity is the interest rate that makes the present value of the bond’s
payments equal to its current market price. The formula for bootstrapping is iterative, starting from the
shortest maturity bond. For the first bond (1-year bond), the spot rate
r
1
is:
r
1
=
F
+
C
P
1
n
−
1
For subsequent bonds, the formula becomes more complex as it involves solving for the spot rate that
equates the present value of the bond’s cash flows to its current price, considering the spot rates already
calculated for shorter maturities. For a bond maturing in
n
years:
P
=
n
−
1
YYYYYYY
t
=1
C
(1 +
r
t
)
t
+
C
+
F
(1 +
r
n
)
n
Here
r
n
is the spot rate for the
n
-year bond, which is the unknown in the equation and needs to be solved
iteratively.
3.4
Zero-Coupon Bond
For a zero-coupon bond, the formula is simpler as there are no intermediate coupon payments. The spot
rate for a zero-coupon bond is directly calculated from its price:
r
=
F
P
1
n
−
1
In this case:
F
is the bond’s face value or maturity value,
P
is the bond’s current price,
n
is the number
of years to maturity, and
r
is the annual spot rate.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Assignment 1: Yield Curves, Luis Seco
4
3.5
Forward rates from Spot rates
The formula to calculate a forward rate
F
t,t
+
n
for the period between time
t
and
t
+
n
is:
F
t,t
+
n
=
(1 +
S
t
+
n
)
t
+
n
(1 +
S
t
)
t
1
n
−
1
Here:
S
t
+
n
is the spot rate for the period ending in
t
+
n
,
S
t
is the spot rate for the period ending in
t
,
F
t,t
+
n
is the forward rate from time
t
to
t
+
n
.
The assumption is that the rates are compounded annually. If rates are compounded more frequently (
semi-annually, or quarterly), the formula needs to be adjusted to account for the compounding frequency.
For instance, for semi-annual compounding, the formula would be modified to:
F
t,t
+
n
=
(1 +
S
t
+
n
)
2(
t
+
n
)
(1 +
S
t
)
2
t
1
2
n
−
1
In this modified formula, the exponents are multiplied by the number of compounding periods per year ( 2
for semi-annual), and the division in the exponent of the final term is by the total number of compounding
periods over the forward rate term ( 2n for semiannual over n years).
The formula to calculate forward rates from spot rates is slightly different from the discrete compounding
case. In continuous compounding, interest is effectively compounded an infinite number of times per year.
3.6
Continuous Compounding
The formula to calculate a forward rate
F
t,t
+
n
for the period between time
t
and
t
+
n
under continuous
compounding is:
F
t,t
+
n
=
S
t
+
n
·
(
t
+
n
)
−
S
t
·
t
n
Here:
S
t
+
n
is the continuously compounded spot rate for the period ending in
t
+
n
,
S
t
is the continuously
compounded spot rate for the period ending in
t
,
F
t,t
+
n
is the forward rate from time
t
to
t
+
n
.
In continuous compounding, the value of an investment grows according to the exponential function, and
the spot rates are interpreted as the force of interest. This formula calculates the equivalent annual forward
rate for the period between
t
and
t
+
n
based on the spot rates.
3.7
Calculating Covariance Matrices for Daily Log-Returns of Yield and For-
ward Rates
3.7.1
Time Series of Daily Log-Returns
Question 5 is about calculating covariance matrices for time series of daily log returns. Log-returns are com-
monly used in finance for their convenient properties, such as time-additivity and approximate normality
for small returns.
The log-return for a day
j
is calculated using the formula
X
i,j
= log
r
i,j
+1
r
i,j
, where
r
i,j
and
r
i,j
+1
are the
rates for consecutive days.
3.7.2
Understanding
i
and
j
i
: This index represents different variables or instruments being considered.
In your case, for the yield
rates,
i
= 1
, . . . ,
5 implies you have five different yield rates (for example, they could be yields for different
maturities).
j
: This index represents different time points or days in your time series. In your case,
j
= 1
, . . . ,
9 suggests
you are looking at a time series of 9 days for each yield rate.
Assignment 1: Yield Curves, Luis Seco
5
3.7.3
Covariance Matrices
Please note that the first step is to calculate the daily log returns for each yield rate across the 9 days.
You’ll end up with a series of log returns for each
i
. Then, calculate the covariance matrix for these log
returns. The covariance matrix will show how the returns of these different yield rates co-vary with each
other over the period. In a matrix form, each element of the matrix represents the covariance between the
log returns of yields
i
and
i
′
.
3.7.4
Applying the Same to Forward Rates
The same methodology is then applied to forward rates specified (1yr-1yr, 1yr-2yr, 1
yr
−
3
yr,
1
yr
−
4
yr
).
These forward rates represent the rate agreed upon now for lending or borrowing over a period starting one
year from now and lasting for 1,2, 3, or 4 years, respectively. - You calculate log returns for these forward
rates similarly and then compute the covariance matrix for these returns.