In the following program, this portfolio.optim function has been used instead of the custom built function shown in the previous post.
========================================
setwd("C:/Users/admin/Desktop/Data Analytics/QuantitativeFinance/QFLabs")
getwd()
India5 <- read.csv("India5.csv")
assets <- India5[,3:7]
returns <- log(tail(assets, -1) / head(assets, -1))
library("tseries")
## Create an optimum portfolio with expected means defined and shorts allowed
w2 <- portfolio.optim(as.matrix(returns),pm = 0.005,shorts = TRUE,riskless= FALSE)
w2$pw
sum(w2$pw)
## Create an optimum portfolio with expected means defined and shorts NOT ALLOWED
w2 <- portfolio.optim(as.matrix(returns),shorts = FALSE,riskless = FALSE)
w2$pw
sum(w2$pw)
w2$pm
# Create a function to create the frontier using portfolio.optim
frontier2 <- function(return,minRet,maxRet){
rbase <- seq(minRet,maxRet,length=100)
s <- sapply(rbase,function(x){
p2 <- portfolio.optim(as.matrix(returns),pm = x, shorts = TRUE)
p2$ps^2
})
plot(s,rbase,xlab="Variance",ylab="Return", main="w/Portfolio.Optim")
}
frontier2(returns,-0.0005,0.05)
========================================
We observe that with Short positions allowed ( shorts=true), the portfolio weights are the same as what was obtained in the previous program ( previous post ), and as expected they sum up to 1
> w2$pw
[1] 4.869750 5.651428 3.375111 -10.711613 -2.184675
> sum(w2$pw)
[1] 1
however when shorts are not allowed ( shorts = false ) a different portfolio is created
> w2$pw
[1] 0.22797760 0.19765858 0.03686214 0.16357332 0.37392835
> sum(w2$pw)
[1] 1
> w2$pm
[1] 0.0003971317
and they sum up to 1 as well.
However, when short positions are not allowed, it is not possible to specify the portfolio returns before hand ( as it was, in the shorts allowed case, where pm = 0.005). With this constraint, the portfolio returns has dropped to 0.000397.
The efficient frontier remains the same as before
The program given in Alphaism uses portfolio.optim and then extends it further.
IEEE Project Domain management in software engineering is distinct from traditional project deveopment in that software projects have a unique lifecycle process that requires multiple rounds of testing, updating, and faculty feedback. A IEEE Domain project Final Year Projects for CSE system development life cycle is essentially a phased project model that defines the organizational constraints of a large-scale systems project. The methods used in a IEEE DOmain Project systems development life cycle strategy Project Centers in India provide clearly defined phases of work to plan, design, test, deploy, and maintain information systems.
ReplyDeleteThis is enough for me. I want to write software that anyone can use, and virtually everyone who has an internet connected device with a screen can use apps written in JavaScript. JavaScript Training in Chennai JavaScript was used for little more than mouse hover animations and little calculations to make static websites feel more interactive. Let’s assume 90% of all websites using JavaScript use it in a trivial way. That still leaves 150 million substantial JavaScript Training in Chennai JavaScript applications.