程序代写代做代考 case study Excel flex graph CASE STUDY

CASE STUDY
You have just received a positive response from Merrill Lynch on a recent graduate 􏰀Financial Anal􏰁st􏰂 role 􏰁ou had applied for and 􏰁ou are invited to a job intervie􏰃. The job specification includes, among other things, knowledge of Python at introductory level, but with the prospect of been further trained within the organisation. If successful you will work in a recently re-organised asset pricing department and if you were to be successful, 􏰁ou􏰂d 􏰃ork as part of a team dealing with financial analysis and asset pricing that also involves computational work. Your prospective employer has prepared a trial test for you as part of the interview, entirely based on introductory Python programming.
You􏰂d be expected to be tested on programming skills in Python, where a specific task is given that must be coded within a limited amount of time to a problem specification. You are expected to code the solution with user-defined functions, but not with graphics, object orientation, or graphical user interface(GUI). Make use of good Python-style comments, variable declaration, initialization, data processing, control flow statements, function cohesion, and coupling. You are also expected to demonstrate that you understand both the syntax, function design, and have good and timely programming skills in Python.
PROBLEM SPECIFICATION
Consider a 2-fund separation problem. Write a Python program that allows the user to choose how to enter the (i) expected rate of return, (ii) volatility for each of the two funds, (ii) the correlation coefficient, (iv) the risk aversion coefficient, and (v) a risk free rate of return; 1. read the data from an Excel file, (2), enter them through program prompts i.e. use input(..) function to read from the keyboard.
i.e. ~~~~DATA ENTER CHOICES~~~~~ 1. Read from keyboard
2. Read from Excel file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the 2-fund portfolio and for the purpose of computing the return and risk of the portfolio, you would need the capital weights. The capital weight w1 is set initially to 0.00. The second weight is always w2 = 1-w1. It should use a loop to increment w1 by a small value (i.e. 0.0001) and compute w2 such that the sum of capital weights is always 1.00. The maximum value of w1 is 1.0. The values should be stored in one-dimensional arrays or lists w1 = [], w2 = [].
i.e. w1 =[] 0.0000 0.0001 0.0002 􏰄􏰄􏰄. 0.5000 􏰄􏰄􏰄. 1.0000
w2 = [] 1.0000 0.9999 0.9998 􏰄􏰄􏰄. 0.5000 􏰄􏰄􏰄. 0.0000
The program should compute the expected return, volatility, quadratic utility, and sharp ratio of the 2-fund portfolio using the following corresponding expressions:
2|Page

Portfolio expected rate of return:
Portfoliovolatility:
Portfolio quadratic utility in expectation:
Sharp Ratio:
𝐸􏰅𝑟 􏰇 􏰈 𝑤 𝐸􏰊𝑟 􏰋 􏰌 𝑤 𝐸􏰊𝑟 􏰋 􏰆􏰉􏰉􏰍􏰍
􏰎 􏰈􏰏𝑤􏰍􏰎􏰍􏰌𝑤􏰍􏰎􏰍􏰌2𝑤𝑤􏰎􏰎𝜌
􏰆 􏰉 􏰉 􏰍 􏰍 􏰉 􏰍 􏰉 􏰍 􏰉,􏰍
𝐸􏰅𝑢 􏰇 􏰈 𝐸􏰅𝑟 􏰇 􏰐 􏰉 𝐴􏰎􏰍 􏰆􏰆􏰍􏰑
(*) A is the risk aversion coefficient
𝑆􏰑 􏰈
𝐸􏰅𝑟 􏰇 􏰐 𝐸􏰅𝑟 􏰇 􏰆􏰒
􏰎􏰆
For each weight set, program should compute portfolio expected rate of return, volatility, quadratic utility, and Sharp ratio. The computed portfolio returns and volatilities should be stored in arrays rp = [], and vp = [], respectively. Program should then find the portfolio with the highest utility and highest sharp ratio.
Update the program so that user has control over how the capital weights are generated, prompting use to choose whether to compute capital weights using the Huang and Litzenberger (HL) method, whereby w = g + rp * h. The g and h vector values can be generated by applying HL through the following formulae:
𝑔􏰉 􏰈 𝐸􏰊𝑟􏰍􏰋 ,𝑎𝑛𝑑𝑔􏰍 􏰈1􏰐𝑔􏰉 𝐸􏰊𝑟􏰍􏰋􏰐𝐸􏰊𝑟􏰉􏰋
h􏰉 􏰈 1 𝐸􏰊𝑟􏰉􏰋􏰐𝐸􏰊𝑟􏰍􏰋
, 𝑎𝑛𝑑 h􏰍 􏰈 􏰐h􏰉
Capitalweightscanbegeneratedusing w1 =g1 +rp *h1 andw2 =g2 +rp *h2, where rp values are those computed earlier and stored in the array rp. Pogram then should compute the portfolio standard deviation using the formula given above. Store them in the array efvp = []. Note that according to HL theory, these are mean-variance efficient frontier portfolios. For the same portfolio returns, you may compare the capital weights, and standard deviations generated in the two scenarios.
The program should print on the screen and Excel, the capital weight values within 4 decimal points and in a field with a reasonable character width, as well as the portfolio expected return, volatility, utility, and sharp ratio within a reasonable character width and 4 decimal places. The values should be sorted from the lowest portfolio return to the highest. It should print outthe maximum utility and sharp ratio, clearly indicating the corresponding portfolio with its return and volatility attributes. The input must be robustly validated and the output should be properly formatted.
You may help to first try to code at the program level or inside a user defined main function and then delegate some code to dedicated user-defined functions of your choice, but not less than 4 user defined functions.
You have flexibility on how many user-defined functions you may create and their specification (not less than four). They must be designed using good cohesion and coupling programming principles. The finished product must contain at least four well designed user-defined functions. This is the only program file you are expected to submit.
You must produce a running program saved in a Python file named 􏰓studentID.p􏰁􏰔 and an output E􏰕cel file 􏰓StudentIDPortfolioProblem.􏰕ls􏰔. You may manually plot the portfolio mean-variance efficient frontier, CML, and identify the market portfolio, based on the program output data in the
3|Page

excel file. This would allow you to check with literature that the shape of the graph is as described in literature. You may wish to note the maximum utility and sharp ratio in the graph. You do not need to produce any written work on the theorized financial portfolio elements. Focus is on the programming skills.
The program must run in order to be marked.
(100 marks)
4|Page