Hello, I have n risky assets and no risk free asset and risk aversion parameter is 4(gamma). I want to use mean-variance criteria to compute optimal portfolio weights. From historical data, I have expected return data or data matrix on n risky assets, r = […] (r is a two dimensional Python array where each row represents an asset and column represents net returns). I also estimated mu and variance-co-variance matrix sigma from historical data. I would like to convert my python code to Julia code to compute the mean, variance and optimal portfolio weights. Can anyone please suggest me how can I write it on Julia. Here I have Python code.
gamma=4 n=r.shape mu=r[:,0:n].mean sigma=cov[r:,0:n] onematrix=ones(n) numer1=dot(onematrix.transpose(),inv(sigma)) numer2=dot(numer1,mu)-gamma denominator=dot(numer1,onematrix) numer3=dot(numer2,inv(denominator)) result=mu-numer3 weight=(1.0/gamma)*dot(inv(sigma),result) return weight