[R-SIG-Finance] Welcome to the "R-SIG-Finance" mailing list

xiaohui chen yu@ichen0541 @ending from m@n@com
Fri Oct 26 17:03:32 CEST 2018


hi,


I am looking at using PortfolioAnalytics to optimize portfolio with constrained tracking error.


looking at below code I got some questions.


te.target <- function(R, weights, Rb, min.te = 0.02, max.te = 0.05, scale = 12){
  # calculate the portfolio return
  r <- Return.portfolio(R = R, weights = weights)
  # align the indexes
  Rb <- Rb[index(r)]
  te <- sd(r - Rb) * sqrt(scale)
  # penalize tracking error outside of [min.te, max.te] range
  out <- 0
  if(te > max.te)
    out <- (te - max.te) * 10000
  if(te < min.te)
    out <- (min.te - te) * 10000
  out
}

Do I need a series of stock returns as well as their corresponding weights for the time series in order to run this script? I have stock return series, but don't have stock weights history as I think the purpose was to find the weights for the optimization.


Would someone be able to advise where can I find the source data used from Ross's presentation? I am trying to replicate the code and see how the flow works.


https://github.com/rossb34/PortfolioAnalyticsPresentation2017/blob/master/optimization_script.R

[https://avatars1.githubusercontent.com/u/5797430?s=400&v=4]<https://github.com/rossb34/PortfolioAnalyticsPresentation2017/blob/master/optimization_script.R>

rossb34/PortfolioAnalyticsPresentation2017 - GitHub<https://github.com/rossb34/PortfolioAnalyticsPresentation2017/blob/master/optimization_script.R>
github.com
Presentation for R/Finance 2017. Contribute to rossb34/PortfolioAnalyticsPresentation2017 development by creating an account on GitHub.




many thanks

jojo



________________________________
From: R-SIG-Finance <r-sig-finance-bounces using r-project.org> on behalf of r-sig-finance-request using r-project.org <r-sig-finance-request using r-project.org>
Sent: 26 October 2018 15:34
To: yusichen0541 using msn.com
Subject: Welcome to the "R-SIG-Finance" mailing list

[[elided Hotmail spam]]

To post to this list, send your message to:

  r-sig-finance using r-project.org

General information about the mailing list is at:

  https://stat.ethz.ch/mailman/listinfo/r-sig-finance

If you ever want to unsubscribe or change your options (eg, switch to
or from digest mode, change your password, etc.), visit your
subscription page at:

  https://stat.ethz.ch/mailman/options/r-sig-finance/yusichen0541%40msn.com


You can also make such adjustments via email by sending a message to:

  R-SIG-Finance-request using r-project.org

with the word `help' in the subject or body (don't include the
quotes), and you will get back a message with instructions.

You must know your password to change your options (including changing
the password, itself) or to unsubscribe without confirmation.  It is:

  495530az

Normally, Mailman will remind you of your r-project.org mailing list
passwords once every month, although you can disable this if you
prefer.  This reminder will also include instructions on how to
unsubscribe or change your account options.  There is also a button on
your options page that will email your current password to you.

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list