Computational Finance with C++CourseworkDue: 2pm – 1/06/2018Exercise 1.The aim of this exercise is to construct a portfolio optimization solver and performbacktesting to assess the performance of the Markowitz model.You are given a file containing returns from 83 of the FTSE 100 companies. The datais contained in a file called &"assets_returns.csv&".You are also given three files to help you read the data. The two files csv.h andcsv.cpp contain a function that read files in the csv format. An example of how touse this function is given in read_data.cpp.For the given dataset, compute the solutions using a rolling in-sample window of 100returns observations. Set the in-sample window on the first 100 time periods, thenselect the portfolio by solving the Markowitz model for a range of target returns.Then evaluate the performance of each portfolio on the following 12 (out-of-sample)periods. Then update the in-sample window, with the inclusion of the previous 12out-of-sample periods and the exclusion of the first 12 periods of the previous in-sample window. Then rebalance the portfolio by solving the model again, and repeatuntil the end of the dataset (see Figure below).The three parts are parameter estimation, portfolio selection, and backtesting. Thesethree steps are described in more detail below.(A) Parameter Estimation: For the 83 companies you are given returns for 700 days.You will use the data in a rolling fashion described above. The first part willbe used to perform. parameter estimation. You will need to provide functionsto estimate the mean and covariance matrix. The mean return for asset i can1timetime100 days 12 days100 days12 days12 daysout of samplein sampleout of samplein sampleFigure 1: Rolling back-testing procedure.be estimated as follows:ri = 1nnXk=1ri;k:where ri;k is the return of asset i on day k, and n is the number of days used inthe in-sample window for parameter estimation (in this case 100).The (i,j)-th entry of the covariance matrix can be calculated with the help ofthe following formula:ij = 1n 1nX代写C/C++编程、C/C++课程设计代写、调试C/C++语言、Computational Finance程序代做留学生k=1(ri;k ri)(rj;k rj):The estimated covariance matrix will be denoted by and the estimate returnsby r.(B) Portfolio Optimization: It was shown in the lecture that the optimal portfolioweights (w) can be obtained by solving the following system of linear equations,Where and are the Lagrange multipliers, and rP is the target return, erepresents a vector of ones.Denote the system of linear equations as Qx = b. Then the following algorithm(called the conjugate gradient method) can be used to solve it.A typical tolerance is 10e 6.2Algorithm 1: Conjugate Gradient Method – Quadratic ProgramsInput : Initial point x0, matrix Q, right hand side vector b, and solutiontolerance .0. Initialize:s0 = b Qx0; p0 = s0:1. For k = 0;1;:::; until s>ksk do:k = s>kskpTkQpkxk+1 = xk + kpksk+1 = sk kQpkk = s>k+1sk+1s>kskpk+1 = sk+1 + kpk(C) Backtestingistheprocessoftestingatradingstrategyonrelevanthistoricaldatato ensure its viability before the trader risks any actual capital. In the final partofthecourseworkyouwillevaluatetheperformanceofyourportfolio. Constructa number of portfolios with different target returns using the in-sample dataset.Then compute the average out of sample return, and covariance of the asset. Tobe precise, let w denote the optimal portfolio, r denote the average return overthe out-of-sample period, and denote the out of sample covariance matrix.The r>w, and w> w> are the actual average returns and covariance of theportfolio.Evaluation: Write a report describing the classes you developed to solve the problemdescribed above. Your report should contain the following sections:1. Software Structure: Describe the classes you developed and how they are linked.For this purpose you can use simple diagrams like the ones we used in class.2. Evaluation: Describe the performance of the Markowitz model for the differenttarget returns. You should compute the returns for 20 portfolios with differentreturns (from 0.0% to 10%). Use figures and tables to illustrate your findings.33. Appendix: In the Appendix you should include your code. Please make sure itis well documented.转自:http://ass.3daixie.com/2018052758777401.html
讲解:C/C++、C/C++、C/C++、Computational Finance
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 本文转载自知乎 作者:季子乌 笔记版权归笔记作者所有 其中英文语句取自:英语流利说-懂你英语 ——————————...
- By clicking to agree to this Schedule 2, which is hereby ...
- 20多年前,日本经过多年的修生养息,成为亚洲乃至世界都首屈一指的的发达国家。 据美联储预估,1985年日本财政储蓄...