You have just received a positive response from hseritll Lyacb on a recent graduate ‘Financial Analyst’ role you had applied for and you are invited to a job interview. 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, you'd work 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.
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 1input function to read from the keyboard.
The program should print on the screen and Excel, the capital weight values within 4 decimal points and in a feld 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 out the maximum utility and sharp ratio, cleady 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 ma1n 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.py" and an output Excel file “StudentlDPortfolioProblem.xls". You may manually plot the portfolio mean-variance efficient frontier, CML, and identify the market portfolio, based on the program output data.