Draw the cumulative return and drawdown

Assignment Help Python Programming
Reference no: EM132817900

Problem 1: Portfolio Optimization

Suppose we want to design a portfolio among following assets:

StocksArray = c(' MSFTY AAPL',' AMZN',' FB',' GOOGY GOOGLY JNJ',' JPM',' VY PG',
'T',' UNH',' MA',' HD',' INTC',' V ZY KO',' BAC',' XOM',' MRK',' DIS',' PFE',
'PEP',' CMCSA',' CV X',' ADBE',' CSCO',' NVDA',' WMT',' NFLX',' CRM',
'WFC',' MCD',' ABT',' BMY',' COST',' BA',' C',' PM',' NEE',' MDT',' ABBV',
'AMGN',' TMO',' LLY',' HON',' ACN',' IBM')

The period we consider is from 01-01-2014 to 31-12-2020. In this problem, you are allowed to use any package.

(a) Please split the data set into training set and test set with 75% data in training set and 25% data in test set.

(b) Please use training data to construct the following portfolios:
• Uniform portfolio.
• Inverted volatility portfolio
• Quintile portfolio.

Apply them on test data, draw the cumulative return and drawdown. (your budget starts from 1 dollar and assuming risk-free rate is zero.)

(c) Estimation of mean vector and covariance matrix is a critical problem in portfolio optimization. Let ∑. be the sample covariance matrix. Instead of using ∑. to construct the portfolios, here we would use

. = ρ∑. + (1 - ρ) Trace(∑.)IN/N

where N is the number of asset, IN is the identity matrix of order N, and ρ is a real number between 0 and 1. Try different values of ρ in {0, 0.2, 0.4, 0.6, 0 8, 1}, construct the global minimum variance portfolio (GMVP)

minimize wT∑w
subject to 1Tw = 1, w ≥ 0, and compute the Sharpe ratio on test set.

(d) In this subproblem, instead of estimating E via sample covariance matrix, we assume E is one of M (known) covariance matrices ∑(k) ∈ Sn++, k =1,... , M, in which M = 10 and ∑(k) is computed as

∑(k) = k-1/M-1∑ + M-k Trace(∑) IN/N

where ∑ is the sample covariance matrix, N is the number of asset, and IN is the identity matrix of order N.

We will choose the portfolio weights in order to maximize the expected return, adjusted by the worst-case risk

minimize  -μTw + λ maxk=1,...,M (wT(k)w)
subject to 1Tw = 1.

Use CVX to solve it, apply the portfolio on test set, then show the Sharpe ratio, annualized return and average drawdown for different λ ∈ {0, 1,4,10,20}.

Problem 2: Gradient Descent

Consider a linear factor model:
xt = α + βft + ∈t, t = 1, 2,... T,

where xt ∈ RN. We estimate α and β by solving the following least-squares problem via gradient descent

minimize     ∑Tt=1 ||Xt - α - βft||2
α,β

For the vector of log-returns xt, we'll use

Stocks = c(MSFT' AAPL',' AMZN',' KB' ,GOOG')

starting from 2016-01-01 to 2019-12-31. For the factor ft we'll use the log-return of S&P500 index in the same period. Compare the estimates you obtained to that of CVX.

Hint The objective function is a function of α∈RN and β∈RN

So, there are 2N variables (α1, , αN, , β1,.....βN) to optimize. Given a point (αt, βt), a gradient descent step updates α and β as

1176_figure.jpg

You should choose step size n and stopping criteria properly so that your algorithm converges to the optimal.

Need to use R language with CVXR package.

Attachment:- Portfolio Optimization.rar

Verified Expert

The solution provided were Rstudio codes of financial modelling. It involved optimization of equally weighted portfolio, quintile portfolio as well as Sharpe ratio, gradient descent of least squares inequality.The data of several assets was extracted from yahoo.finace on S&P 500.

Reference no: EM132817900

Questions Cloud

Compute ending balance of the deferred tax asset : Compute ending balance of the deferred tax asset or liability account in 2010, 2020, 2021. Calculate income tax expense in 2019, 2020, 2021.
Research four types of literacy assessments : Research four types of literacy assessments and create a matrix including the following: Two formal and two informal literacy assessments and rationales.
What do you feel you have left to learn : As this program concludes, discuss your excitement and apprehension as you prepare for student teaching. What do you feel you have left to learn?
How would tax effects differ if susan rental building basis : Find How should Susan structure the transaction if she believes her marginal tax rate will increase in the future? What is the recognized gain or loss
Draw the cumulative return and drawdown : Apply them on test data, draw the cumulative return and drawdown - choose the portfolio weights in order to maximize the expected return, adjusted
Identify a learning need and target audience : Introduce your topic selection and include at minimum your topic, title of your project, and a 2-sentence summary. Then, based on your topic selection.
Record the journal entry for the recovery : Record the Journal Entry(s) for the recovery. Richard Company wants to do business with us and has agreed to pay ABC $6,000 of the previous amount owed.
How knowing about survey design and quant analysis useful : Write a 1-2 page reflection on how knowing about survey design and quant analysis might be useful in your professional practice of higher education.
How many equivalent units would be used to allocate : 3,500 units in beginning work in process inventory, how many equivalent units would be used to allocate conversion costs to work in process ending inventory?

Reviews

len2817900

3/5/2021 11:35:13 PM

Need to have some help on the problem solving. Need to use R language with CVXR package.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd