Articles by [email protected]

The Kelly Criterion in Applied Portfolio Selection – Part 2

December 12, 2016 | [email protected]

[This article was first published on databait, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. Previous blog post on the Kelly CriterionAs pointed out in a previous blog post, the Kelly Criterion is an interesting option to decide on position sizing in portfolio selection. While the previous post looked at single stocks, I will today show how to optimize position sizes for a portfolio with multiple stocks. The core functionAt the core of my portfolio optimization is this function: 12345678910111213opt_portfolio <-function(shares, dpf, maxshare) { # calculate portfolios return vector exp_returns <- dpf%*%shares obj = -sum(log(1+exp_returns)) weight.penalty = 1000*(1-sum(shares))^2 # max share penalty: maxpen <- sum(shares[shares>maxshare])*1000 return(obj + weight.penalty + maxpen)} The function has three parameters. shares is the vector of shares (position size for each stock) that is going to be estimated by optimization. dpf is a matrix where each stock is a column and each line contains the daily stock price movements like e.g.: diff(stock)/lag(stock). The maxshare option can be used to restrict the position size of a single stock to a [...] [Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)