<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Menlo;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.hoenzb
{mso-style-name:hoenzb;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Got it and will take a look tomorrow or on the weekend.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Doug<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> gsoc-porta-bounces@lists.r-forge.r-project.org [mailto:gsoc-porta-bounces@lists.r-forge.r-project.org] <b>On Behalf Of </b>Ross Bennett<br><b>Sent:</b> Thursday, February 20, 2014 11:27 AM<br><b>To:</b> PortfolioAnalytics<br><b>Subject:</b> Re: [GSoC-PortA] Finishing Touches to PortfolioAnalytics<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>All,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I am working on adding functionality to accept a list of portfolio objects for optimize.portfolio and optimize.portfolio.rebalancing.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I added a block of code at the beginning of optimize.portfolio and optimize.portfolio.rebalancing to detect a list of portfolio objects and then loop through each portfolio in the list of portfolios and recursively call optimize.portfolio or optimize.portfolio.rebalancing. I have a return statement at the end of that block of code. Some frown upon multiple return statements in a function, is it ok that I do this here or is there a different approach I should follow.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I also added <span style='font-size:8.5pt;font-family:"Menlo","serif"'>demo/multiple_portfolio_optimization.R</span> so you can test out the functionality.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I just committed my changes with r3318.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Ross<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On Wed, Feb 5, 2014 at 6:54 AM, Ross Bennett <<a href="mailto:rossbennett34@gmail.com" target="_blank">rossbennett34@gmail.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>Makes a lot more sense from that perspective to avoid making optimize.portfolio and optimize.portfolio.rebalancing S3 generic methods. I'll proceed as you have outlined.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thanks for the clarification and guidance.<o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#888888'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:#888888'>Ross<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='color:#888888'><o:p> </o:p></span></p></div></div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On Tue, Feb 4, 2014 at 11:29 PM, Brian G. Peterson <<a href="mailto:brian@braverock.com" target="_blank">brian@braverock.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>On 02/02/2014 10:25 PM, Ross Bennett wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><p class=MsoNormal> Enhance the print and summary methods for<br> optimize.portfolio.rebalancing. Currently, a list of<o:p></o:p></p></div><p class=MsoNormal> optimize.portfolio objects at each rebalance period is returned.____<br><br> */[Doug] So does that imply one can now input a list of portfolio<o:p></o:p></p><div><p class=MsoNormal><br> optimization strategy objects to “optimize.portfolio.rebalancing”,<br> e.g., each with different constraints and different objectives?<o:p></o:p></p></div><p class=MsoNormal> (this would be very useful)/*<o:p></o:p></p><div><p class=MsoNormal><br><br><br>No, that is currently not possible, but should not be too hard to<br>implement. I could do this for optimize.portfolio as well. I think the<br>most robust way to implement this would be to make optimize.portfolio()<br>and optimize.portfolio.rebalancing() generic methods.<br><br>This would require a few minor design changes and I don't think it would<br>break backwards compatibility. We would have to change the order of<br>arguments for optimize.portfolio() and optimize.portfolio.rebalancing()<br>so that 'portfolio' is the first argument, currently 'R' is the first<br>argument.<o:p></o:p></p></div></blockquote><p class=MsoNormal><br>I think the desired functionality (take a list of portfolio objects) is a good idea.<br><br>I don't think relying on S3 dispatch and making optimize.portfolio.* into S3 generics makes sense though.<br><br>I say this because there's far too much shared code. The sub-functions for the different optimizer methods and special cases are far less code than the wrapper/framework function. I wouldn't want to duplicate all that code, or add a bunch of extra function calls in code that's called lots and lots of times.<br><br>Also, I *really* hate breaking backwards compatibility by rearranging arguments unless there's a compelling reason. For R generics like print/plot/summary, using S3 dispatch is the obvious and only answer, but for optimize.portfolio.*, I'd say leaving the arguments list alone makes the most sense.<br><br>I think you could add the loop over portfolio specification list elements (if it is a list) and collection of the results into a list of optimization results into the optimize.portfolio.* functions without too much work, and without breaking existing code.<br><br>Regards,<br><br>Brian<span style='color:#888888'><br><br>-- <br>Brian G. Peterson<br><a href="http://braverock.com/brian/" target="_blank">http://braverock.com/brian/</a><br>Ph: <a href="tel:773-459-4973" target="_blank">773-459-4973</a><br>IM: bgpbraverock</span><o:p></o:p></p><div><div><p class=MsoNormal><br>_______________________________________________<br>GSoC-PortA mailing list<br><a href="mailto:GSoC-PortA@lists.r-forge.r-project.org" target="_blank">GSoC-PortA@lists.r-forge.r-project.org</a><br><a href="http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta" target="_blank">http://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/gsoc-porta</a><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>