程序代写代做 Quiz 3: Matlab

Quiz 3: Matlab
Submission:
You only need to submit a .m file, named QuizMatlab.PolyUID.LastName.FirstName.m. For example, your name is George Washington and your ID 1900000D; then the .m file to submit is QuizMatlab.1900000D.Washington.George.m
In the previous quiz, we consider a mutual fund using 40/60 strategy, i.e., 40% of fund will be invested in bond and 60% will be invested in stock. Assume rebalancing will be done at the 1st day of each quarter. Suppose the fund was established on 2015-04-01 with $100 million. We use SPY as the proxy of stock and TLT as the proxy of bond. On 2015-04-01, the fund will use $60 million to buy SPY and $40 million to buy TLT. After that, rebalancing will be done at the 1st day of each quarter. For example, on 2015-07-01, if the SPY part had gone down to $50million with SPY price went down and the TLT part had gone up to $50 million with TLT price went up. Then the funds should sell $10million of TLT and purchase $10million of SPY to make it still 40/60. In another word, with the price goes up or down, the proportion of SPY and TLT will deviate from 40%/60%. Then at the 1st day of each quarter, a rebalancing is needed. For simplicity, we use the open price of SPY and TLT on the 1st day of each quarter to calculate the portfolio value and how to rebalance.
In this quiz, we evaluate the best parameter for the above strategy. The question is: what is the best percentages of investment on the stock and bond? Is the 40/60 strategy the best? Or actually the 60/40 strategy is the best? Or other strategies work better?
You are required to do the following:
1. (12pt) Write a function, which takes the percentage of stock investment as input and outputs the quarterly portfolio balance before rebalancing. Note that you are required to take into account of cash balance as well considering you cannot have a half share. The portfolio value= cash balance + SPY share * SPY price + TLT share * TLT price.
2. (2pt) The main program calls the above function with different inputs, i.e., 10%, 20%, ……, 90%.
3. (2pt) For a given strategy x%/1-x% (e.g, 40/60 strategy), the quarterly return should be calculated first. Then the average return and standard deviation of the returns over the time horizon need to be calculated.
4. (2pt) Assume the quarterly risk-free rate is 0.5%. The Sharpe-ratio of each strategy needs to be calculated. Sharpe ratio is calculated by
(average return – risk-free return)/standard deviation
5. (2pt) Plot the Sharpe-ratio of each strategy over the different percentages of stock investment. Draw a conclusion which strategy is the best in terms of Sharpe-ratio.