Skip to content
Back to formatted view

Raw Message

Message-ID: <AM5P18901MB0242438FABA49A85F07AE814D3F00@AM5P18901MB0242.EURP189.PROD.OUTLOOK.COM>
Date: 2018-10-26T15:03:32Z
From: xiaohui chen
Subject: Welcome to the "R-SIG-Finance" mailing list
In-Reply-To: <mailman.14676.958.1540564481.1178.r-sig-finance@r-project.org>

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 at r-project.org> on behalf of r-sig-finance-request at r-project.org <r-sig-finance-request at r-project.org>
Sent: 26 October 2018 15:34
To: yusichen0541 at 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 at 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 at 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]]