portfolio

Converting data frame into Time Series using R [duplicate]

浪尽此生 提交于 2019-12-02 04:52:04
This question already has an answer here: How to convert data frame into time series? 5 answers I have a time series data of the format Time Ask Bid Trade Ask_Size Bid_Size Trade_Size 2016-11-01 09:00:12 NA 901 NA NA 100 NA 2016-11-01 09:00:21 NA NA 950 NA NA 5 2016-11-01 09:00:21 NA 950 NA NA 5 NA 2016-11-01 09:00:21 905 NA NA 10 NA NA 2016-11-01 09:00:24 NA 921 NA NA 500 NA 2016-11-01 09:00:28 NA 879 NA NA 2 NA The structure of the dataframe is str(df) 'data.frame': 35797 obs. of 7 variables: $ Time : POSIXct, format: "2016-11-01 09:00:12" "2016-11-01 09:00:21" ... $ Ask : num NA NA NA 905

Portfolio Optimization constraints Matrix/bvec explanation

吃可爱长大的小学妹 提交于 2019-12-01 13:58:43
I recently got very interested in portfolio optimization and started playing around in R, to create a minimum variance portfolio, library(quadprog) Dmat <- matrix(c(356.25808, 12.31581, 261.88302, 12.31581, 27.24840, 18.50515,261.88302, 18.50515,535.45960), nrow=3, ncol=3) dvec <- matrix(c(9.33, 3.33, 9.07), nrow=3, ncol=1) A.Equality <- matrix(c(1,1,1), ncol=1) Amat <- cbind(A.Equality, dvec, diag(3), -diag(3)) bvec <- c(1, 5.2, rep(0, 3), rep(-0.5, 3)) qp <- solve.QP(Dmat, dvec, Amat, bvec, meq=1) Example above has the following constraints ( example from here ) There are 4 constraints: sum

Portfolio Optimization constraints Matrix/bvec explanation

青春壹個敷衍的年華 提交于 2019-12-01 12:21:53
问题 I recently got very interested in portfolio optimization and started playing around in R, to create a minimum variance portfolio, library(quadprog) Dmat <- matrix(c(356.25808, 12.31581, 261.88302, 12.31581, 27.24840, 18.50515,261.88302, 18.50515,535.45960), nrow=3, ncol=3) dvec <- matrix(c(9.33, 3.33, 9.07), nrow=3, ncol=1) A.Equality <- matrix(c(1,1,1), ncol=1) Amat <- cbind(A.Equality, dvec, diag(3), -diag(3)) bvec <- c(1, 5.2, rep(0, 3), rep(-0.5, 3)) qp <- solve.QP(Dmat, dvec, Amat, bvec,

extract folders from portfolio pdf java

落花浮王杯 提交于 2019-12-01 08:49:30
问题 I have a portfolio pdf with folders,subfolders and files. I need to extract the same structure as it is with folders,subfolders and files using iText in java. I am getting only files with EMBEDEDFILES. what is way of fetch folders also. Kindly find code that i am using. This code only give me files present inside the folders. public static void extractAttachments(String src, String dir) throws IOException { File folder = new File(dir); folder.mkdirs(); PdfReader reader = new PdfReader(src);

Constraints on weight in portfolio optimization using quadprog package in R

喜欢而已 提交于 2019-12-01 05:46:10
问题 I am new to using R and portfolio optimization. I am trying to optimize a portfolio with 7 assets such that asset number 3 and 4 have a minimum weight of 0.35 each and the sum of all 7 assets equal to 1. Following is the code I have tried: library(quadprog) dmat <- cov(dr) #dr stores the daily return of the 7 assets and is a timeSeries object dvec <- colMeans(dr) c1 <- c(0,0,1,0,0,0,0) c2 <- c(0,0,0,1,0,0,0) amat <- t(rbind(matrix(1, ncol = ncol(dmat)), c1, c2)) #used transpose because

CSS columns bug — 5 column count only showing 4 (with images)

我的梦境 提交于 2019-11-28 11:31:06
I am trying to implement Chris Coyier's example of using CSS columns to create a seamless responsive grid of images. I put Chris's files onto my server and everything looked fine. The only thing I changed was the actual images. Now, as you see on my test page , there are only 4 columns of images instead of the specified 5, using column-count:5; . The fifth column is just whitespace with no content. This only happens when the browser window is greater than 1200px. When the browser window is less than 1200px, the media queries kick in and decreases the column count 4, 3, 2, and finally 1. In

CSS columns bug — 5 column count only showing 4 (with images)

微笑、不失礼 提交于 2019-11-27 06:17:22
问题 I am trying to implement Chris Coyier's example of using CSS columns to create a seamless responsive grid of images. I put Chris's files onto my server and everything looked fine. The only thing I changed was the actual images. Now, as you see on my test page, there are only 4 columns of images instead of the specified 5, using column-count:5; . The fifth column is just whitespace with no content. This only happens when the browser window is greater than 1200px. When the browser window is