0% found this document useful (0 votes)
84 views

Final Assignment: 42106 Financial Risk Management

The document is a final assignment report for a course on financial risk management. It discusses methods for estimating the value-at-risk (VaR) of a portfolio containing various asset types, including: 1) Using historical exchange rate data to estimate the VaR of foreign currency exposure. 2) Mapping portfolio assets to market factors to estimate portfolio variance and delta-normal VaR for equities, options, and bonds. 3) Approximating the risk of a currency forward contract based on the risks of the exchange rate and interest rates. 4) Using bond duration to estimate the interest rate risk of a bond portfolio. The report implements these VaR estimation techniques in MATLAB code provided in the appendix to

Uploaded by

Jonatan Bording
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Final Assignment: 42106 Financial Risk Management

The document is a final assignment report for a course on financial risk management. It discusses methods for estimating the value-at-risk (VaR) of a portfolio containing various asset types, including: 1) Using historical exchange rate data to estimate the VaR of foreign currency exposure. 2) Mapping portfolio assets to market factors to estimate portfolio variance and delta-normal VaR for equities, options, and bonds. 3) Approximating the risk of a currency forward contract based on the risks of the exchange rate and interest rates. 4) Using bond duration to estimate the interest rate risk of a bond portfolio. The report implements these VaR estimation techniques in MATLAB code provided in the appendix to

Uploaded by

Jonatan Bording
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

42106 Financial Risk Management

Final Assignment
by
Jonatan Bording (s091100)

at

Technical University of Denmark

Spring 2014

DTU Management Engineering, Building 426


2800 Kgs. Lyngby, Denmark

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Contents
1

Introduction

Methods

2.1
2.2
2.3
2.4
2.5
2.6
3

Foreign currency risk . . . . . . . . . . . . . . . . . . . .


Portfolio mapping . . . . . . . . . . . . . . . . . . . . . .
Delta-normal VaR for a portfolio of equities and options
Delta-normal VaR of a currency forward contract . . . .
Bond duration portfolio mapping . . . . . . . . . . . . .
Bond portfolio VaR . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

DTU

9
9
10
10
11
11
12
12
13
14
14

Computing risk due to EUR exposure


Computing equity and options risk .
Computing forward contracts risk . .
Computing Bond risk . . . . . . . . .
Total VaR . . . . . . . . . . . . . . .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

Risk reduction

5.1
5.2
5.3
5.4
5.5
5.6

3
4
4
6
7
8
9

Implementation and Results

4.1
4.2
4.3
4.4
4.5
5

.
.
.
.
.
.

Description of the data

3.1 Portfolio . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.1 Mutual funds, stocks and options in portfolio
3.1.2 Forward contract in portfolio . . . . . . . . .
3.1.3 Bonds in portfolio . . . . . . . . . . . . . . . .
3.2 Risk factors . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 EURUSD Exchange rates . . . . . . . . . . .
3.2.2 GBPUSD Exchange rates . . . . . . . . . . .
3.2.3 Interest rates . . . . . . . . . . . . . . . . . .
3.2.4 Equity market risk factors . . . . . . . . . . .
3.2.5 Bond risk factors . . . . . . . . . . . . . . . .
4

.
.
.
.
.
.

14
15
18
20
22
23

Fixing the price of EUR . . . . . . . .


Optimal hedge ratio . . . . . . . . . .
Minimum variance optimization . . . .
Delta hedging . . . . . . . . . . . . . .
Hedging forward contract using options
Duration hedging . . . . . . . . . . . .

.
.
.
.
.
.

.
.
.
.
.
.

Jonatan Bording

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

23
23
24
24
25
26
1

42106 Financial Risk Management


Student no.: 091100

Final Assignment

A Computing risk due to EUR exposure

27

Computing equity and options risk

27

Computing forward contract risk

30

D Computing bonds risk

DTU

33

Jonatan Bording

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Introduction

A portfolio consisting of multiple assets is exposed to the risk of a loss which might result
from typical movements in nancial markets. The value-at-risk (VaR) is a measure of the
possible downside from an investment or portfolio. It is an estimate, with a given degree
of condence, of how much one can lose from one's portfolio over a given time horizon.
The purpose of this paper is to construct of portfolio consisting of dierent types of assets
and estimate the VaR of the portfolio using the delta-normal method. The delta-normal
method estimates the VaR assuming that the distribution of the changes in the value of
the assets follow a normal distribution.
The majority of the theory presented and used methods were inspired by Philippe Jorion's
"Financial Risk Manager Handbook" 6th edition and Dan Stefanica's "A Primer for the
Mathematics of Financial Engineering" Second Edition. Calculations were accomplished
using MathWorks MATLAB 2014a with Statistical Toolbox and Financial Toolbox. Code
is provided in the appendix.

2
2.1

Methods
Foreign currency risk

Consider the exposure of some amount W to equities on a foreign currency. If we ignore


the risk associated with changes in prices of the equities, what remains is the volatily of
the foreign exchange rate as a risk factor. This is the same as a long position of W short
domestic currency long foreign currency. If we obtain historical data for the exchange
rate we can estimate the value-at-risk for this position. Let RF X be the relative change
t
in the exchange rate RF X,t = S
. Obtaining the emperical distribution of RF X we can
St
compute the valule-at-risk at a condence level on a j-step time horizon as
V aR (j) = q W

p
(j)

(1)

where q is the emperical quantile.

DTU

Jonatan Bording

42106 Financial Risk Management


Student no.: 091100

2.2

Final Assignment

Portfolio mapping

Given a portfolio consisting of N linear positions in various equities with weights w we


have that the portfolio return Rp is

Rp =

N
X

wi Ri = w1 w2

i=1

R1


i R2

. . . wN . = wT R
..

RN

t
. If we express the return of an individual equity i as a linear combination
where Ri,t = P
Pt
of a constant i,0 , components due to market changes (i,k for k = 1, .., K ) and an error
term i we have

h
Ri = 1 F1 F2

i,0


i,1

. . . FK i,2
+ i = F i + i
..
.

i,K

(2)

where Fk is the k-th market factor and i,k is the sensitivity of asset i to market factor
Fk for k = 1, 2, . . . , K .
Written in matrix-form, the portfolio return can then be decomposed into
Rp = wT ( T F + ) = wT T F + wT

(3)

where is a K + 1 N matrix.
2.3

Delta-normal VaR for a portfolio of equities and options

If the market factors and the residuals error in (3) are independent and we assume that
the residual errors are uncorrelated, the variance of the equity porfolio is
p2 = V [Rp ] = wT T F w + wT 2 w

If the portfolio is well diversied the variance of the residuals should be small and we
thereby have
p2 wT T F w
(4)

DTU

Jonatan Bording

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Hence, we if we map the equities in our portfolio to certain market factors we can estimate
the portfolio variance by only concentrating on a few market factors instead of computing
the covariance of all assets in our portfolio.
If we assume that the returns and the market factors for our portfolio are jointly
normally distributed, we can compute the portfolio VaR for the equities on a j-step timehorizon as
p
VaR (j) = z p jVp
(5)
where Vp is the current value of the equity portfolio and z is a standard normal deviate
at a certain condence level .
If our portfolio holds options we have to modify (5) slightly. We can approximate the
change in the price of an option as the product of the delta and the change in price of the
underlying
f (S, t) = S

(6)

The delta for a European call option on a asset can be calculated from the BlackScholes formula as
= N (d1 )
(7)
ln
d1 =

S
K



2
+ r q + 2 (T t)

T t

where S is the spot price of the underlying at time t; T is the maturity-date of the option;
r is the risk-free interest rate (assumed to be constant); q is the continuous dividend rate
of the underlying, and is the standard deviation of the returns on the underlying.
If we wish to map the change the price of an option to market factors we can given (6)
and (2) write the approximation
Roption,i (FT i + i )i

(8)

We can then modify (4) by introducing a N 1 vector d with entries di such that
di =

if the i-th asset is an equity

if the i-th asset is an option

(9)

and write
p2 (w d)T T F (w d)

(10)

where denotes the entrywise product. We then have that the delta-normal VaR for this
DTU

Jonatan Bording

42106 Financial Risk Management


Student no.: 091100

Final Assignment

mixed portfolio is
q
p
VaR (j) = z (w d)T T F (w d) jVp

2.4

(11)

Delta-normal VaR of a currency forward contract

The market value at time t of a forward contract on a foreign currency is given by


ft = St

1
1
K

1 + rt T
1 + rt T

(12)

where St is the spot price of foreign currency, rt is an interest rate on the foreign currency,
rt is the interest rate on the domestic currency, T is the time to maturity (in years) and
K is the delivery price. If we denote the present value of one unit of currency at maturity
as P V and P V we can rewrite (12) as
ft = St P Vt K P Vt

(13)

taking the derivative of (13), we obtain


dSt
dP V
dP V
(K P V )
+ (St P V )

St
PV
PV

(14)

P V
P V
St
+ (St P V )
(K P V )

St
PV
PV

(15)

dft = (St P V )

We can approximate (14) as


ft = (St P V )

We see that the change in the price of the forward contract is exposed to three risk factors;
St P V
V
, P V and P
. Let the time to maturity T = tM tt+1 . We then have that
St
PV
P V
=
PV

1
1+rt (t1m tt )
1+rt+1 (tm tt+1 )
1
1+rt (tm tt )

1 + rt (tm tt )
1
1 + rt+1 (tm tt+1 )

Thus, if we obtain historical data for the exchange rate and the interest rates we can compute the covariance of the risk factor and thereby estimate
the variance of ft . Let de- i
h
0
note the covariance matrix of the risk factors and let x = (St P V ) (St P V ) (K P V ) .
The variance in the change of the price for the forward contract is then
2
= V [ft ] = x0 x
f
t

DTU

Jonatan Bording

(16)

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Assuming that risk factors are jointly normally distributed we can compute the VaR
VaR (j) = z ft j
p

2.5

Bond duration portfolio mapping

The Macaulay duration of a bond is the weighted average time until repayment, i.e.
DM ac

n
1 X ti CFi
=
B i=1 (1 + ykk )kti

(17)

where B is the bond price, i is index of a cashow, k is annual compounding frequency,


CFi is the i-th cashow, ti is the time in years until the i-th cashow is received and yk
is the periodically compounded yield to maturity.
Let Dmod dened as Dmod = B1 dB
be the modied duration of a bond measuring the
dy
price sensitivity of the bond with respect to the yield normalized by the bond price. A
relative change in the price of a bond can be approximated as
B
Dmod y
B

(18)

The modied duration can be calculated as


Dmod =

Dmac
(1 + ykk )

Multiplying (18) by the bond price B we obtain


B BDmod y

(19)

If we denote the dollar duration D$ = BDmod as the unnormalized version of the modied
duration, then (19) can be written as
(20)

B D$ y

For a portfolio VB consisting of bonds we then have


VB =

N
X
i=1

Bi

N
X

D$,i yi

(21)

i=1

For many bonds it is not possible to obtain historical data. Therefore we need to
map each position in our bond portfolio to some risk factor(s). One approach is duration
DTU

Jonatan Bording

42106 Financial Risk Management


Student no.: 091100

Final Assignment

mapping, which maps bonds according to their Dmac to the closest possible maturity of
a zero-coupon bond for which historical data is available. As an example, lets consider
a standard grid of maturities of 1, 3, 5 and 10 years. Let Dmac and D$ be vectors
containing the macaulay durations and the dollar durations, respectively, for the bonds in
our portfolio and let n be a vector where ni is the number of units of the i-th bond in the
portfolio. Let xD$ be a vector where the k-th elements is the sum of the dollar durations
of the bonds in our portfolio for which their macaulay durations where nearest to the k-th
standard maturity. If we have N number of bonds in our porfolio the mappings can be
described as f : RN 3 N4

P
N
n D 1(Dmac,i )[0,2)
Pi=1 i $,i

n
D
1(D
)
i
mac,i
$,i
[2,4)

f (Dmac , D$ , n) = PNi=1
= xD $

n
D
1(D
)
i
mac,i
$,i
[4,7.5)
i=1
P

N
n
D
1(D
)
mac,i [7.5,)
i=1 i $,i

1 if Di A
.
where 1(Dmac,i )A =
0 if D
/A

(22)

Using this mapping we can now rewrite (21) as

VB xTD$ r +

(23)

where r is the changes in the zero rates (i.e. the changes in the yields for the standard
grid of maturities).
2.6

Bond portfolio VaR

If we take the variance of (23) and we assume that the errors are uncorrelated with the
changes in the zero rates we get
V [VB ] xTD$ r xD$ + 2

If the portfolio is well-diversied the error term should be relatively small and we can
therefore instead write
2
V
xTD$ r xD$
(24)
B

DTU

Jonatan Bording

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Assuming that the changes in the zero rates are jointly normally distributed we can now
compute the j-step value-at-risk for a bond portfolio as
VaR (j) = z VB j
p

Description of the data

3.1

Portfolio

The constructed porfolio consists of; 1 forward contract on British pounds, 5 dierent
U.S. mutual funds, 7 dierent U.S. stocks, 3 dierent stocks traded on Xetra (Frankfurt),
3 dierent European call stock options on U.S. stocks, and 15 dierent coupon-bearing
U.S. treasury bonds.
3.1.1

Mutual funds, stocks and options in portfolio

Prices and specications for the mutual funds, stocks, options and bonds were obtained
from finance.yahoo.com/ and specications are summarized in table 2.

Investment Type
Ticker / Underlying Currency Holding Strike Maturity date Dividend
Mutual fund
MUTF:VESIX
USD 1m USD
Mutual fund
MUTF:FANAX
USD 1m USD
Mutual fund
MUTF:TFSIX
USD 1m USD
Mutual fund
MUTF:BGSAX
USD 1m USD
Mutual fund
MUTF:JDESEAX
USD 1m USD
Stock
NASDAQ:MSFT
USD 1m USD
Stock
NASDAQ:EBAY
USD 1m USD
Stock
NYSE:IBM
USD 1m USD
Stock
NYSE:WMT
USD 1m USD
Stock
NYSE:XOM
USD 1m USD
Stock
NYSE:CVX
USD 1m USD
Stock
NYSE:C
USD 1m USD
Stock
FRA:DBK
Euros 1m USD
Stock
FRA:BAS
Euros 1m USD
Stock
FRA:LHA
Euros 1m USD
European Call Option
NYSE:JPM
USD 1m USD 52.50
20-Sep-14
0.38%
European Call Option NASDAQ:INTC
USD 1m USD 24.50
18-Oct-14
0.225%
European Call Option
NYSE:UTX
USD 1m USD 120.00 17-Jan-15
0.59%
Table 1: Mutual funds, Stocks and Options in portfolio.
Weekly historical data for the equities were obtained from 04-May-2004 to 06-May2014. The time series are plotted in gure 1.
DTU

Jonatan Bording

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Figure 1: Weekly movements in mutual funds and Stocks in portfolio from 04-May-2004 to 06-May-2014.
3.1.2

Forward contract in portfolio

The forward contract in the portfolio assumes that we buy 10, 000, 000 at a price of
$16, 725, 000 on 20-Aug-2014 specied as

Delivery
Purchase price K Maturity date tm
GBP 10,000,000 USD 16,725,000
20-Aug-2014
Table 2: Forward Contract.
3.1.3

Bonds in portfolio

Bonds in portfolio are summarized in table 3.

DTU

Jonatan Bording

10

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Type Clean Price Coupon Rate Settlement date Maturity date


T-NOTE 102.14
2.125%
5-May-2014
31-May-2015
T-NOTE 104.12
4.125%
5-May-2014
15-May-2015
T-NOTE 102.73
1.750%
5-May-2014
31-May-2016
T-NOTE 105.83
3.250%
5-May-2014
31-May-2016
T-BOND 123.61
8.750%
5-May-2014
15-May-2017
T-NOTE
99.14
0.625%
5-May-2014
31-May-2017
T-NOTE 104.82
2.500%
5-May-2014
30-Jun-2017
T-NOTE 107.17
3.125%
5-May-2014
15-May-2019
T-NOTE
97.35
1.125%
5-May-2014
31-May-2019
T-BOND 139.45
8.125%
5-May-2014
15-May-2021
T-NOTE 106.29
3.125%
5-May-2014
15-May-2021
T-NOTE
96.25
2.000%
5-May-2014
15-Feb-2023
T-NOTE 101.96
0.625%
5-May-2014
15-Jan-2024
T-BOND 141.91
6.750%
5-May-2014
15-Aug-2026
T-BOND 130.25
5.500%
5-May-2014
15-Aug-2028

Issue date First Coupon date


31-May-2010
30-Nov-2010
15-May-2005
15-Nov-2005
31-May-2011
30-Nov-2011
31-May-2009
30-Nov-2009
15-May-1987
15-Nov-1987
31-May-2012
30-Nov-2012
30-Jun-2010
31-Dec-2010
15-May-2009
15-Nov-2009
31-May-2012
30-Nov-2012
15-May-1991
15-Nov-1991
15-May-2011
15-Nov-2011
15-Feb-2013
15-Aug-2013
15-Jan-2014
15-Jul-2014
15-Aug-1996
15-Feb-1997
15-Aug-1998
15-Feb-1999

units
200
100
150
120
100
170
100
100
130
200
190
140
140
130
160

Table 3: Specications for bonds in portfolio. Face value for all bonds are $10,000. Prices are given as
percentage of face value. Units refer to the number of units of each bond in portfolio.

3.2
3.2.1

Risk factors
EURUSD Exchange rates

In our portfolio we have a 3m USD exposure to euros due to investments in 3 German


stocks. Hence, we need data for the EUR/USD price ($ per 1 ). Historical weekly
data for EUR/USD exchange rate from 15-May-2004 to 05-May-2014 was obtained from
oanda.com. The data is plotted in gure 2

Figure 2: Weekly movements EUR/USD exchange rate ($ per 1 ) from 15-May-2004 to 05-May-2014.

DTU

Jonatan Bording

11

42106 Financial Risk Management


Student no.: 091100

3.2.2

Final Assignment

GBPUSD Exchange rates

We have a forward contract on 10m British pound in USD. Therefore we need data for the
GBP/USD exchange rate ($ per 1 ). Historical weekly data from for the GPB/USD rates
from 9-May-2004 to 5-May-2014 was obtained from oanda.com. The data is plotted in
gure 3

Figure 3: Weekly movements in EUR/USD exchange rate ($ per 1 ) from 9-May-2004 to 5-May-2014.
3.2.3

Interest rates

Risk factors on the forward contract include USD interest rates and GBP interest rates.
Historical data from 7-May-2004 to 3-May-2014 for 3-month LIBOR rates on GBP and
USD was obtained from the Federal Reserve Economic Data (research.stlouisfed.org/fred2).
The data is plotted in gure 4.

DTU

Jonatan Bording

12

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Figure 4: Weekly movements in 3-months LIBOR rates on GBP and USD.


3.2.4

Equity market risk factors

Based on the industry sectors of the equities in our portfolio, the following market indices was identied as risk factors: Dow Jones Industrial Average Index, NYSE US 100
Index, NASDAQ Computer Index, KBW Bank Index, Dow Jones U.S Oil and Gas Index and DAX (Deutscher Aktien Index). Weekly historical data was obtained from
finance.yahoo.com/ and is plotted in gure 5.

Figure 5: Weekly movements in Stock market indices from 04-May-2004 to 06-May-2014. Abbreviations:
NASDAQ Computer Index, IXCO; NYSE 100 Index, NY; Dow Jones Industrial Average Index, DJI; KBW
Bank Index, BKX; Dow Jones U.S Oil and Gas Index, DJUSEN; Deutscher Aktien Index, DAX.

DTU

Jonatan Bording

13

42106 Financial Risk Management


Student no.: 091100

3.2.5

Final Assignment

Bond risk factors

As risk factors for the Bonds in the portfolio, yields for 1 year, 3 year, 5 year and 10 year
zero-coupon US Treasury bonds was choosen. Weekly historical yields from 7-May-2004
to 03-May-2014 was obtained from the Federal Reserve Economic Data
(research.stlouisfed.org/fred2/). The data is plotted in gure 6.

Figure 6: Weekly movements in yields (as percentages) of US zero-coupon Treasury Bonds with dierent
maturities.

4
4.1

Implementation and Results


Computing risk due to EUR exposure

We hold a position of 3m USD worth of stocks in euros. Changes in EUR/USD exchanges


rates is computed as
RF X,t+1 =

St+1
1
St

The empirical distribution of the changes in EUR/USD is plotted in gure 7.

DTU

Jonatan Bording

14

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Figure 7: Distribution of relative weekly changes ind EUR/USD exchanges rate the past 10 years.
We nd that the 5% emperical quantile is q0.05 = 0.017463. Using (1) we get
p
V aR0.05 (2)EU RU SD = 0.017463 $3, 000, 000 (2) = $74, 090

for the 10 business day (2 weeks) 5% VaR. (see appendix A for matlab code)
4.2

Computing equity and options risk

First, we compute the returns on the market indices and on the equities in our portfolio
computed as Rt+1 = PPt+1
1. The results are plotted in gure 8.
t

DTU

Jonatan Bording

15

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Figure 8: Returns on market indices and on stocks and mutual funds in portfolio.Red lines illustrates
tted normal curve.

We see that that the returns are centered around zero and seem stationary in most
periods.
In gure 9 we also see that the distributions of most of the market indices look normal.

DTU

Jonatan Bording

16

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Figure 9: Distributions of the returns on the market indices.


In order to map the portfolio positions to the market indices as in (2), we perform
multivariate linear regression between the equity returns and the market indices. Results
are summarized in table 4
Ticker / Underlying

Intercept (0 )

IXCO (1 )

NY (2 )

DJI (3 )

BKX (4 )

DJUSEN (5 )

DAX (6 )

R2

MUTF:VESIX

0.0000

0.0835

0.3482

0.0651

0.0141

0.1971

0.4588

0.8452

MUTF:FANAX

0.0002

0.1702

0.0360

0.4413

0.0738

1.1462

0.1527

0.9425

MUTF:TFSIX

0.0000

0.0651

0.4069

0.1088

0.0653

0.0036

0.2130

0.8033

MUTF:BGSAX

0.0002

0.7223

0.3803

0.0828

0.0580

0.0080

0.0460

0.8980

MUTF:JDESEAX

0.0005

0.1734

0.8022

0.0092

0.0193

0.0123

0.0141

0.9876

NASDAQ:MSFT

0.0002

0.7562

0.6655

0.9337

0.0503

0.0755

0.0223

0.5000

NASDAQ:EBAY

0.0003

0.8446

0.4891

0.1226

0.0597

0.0281

0.0058

0.3760

NYSE:IBM

0.0005

0.3255

1.0920

1.6782

0.0061

0.0056

0.0207

0.6028

NYSE:WMT

0.0013

0.1932

0.7858

0.7900

0.1751

0.2755

0.1545

0.4148

NYSE:XOM

0.0007

0.2238

0.0809

0.6141

0.1222

0.6518

0.1227

0.7911

NYSE:CVX

0.0009

0.2008

0.1010

0.4589

0.0692

0.7798

0.0738

0.8357

NYSE:C

0.0031

0.0301

0.0250

0.1576

1.1983

0.0625

0.0469

0.8364

FRA:DBK

0.0017

0.0499

0.5470

0.7581

0.3701

0.0985

1.2484

0.6324

FRA:BAS

0.0032

0.0416

0.6211

1.2850

0.0380

0.3079

1.1571

0.3468

FRA:LHA

0.0000

0.1130

0.1477

0.0660

0.0770

0.2288

0.8695

0.5129

NYSE:JPM

0.0024

0.0838

0.6959

0.1803

0.8515

0.2588

0.0394

0.7773

0.0008

0.9123

0.6873

0.9878

0.0245

0.0734

0.0708

0.6032

0.0013

0.0552

0.7919

1.6230

0.0608

0.0142

0.0768

0.6955

NASDAQ:INTC
NYSE:UTX

Table 4: Results from multivariate linear regression between returns on stocks and mutual funds and
returns on market indices.

From the coecients of determination (R2 ) we see that most of the volatility in the
portfolio can be explained by the market indices. Not surprisingly, the fraction of variance
DTU

Jonatan Bording

17

42106 Financial Risk Management


Student no.: 091100

Final Assignment

unexplained is smallest for the mutual funds. We will assume that the portfolio is well
diversied such that the variance which is not explained by our model will be very small.
Going forward we compute the standard deviation of the underlyings of the options in
order to compute the deltas using (7). We obtain the vector described in (9)
i
d = 1 1 . . . 0.8183 0.9957 0.1237
0

We have equal weights in the portfolio of 1m USD in each position, so wi = 181 for
i = 1, .., 18 as N = 18. We compute the covariance matrix of the market indices F and
subsequently the portfolio variance using (10)
p2 = (w d)T T F (w d) = 0.02592

Assuming that the joint distribution of the market indices are normally distributed, we
are now able to estimate the 5% value at risk on a 10 business days horizon using (11)
p
V aR0.05 (2)stock,f unds,options = 1.6449 0.0259 $18, 000, 000 (2) = $1, 084, 563

(see appendix B for matlab code)


4.3

Computing forward contracts risk

In order to compute the value at risk for the forward contract we rst must compute
the relative monthly changes in the GBP/USD exchange rate and relative changes in the
present value of GBP and USD computed as
U SD
GBP
P Vt+1
P Vt+1
1 + rtU SD (tm tt )
1 + rtGBP (tm tt )
=

1,
=
1,
U SD
GBP
P VtU SD
1 + rt+1
(tm tt+1 )
P VtGBP
1 + rt+1
(tm tt+1 )

St+1
St+1
=
1
St
St

The risk factors are plotted in gure 10 and gure 11

DTU

Jonatan Bording

18

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Figure 10: time series of the risk factors associated with the forward contract; RS , RP V

U SD
t+1

t+1

Figure 11: Distributions of the risk factors associated with the forward contract; RS , Rr
t+1

Red lines illustrates tted normal curves.

, RP VPGBP
.
V +1

U SD
t+1

GBP .
, Rrt+1

We see that the distributions of the risk factors does not seem to approximate normal
distributions really well. They are however centered around zero and going forward we
will assume that they are normally distributed.
The current spot price for 10m GBP is St = $16, 842, 000. The delivery price is K =
$16, 725, 000. The time to maturity is 0.29166 year and the current LIBOR rates are
rtGBP = 0.005252 and rtU SD = 0.002229. Computing the vector x we get
h
i
x0 = (St P V ) (St P V ) (K P V )
h
i
= $16, 815, 996 $16, 815, 996 $16, 714, 033

By computing the covariance matrix of the risk factors and using (16) we can calculate
the variance
2
f
= x0 x = $185, 0402
t

DTU

Jonatan Bording

19

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Assuming that the risk factors are jointly normally distributed we can calculate the 5%
VaR on a 10 business day time horizon for the forward contract
V aR0.05 (2)ft = 1.6449 $185, 040

2 = $430, 436

(see appendix C for matlab code)


4.4

Computing Bond risk

In order to compute the risk associated with our bond positions we compute the week-toweek dierence in yields of our bond risk factors (zero-coupon bonds). These are plotted
in gure 12 and gure 13

Figure 12: Week-to-week dierences in yields for zero-coupon US treasury bonds (r) with dierent
maturities.

DTU

Jonatan Bording

20

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Figure 13: Distributions of Week-to-week dierences in yields for zero-coupon US treasury bonds (r)
with dierent maturities. Red lines illustrates tted normal curves.

We see that the zero rates r are centered around zero and they are highly correlated.
The distributions of the risk factors look somewhat normally distributed.
Next, we compute the durations Dmac,i and the dollar durations D$,i of the bonds in our
portfolio using (17) and store the number of units for each bond type in the portfolio in
a vector n

Dmac

DTU

1.056

0.99846

2.0293

1.9958

2.6706

3.0387

3.0317

= 4.6418

4.9174

5.6039

6.3009

8.0451

9.4094

9.1127

10.564

108.75

$105.85

$209.54

$213.55

$339.73

$300.7

$318.89

D$ = $500.22

$477.09

$794.76

$671.79

$768.33

$959.16

$1289.1

$1368.8
Jonatan Bording


200

100


150


120


100

170


100


n = 100

130


200


190


140

140


130

160

21

42106 Financial Risk Management


Student no.: 091100

Final Assignment

and using the mapping in (22) with standard maturities 1, 3, 5, and 10 years we get

f (Dmac , D$ , n) = xD$

$57961.45

$148412.85

$398636.01

$628449.85

If we compute the covariance matrix r of the changes in the zero rates we are now able
to estimate the variance of the bond positions using (24)
2
V
xTD$ r xD$ = $1170.92
B

Assuming that the risk factors are jointly normally distributed we can now estimate the
5% VaR on a 10 day time horizon
VaR (j) = 1.64485 1170.9

$10, 000
2 = $272, 371
100

(note that we multiply by $10,000


because the standard deviation was calculated based on
100
the bond prices as percentages of face value and the face values of the bonds were $10,000.
See appendix D for matlab code)
4.5

Total VaR

We have now calculated the 10 business day 5% VaR for the dierent parts of our portfolio.
Assuming that changes in the value of the dierent parts of our portfolio is uncorrelated*
we can aggregate their VaR together and we should have the value at risk for the whole
portfolio
V aR0.05 (2)total = V aR0.05 (2)EU RU SD + V aR0.05 (2)stock,f unds,options + V aR0.05 (2)ft + VaR (2)bonds
= $74, 090 $1, 084, 563 $430, 436 $ 272, 371
= $1, 861, 460

Comparing this to the total value of our portfolio


Vportf olio = Vf unds,stocks,options +ft +Vbonds = $18, 000, 000+$101, 963+$24, 007, 264 = $42, 109, 228

we can interprate the VaR as that with a probability of 5% we stand to loose


0.0442 or more of the value of our portfolio over a 2 weeks period.
DTU

Jonatan Bording

$1,861,460
$42,109,228

22

42106 Financial Risk Management


Student no.: 091100

Final Assignment

(*It is of course naive to assume that the volatility of stocks, options and funds are uncorrelated with the
volatility of bonds, interest rates and exchanges rates. Just by looking at the plots in gure 8, 10 and 12
we see that the variance increases dramatically around year 2007 to 2009 for all risk factors.)

Risk reduction

In the following subsections, describtions on how we could reduce the risk of our portfolio
is presented.
5.1

Fixing the price of EUR

We have a 3m USD exposure to EUR in our equity portfolio in the form of foreign stocks.
We could lock in the current exchange rate by shorting futures contracts on EUR and we
would thereby reduced the risk associated with movements in exchanges rates.
5.2

Optimal hedge ratio

In order to reduce the risk related to the equities in our portfolio we could short some
futures contract on some broad market index which correlates well with our equity positions. Let Vequity be the change in value of the equity positions in our portfolio. If we
short some number NF of futures contracts with dollar value F on a broad market index
then the total change in value of our portfolio will be
V = Vequity NF F

The variance of our portfolio is now


2
2
2
V
= V
+ NF2 F
NF Vequity F
equity

(25)

We want to nd the number of contracts to shorts such that we minimize the variance of
the value of our portfolio, so we take the derivative of (25) with respect to NF and set it
equal to zero
2
V
= 2NF F 2Vequity F = 0
dNF

DTU

Jonatan Bording

23

42106 Financial Risk Management


Student no.: 091100

Final Assignment

solving for NF we get


NF F = Vequity F

NF =

Vequity F
Vequity
= Vequity F
F
F

We call NF the optimal hedge ratio and Vequity F is then a measure of how much of the
volatility we would be able to hedge using the futures contracts. Letting Requity denote
the return on the equity part of our portfolio and Rindex denote the return on the market
index which the futures contract is set on. If each futures contracts deliver QF dollars
times the index such that F = QF index, then we can express the number of futures
contracts we want to short NF as
NF = Vequity F

Requity
Vequity
= Requity ,Rindex
QF Rindex
QF index

where Requity ,Rindex can be found by performing linear regression of Requity over Rindex .
5.3

Minimum variance optimization

Another way to try and reduce the risk of the portfolio could be to nd a linear combination of the weight in our portfolio that would minimize the variance f2unds,stocks . That
is, we adjust the weights of the positions in the mutual funds and stock such that we
minimize the variance
min f2unds,stocks = wT T F w

subject to

N
X

wi = 1

i=1

if we allowed for short-selling.


5.4

Delta hedging

Let i denote the value of the i-th option in our portfolio and let Si denote the current
stock price of the i-th underlying. Consider the case that we want to reduce the risk of
the option positions by shorting some number of shares ni of the underlyings on the call
options and let Ci denote the the current value of the i-th call option. The value of our
option positions is then
i (Si ) = Ci (Si ) ni Si

DTU

Jonatan Bording

24

42106 Financial Risk Management


Student no.: 091100

Final Assignment

for the i-th option. Assume that the spot price of the underlying changes to by Si + dSi
where dSi is small relative to the Si . The change in the value of our portfolio is then
i (Si + dSi ) i (Si ) = Ci (Si + dSi ) ni (Si + dSi ) (Ci (Si ) ni Si )
= Ci (Si + dSi ) C(Si ) ni dSi

(26)

We want to choose the value of ni such that for a small change in the underlying, the
value of our portfolio does not change. Hence, we want to choose ni such that
(27)

i (Si + dSi ) i (Si ) 0

Combining (27) and (26) we get


ni

Ci (Si + dSi ) C(Si )


dSi

and by letting dS 0
ni

dCi
= i
dSi

Hence, if we want to reduce the risk associated with the options in our portfolio we should
short sell i shares of the i-th underlying of each of the 3 options in our portfolio.
5.5

Hedging forward contract using options

In our forward contract we had an spot price St and a delivery price Kf with a time to
maturity Tf . Now consider that we set up a long position in an European put option Pt
and a short position in an European call option Pt on 10m GBP on both options with a
common strike Koptions and a time to maturity Toptions . The put-call parity then states
that the value of the options at time t is
Pt Ct = Koptions

1
1+

rtU SD Toptions

St

1
1+

rtGBP Toptions

The value of the forward contract ft at time t is


ft = St

DTU

1
1+

rtGBP Tf

Kf

1
1+

Jonatan Bording

rtU SD Tf

25

42106 Financial Risk Management


Student no.: 091100

Final Assignment

We then see that the combined value of the forward contract and the options is zero
ft + Pt Ct = Koptions

1
1+

rtU SD Toptions

St

1
1+

rtGBP Toptions

+ St

1
1+

rtGBP Tf

Kf

1
1+

rtU SD Tf

=0

if Tf = Toptions and Kf = Koptions . Hence, if we long a GBP put and short a GBP call
with the same strike Kf and maturity Tf we have eliminated the risk of our long position
in the forward contract with delivery price Kf and maturity Tf .
5.6

Duration hedging

If we want to reduce the risk of our bond portfolio we can hedge the dollar duration of
our bond portfolio. Let VB be the value of our bond porfolio with total dollar duration
P
D$,VB = N
i=1 D$,i . If we take an additional position of n number of units in an additional
bond Badd with a moded duration Dmod,add , the new value of the bond portfolio is then
VB,new = VB + nBadd

If we want to hedge the risk of our bond portfolio we would want the dollar duration of
our new portfolio to be zero
D$,VB,new = D$,VB + nD$,Badd = 0

nD$,Badd = D$,VB

n =

D$,VB
D$,VB
=
D$,Badd
Dmod,add Badd

Hence, we should short n number of units of the additional bond with a total dollar
duration equal to the dollar duration of our bond portfolio. It is probably unlikely that
we would be able to match the dollar durations with only one additional bond but the
idea can be expanded to multiple additional bonds
n1 Dmod,add,1 Badd,1 n2 Dmod,add,2 Badd,2 ... = D$,VB

such that a linear combination of the dollar durations of dierent additional bonds would
match the dollar duration of our portfolio. Note that, the same principles applies if we
choose to hedge using futures contracts on bonds instead.
DTU

Jonatan Bording

26

42106 Financial Risk Management


Student no.: 091100

Final Assignment

Computing risk due to EUR exposure

%% Loading exchange data

[, , rates] = xlsread('EUR_USD.xlsx');

rates = str2double(rates);

%% Load dates and plot data

time = import_dates('eur_usd_dates.csv');

ts = fints(time,rates,'EURUSD');

plot(ts)

8
9

%% Compute relative weekly changes and plot histogram

10

R_fx = rates(1:end-1)./rates(2:end)-1;

11

[f,x]=hist(R_fx,30);

12

bar(x,f/sum(f))

13

ylabel('Density')

14

xlabel('R EURUSD')

15
16

%% find 5% quantile

17

alpha = 0.05;

18

SR_fx=sort(R_fx);

19

N=size(R_fx,1);

20

q=SR_fx(floor(alpha*N));

21
22

%% Compute 10 day value at risk

23

W = 3000000;

24

VaR_fx=q*W*sqrt(2)

Computing equity and options risk

format long g

%% Load Indices

[, , Indices] = xlsread('equities.xlsx','Factors');

Indices_names = Indices(1,2:end);

Indices = Indices(2:end,2:end);

Indices = str2double(Indices);

7
8

%% Load Stocks

[, , Stocks] = xlsread('equities.xlsx','Stocks');

10

Stocks_names = Stocks(1,2:end);

11

Stocks = Stocks(2:end,2:end);

DTU

Jonatan Bording

27

42106 Financial Risk Management


Student no.: 091100

Final Assignment

12

Stocks = str2double(Stocks);

13

%% Load Mutual Funds

14

[, , Funds] = xlsread('equities.xlsx','Funds');

15

Fund_names = Funds(1,2:end);

16

Funds = Funds(2:end,2:end);

17

Funds = str2double(Funds);

18
19

%% Load options specs

20

[, , Options] = xlsread('equities.xlsx','Options');

21

Options = Options(2:end,2:end);

22

Options_Strike = str2double(Options(:,1));

23

Options_exp = Options(:,2);

24

Options_dividends = str2double(Options(:,3));

25
26

%% Bind stocks and funds

27

stocks_funds = [Funds, Stocks];

28
29

%% Plot stocks and funds movements

30

names = [Fund_names, Stocks_names]';

31

time = import_dates('DATES.csv');

32

ts = fints(time,stocks_funds,names);

33

plot(ts)

34
35

%% Plot Indices

36

ts = fints(time,Indices,Indices_names);

37

plot(ts)

38
39

%% Compute weekly returns

40

R_stocks_funds = stocks_funds(1:end-1,:)./stocks_funds(2:end,:)-1;

41

R_Indices = [ones(size(R_stocks_funds,1),1), ...


Indices(1:end-1,:)./Indices(2:end,:)-1];

42
43

%% Plot Returns on Indices and stocks/funds

44

R = R_Indices(:,2:end);

45

figure

46

subplot(2,1,1);

47

ts_rIndices = fints(time(1:end-1),R,Indices_names);

48

plot(ts_rIndices)

49

ylabel('R_F')

50

subplot(2,1,2);

51

ts_rEquities = fints(time(1:end-1),R_stocks_funds,names);

52

plot(ts_rEquities)

53

ylabel('R_s')

DTU

Jonatan Bording

28

42106 Financial Risk Management


Student no.: 091100

Final Assignment

54
55

%% Plot histograms of returns on Indices

56

figure

57

subplot(2,3,1);

58

histfit(R_Indices(:,2))

59

title(Indices_names(1))

60

subplot(2,3,2);

61

histfit(R_Indices(:,3))

62

title(Indices_names(2))

63

subplot(2,3,3);

64

histfit(R_Indices(:,4))

65

title(Indices_names(3))

66

subplot(2,3,4);

67

histfit(R_Indices(:,5))

68

title(Indices_names(4))

69

subplot(2,3,5);

70

histfit(R_Indices(:,6))

71

title(Indices_names(5))

72

subplot(2,3,6);

73

histfit(R_Indices(:,7))

74

title(Indices_names(6))

75

%% multivariate linear regression

76

n=size(stocks_funds,2);

77

Beta=zeros(size(R_Indices,2),n);

78

R_squares = size(size(Indices,2),1);

79
80

for i=1:n

81

[B,BINT,R,RINT,STATS] = regress(R_stocks_funds(:,i),R_Indices);

82

Beta(:,i)=B;

83

R_squares(i) = STATS(1);

84

end

85
86
87

%% Compute volatility of call option underlying stocks

88

sd_underlying = std(R_stocks_funds(:,end-2:end));

89
90

%% Compute

91
92

rate = 0.0009*ones(3,1);
current_date = '05-May-2014';

93

time = days360(current_date, Options_exp)/360; %time to maturity

94

Spot_prices = Stocks(1,end-2:end);

95

Deltas = zeros(3,1);

96

for i=1:3

DTU

of the call options

Jonatan Bording

29

42106 Financial Risk Management


Student no.: 091100

Deltas(i) = bls(Spot_prices(i),Options_Strike(i), rate(i), ...

97

time(i), sd_underlying(i), Options_dividends(i));

98
99

Final Assignment

end

100
101

%% compute vector d

102

d = [ones(size(R_stocks_funds,2)-3,1); Deltas];

103
104

%% Computing covariance matrix

105

Sigma_F = cov(R_Indices);

106
107

%% compute portfolio volatility

108

% assets are equally weighted

109

w = ones(size(R_stocks_funds,2),1)/size(R_stocks_funds,2);

110

sd_portfolio = sqrt((w.*d)'*Beta'*Sigma_F*Beta*(w.*d));

111
112

%% compute 10-day (business days) 5% Value at risk

113

V_p = 1000000*size(R_stocks_funds,2);

114

j = 2; % 10 days business days is 2 weeks

115

z = norminv(0.05);

116

VaR_equities = z*sd_portfolio*V_p*sqrt(2);

117
118

%% Risk reduction

119

%% find minimum variance weights of mutual funds and stock positions

120

A=ones(1,15);

121

b=1;

122

Aeq = ones(1,15);

123

beq=1;

124
125

fun =@(w) w'*Beta(:,1:15)'*Sigma_F*Beta(:,1:15)*w;


x0=w(1:15);

126

x = fmincon(fun,x0,A,b,Aeq,beq);

127
128

%% compute new total weighting and new VaR

129

new_w = [x*length(x); ones(3,1)]/18;


VaR_pnew = z*sqrt(new_w'*Beta'*Sigma_F*Beta*new_w)*V_p*sqrt(2)

130
131
132

%% Include 3 new

133

new_w = [new_w; d(end-2:end)]

short positions in portfolio

Computing forward contract risk

1
2

%% Load 3-month libor rates

DTU

Jonatan Bording

30

42106 Financial Risk Management


Student no.: 091100

Final Assignment

%time = import_dates('3month-T-bill_dates_US.csv');

[, , raw] = xlsread('liborrates.xlsx','Sheet1');

raw(cellfun(@(x) isempty(x) && isnumeric(x) && isnan(x),raw)) = {''};

R = cellfun(@(x) isnumeric(x) && islogical(x),raw);

raw(R) = {NaN};

data = reshape([raw{:}],size(raw));

libor_GBP = data(:,1);

10

libor_GBP = libor_GBP(isfinite(libor_GBP(:, 1)), :);

11

libor_USD = data(:,2);

12

libor_USD=libor_USD(isfinite(libor_USD(:, 1)), :);

13
14

%% import dates

15

filename = 'D:\Copy\Courses\Financial Risk ...


Management\Final\mcode\liborrate-dates.csv';

16

delimiter = '';

17

formatSpec = '%s%[^\n\r]';

18

fileID = fopen(filename,'r');

19

dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, ...


'EmptyValue' ,NaN, 'ReturnOnError', false);

20

fclose(fileID);

21

dates

= dataArray{:, 1};

22
23

%% Loading exchange data and plot time series

24

[, , rates] = xlsread('GBP_USD.xlsx');

25

rates_gbpusd = cell2mat(rates);

26

time = import_dates('gbp_usd_dates.csv');

27

ts_gbpusd = fints(time,rates_gbpusd,'GBPUSD');

28

plot(ts_gbpusd)

29
30

%% construct weekly time series for libor rates

31

names = cellstr(['liborGBP';'liborUSD']);

32

ts_libor = fints(dates,[libor_GBP, libor_USD],names)/100;

33

ts_libor_weekly =toweekly(ts_libor);

34

plot(ts_libor_weekly)

35
36

%% compute vector of times to maturity

37

exp_date = '20-Aug-2014';

38

times = days360(time, exp_date)/360; % Time to maturity

39
40

%% extract weekly libor rates

41

libor_weekly = fts2mat(ts_libor_weekly);

42

%reverse order

43

libor_weekly = flip(libor_weekly);

DTU

Jonatan Bording

31

42106 Financial Risk Management


Student no.: 091100

Final Assignment

44

%% build interest risk factors

45

dPV_USD = zeros(length(times)-1,1);

46

dPV_GBP = dPV_USD;

47

for t=1:(length(times)-1)
dPV_USD(t) = ...

48

(1+libor_weekly(t,2)*times(t))/(1+libor_weekly(t+1,2)*times(t+1))-1;
dPV_GBP(t) = ...

49

(1+libor_weekly(t,1)*times(t))/(1+libor_weekly(t+1,1)*times(t+1))-1;
50

end

51

%% compute relative changes in exchange rates

52

ts_R_fx = tick2ret(ts_gbpusd);

53

dR_fx = fts2mat(ts_R_fx);

54
55

% merge risk factors in a matrix

56

F = [dR_fx, dPV_GBP, dPV_USD];

57

%% plot as time series

58

names = cellstr(['dS

59

ts_merged = fints(time(1:end-1),F,names);

60

plot(ts_merged)

';'dPVGBP ';'dPVUSD ']);

61
62

%% plot histograms of risk factors

63

figure;

64

subplot(1,3,1)

65

histfit(dR_fx)

66

title('dRfx')

67

subplot(1,3,2)

68

histfit(dPV_GBP)

69

title('dPVGBP')

70

subplot(1,3,3)

71

histfit(dPV_USD)

72

title('dPVUSD')

73

%% set spotprice and current present values

74

K = 16725000; %Delivery price

75
76

S = rates_gbpusd(1)*10000000;%Current spot price


T = times(1);%current time to maturity

77

r_USD = libor_weekly(1,2);

78
79

PV_USD = 1/(1+r_USD*T);
r_GBP = libor_weekly(1,1);

80

PV_GBP = 1/(1+r_GBP*T);

81
82

%% compute variance

83

x = [S*PV_GBP; S*PV_GBP; -K*PV_USD];


Sigma_F = cov(F);

84

DTU

Jonatan Bording

32

42106 Financial Risk Management


Student no.: 091100

85

Final Assignment

sd = sqrt(x'*Sigma_F*x);

86
87

%% compute 10 business 5% value at risk

88

z=norminv(0.05);

89

VaR_f=z*sd*sqrt(2);

90
91

%% Current value of forward contract

92

ft = S*PV_GBP-K*PV_USD;

Computing bonds risk

%% Load Bonds

[, , Bonds] = xlsread('bonds.xlsx','bond-holdings');

Bonds = Bonds(2:end,2:end);

Face = 10000; % Face value

Prices_B = str2double(Bonds(:,1));

CouponRates_B = str2double(Bonds(:,2));

Settles_B = Bonds(:,3);

Maturities_B = Bonds(:,4);

IssueDates_B = Bonds(:,5);

10

FirstCouponDates_B = Bonds(:,6);

11

Units_B = cell2mat(Bonds(:,7));

12
13
14

%% import zero rates (1 year, 3 year, 5 year and 10 year)

15

[, , raw] = xlsread('bonds.xlsx','zerorates_hist');

16

T_names = raw(1,2:end);

17

zerorates = cell2mat(raw(2:end,2:end));

18
19

%% plot data

20

time = import_dates('treasury_dates.csv');

21

ts = fints(time,zerorates,T_names);

22

plot(ts)

23
24

%% calculate week-to-week spread

25

26

ts = fints(time(2:end),_yield,T_names);

27

plot(ts)

28

ylabel('Delta_yield')

29

%% Compute bond duration and price for Bonds in portfolio and for risk ...

_yield = (zerorates(2:end,:)-zerorates(1:end-1,:))/100;

factors
30

[ModDuration, YearDuration, PerDuration] = bnddurp(Prices_B, ...

DTU

Jonatan Bording

33

42106 Financial Risk Management


Student no.: 091100

Final Assignment

31

CouponRates_B, Settles_B, Maturities_B, 2, 1, 1, ...

32

IssueDates_B, FirstCouponDates_B);

33
34

%% compute dirty prices for bonds in portfolio

35

AccruInterests = acrubond(IssueDates_B, Settles_B, FirstCouponDates_B, ...


100,...

36

CouponRates_B);

37

Dirty_prices_B = Prices_B + AccruInterests;

38
39

%% Compute dollar duration for the bonds in our portfolio

40

D_dollar = ModDuration.*Dirty_prices_B;

41
42

%% Duration Mapping

43

x_dur =zeros(4,1);

44

n = Units_B;

45
46

for i=1:length(YearDuration)

47

d = YearDuration(i);

48

if d < 2
x_dur(1)= x_dur(1)+1*D_dollar(i)*n(i);

49

elseif d < 4

50

x_dur(2) = x_dur(2)+1*D_dollar(i)*n(i);

51

elseif d < 7.5

52

x_dur(3) = x_dur(3)+1*D_dollar(i)*n(i);

53

else

54

x_dur(4) = x_dur(4)+1*D_dollar(i)*n(i);

55

end

56
57

end

58
59

%% compute covariance matrix of risk factors

60

Sigma_r = cov(_yield);

61

%% Compute standard deviation

62

sd = sqrt(x_dur'*Sigma_r*x_dur);

63
64

%% Compute 5% value at risk on a 10-day time horizon

65

alpha=0.05;

66

z=norminv(alpha);

67

VaR_bonds = z*sd*sqrt(2)*100; %The face value of the bonds is 10,000 - ...


thats why we multiply by 10,000/100=100

68
69

%% Total bond portfolio value

70

Value_B = Dirty_prices_B.*n;

71

V_bonds = sum(Value_B)*100;

DTU

Jonatan Bording

34

You might also like