Reference no: EM132365649
Financial Modelling and Coding Assignment - Project
Background - In this project we will consider some applications of volatility and covariance modeling, Value-at-Risk (VaR) calculations, and hedging and portfolio applications.
You will need to download price data on say 3 large stocks and the ASX200 Index. Get daily data for this project, going back around 10 years. You could get the data from Yahoo Finance, or Bloomberg (we have terminals in Z850) if you have some experience with that.
Saving a csv file: Once you have your price data ready in Excel, you can choose File, Save As, and then change the file type down the bottom of the save as dialog box from .xlsx to CSV by using the dropdown menu.
Task 1: VaR Calculation
Take the index returns and the returns on one stock. Use the EWMA smoothing algorithm we discussed in Slide 15 of the Volatility Lecture and also discussed in Section 12.5 of the Matlab Guide. You can start with the code smooth vol.m.
For both series do the following analysis:
- Compute the conditional variance σt2 for each series.
- Compute the 95% VaR for each day. Hint: Look at Slide 20 of the Volatility Lecture.
- Plot the VaR. Does it behave how you would expect?
- Count the proportion of days where the returns are below the 95% VaR. Is this number close to 5%?
Task 2: Hedging
Take the returns on the index and 1 of your individual stocks. This task involves comparing a fixed hedge to a conditional hedge ratio.
Undertake the following analysis for both of the individual stocks:
Compute a fixed β for the stock using the regression tools in Matlab.
Compute the hedged portfolio returns using the estimated β. Hint: Look back at slide 28 of the Volatility Lecture. In this task you only have one value for β everyday so that gives you the two portfolio weights for all days.
Using the multivariate EWMA compute a time varying βt from the conditional covariance matrix ∑^t. Hint: Recall from Slide 28 again you will need the conditional covariance (element (1,2) from your conditional covariance matrix for each day) and the conditional variance of the market return ((1,1) or (2,2) depending whether you put the index return first or second column in your matrix of returns to pass to the EWMA). Hint: You can use the multivariate EWMA we looked at in Practice Task 7 to generate the covariance matrix through time.
Compare the conditional βt to the fixed beta from the regression. Compute the hedged portfolio returns using the portfolio weights from the conditional βt and compare these returns to those from the portfolio based on the fixed β.
Task 3: Portfolio construction
Take the three individual stocks. In this task you'll use these stocks to for a GMVP. To do so undertake the following tasks:
Again use the multivariate EWMA to construct the conditional covariance matrix ∑^t. Hint: You can use the multivariate EWMA we looked at in Practice Task 7 to generate the covariance matrix through time.
IMPORTANT: After you have constructed the covariance matrix through time, you will have to remove the first say 20 days from it and all of the returns that you are using. Recall, if you want to remove (i.e. use from row 21 to the end of a vector) the first 21 rows of a vector then use: variable_name = variable_name(21 : end);
Use the same logic for matrices, or 3-D matrices/arrays
Using the conditional covariance matrix b t compute GMVP portfolio weights through time. Hint: Look back at slide 29 of the Volatility Lecture for the GMVP calculation. Hint: You will need to set up a matrix of the right size to store the weights.
Compute the returns on the GMVP.
Compare the GMVP returns to the returns from an equally weighted portfolio of the three stocks.