本次CS代写的主要涉及如下领域: Python代写,北美程序代写,美国程序代写,University of Oregon代写,FIN683代写
FIN 683 / Fall 2018 Python Extra Credit Assignment 1
Extra credit: Up to 6 points will be added to your exam score.
Using the PyPortfolioOpt library, Jupyter notebook, and the data set given in the Canvas instructions to this assignment, perform the set of tasks below. Submit a pdf file of your code and your outputs to Canvas.
You may find the pandas documention useful (https://pandas.pydata.org/pandas-docs/ version/0.23.4/api.html#api-dataframe-stats. The PyPortfolioOpt library is avail- able athttps://pypi.org/project/PyPortfolioOpt/. The GitHub page for this library ishttps://github.com/robertmartin8/PyPortfolioOpt.
- Read the data from the .csv file into a dataframe.
- Assign the mean monthly returns multiplied by 12 to a new variable, calledmu.
- Assign the monthly covariance matrix of returns multiplied by 12 to a new variable calledS.
- Contrain the sum of the portfolio weights to be one and each weight to be− 1. 0 ≤wi≤ 1 .0.
- You will work with three sets of assets as your investment opportunities.
Case 1: The investable assets are the 4 ETFs below. [Note that you must set the
riskless rate to zero when using the functions in this library.]
i. (SPYG) S&P 500 Growth
ii. (SPYV) S&P 500 Value
iii. (SLYG) S&P 600 Growth
iv. (SLYV) S&P 600 Value
Case 2:The investable assets are the 9 S&P sector ETFs given in the data file.
- XLB, XLV, XLP, XLY, XLF, XLI, XLE, XLK, XLU
Case 3:The investable assets are the 9 S&P sector ETFs given in the data file plus a
riskless rate of 4%.
- XLB, XLV, XLP, XLY, XLF, XLI, XLE, XLK, XLU, andrf
- For each case, identify the mean and standard deviation of return for the optimal port-
folio that achieves an expected return of 6%. Print the weights in each case’s optimal portfolio. 7. For each case, identify the mean and standard deviation of return for the optimal port- folio that achieves an expected return of 10.5%. Print the weights in each case’s optimal portfolio. 8. For each case, use theplotfrontierfunction to produce plots that include:
FIN 683 / Fall 2018 Python Extra Credit Assignment 2
- the frontier of the risky opportunity set
- 100 random portfolios of the risky basis assets
- the basis assets used in each case
- for case 3, the tangency line fromrfto the risky opportunity set
Note that the text file “Template-plotting-functions.txt” provides a template of code to
achieve these outcomes.
- Adjust your plot for case 1 to remove the dot marking the “Tangency Portfolio”. You may find this page of the matplotlib documentation useful:https://matplotlib.org/ api/_as_gen/matplotlib.axes.Axes.plot.html.
- Adjust the previous plot so that the random portfolios are plotted with magenta circles
instead of blue crosses.