{"id":13741415,"url":"https://github.com/braverock/PortfolioAnalytics","last_synced_at":"2025-05-08T21:34:12.815Z","repository":{"id":51846725,"uuid":"58736611","full_name":"braverock/PortfolioAnalytics","owner":"braverock","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-04T04:44:29.000Z","size":89335,"stargazers_count":78,"open_issues_count":25,"forks_count":46,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-11-04T05:26:30.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PostScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/braverock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-13T12:06:52.000Z","updated_at":"2024-11-04T04:44:33.000Z","dependencies_parsed_at":"2024-10-27T05:43:06.979Z","dependency_job_id":null,"html_url":"https://github.com/braverock/PortfolioAnalytics","commit_stats":{"total_commits":1279,"total_committers":16,"mean_commits":79.9375,"dds":0.5684128225175918,"last_synced_commit":"8522d5be1bd3c3aa0c877c2a40db9d0b2b6ca5cd"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braverock%2FPortfolioAnalytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braverock%2FPortfolioAnalytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braverock%2FPortfolioAnalytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/braverock%2FPortfolioAnalytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/braverock","download_url":"https://codeload.github.com/braverock/PortfolioAnalytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224774820,"owners_count":17367798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T04:00:58.997Z","updated_at":"2025-05-08T21:34:12.798Z","avatar_url":"https://github.com/braverock.png","language":"PostScript","funding_links":[],"categories":["R"],"sub_categories":["Financial Instruments and Pricing"],"readme":"README\n================\n\nThis V2.1 version of PortfolioAnalytics is an update to the substantial\nV2.0 version that was released on 2024-07-03. We first describe the V2.0\nfeatures, then discuss the R demo capability, and finally we describe\nthe additional V2.1 features.\n\n# 2.0 Features\n\nA major feature of 2.0 was the integration of the CVXR solver R package\nfor convex optimization. CVXR supports eleven solver packages, each of\nwhich supports solvers for one or more of the following optimization\nproblems: LP, QP, SOCP, SDP, EXP, MIP. See the Table near the beginning\nof the document “Convex Optimization in R” at \u003chttps://cvxr.rbind.io/\u003e.\nThus, with PortfolioAnalytics 2.0, users are able to use any one of a\nlarge variety of solvers available in CVXR for their portfolio optimization\nproblems.\n\nA particular use of CVXR in PortfolioAnalytics 2.0 is for computing\nMinimum Coherent Second Moment (MCSM) portfolios, which are\nsecond-order cone programming (SOCP) optimization problems. This is\na quite new capability that is not available in other portfolio\noptimization software products. Details are provided in the Vignette\n“cvxrPortfolioAnalytics”.\n\nAnother important feature of PortfolioAnalytics 2.0, is that it contains\nfunctionality for computing outliers-robust minimum variance (MV)\noptimal portfolios based on any one of several robust covariance matrix\nestimators that are not much influenced by outliers Details are provided\nin the Vignette “robustCovMatForPA”.\n\nNew PortfolioAnalytics Functions:\n\n1.  meancsm.efficient.frontier (create Mean-CSM efficient frontier)\n    utility function\n2.  meanrisk.efficient.frontier (generate multiple efficient frontiers\n    for portfolios with the same constraint object.\n3.  extract_risk (extract the risk value, e.g., StdDev or ES or CSM,\n    based on the weights of a portfolio)\n4.  chart.EfficientFrontierCompare (Overlay the efficient frontiers of\n    different minRisk portfolio objects on a single plot)\n5.  backtest.plot (based on Peter Carl’s code, generate plots of the\n    cumulative returns and/or drawdown for back-testing)\n6.  opt.outputMvo (converts output of `optimize.portfolio` to a list of\n    the portfolio weights, mean, volatility and Sharpe Ratio)\n7.  plotFrontiers (plot frontiers based on the result of\n    `meanvar.efficient.frontier`, `meanetl.efficient.frontier` or\n    `meancsm.efficient.frontier`)\n\nEnhanced PortfolioAnalytics Functions:\n\n1.  optimize.portfolio (enhanced with CVXR solvers, CSM objective,\n    customizable arg `momentFUN=` and output `~$moment_values`)\n2.  optimize.portfolio.rebalancing (enhanced with CVXR solvers, CSM\n    objective and customizable arg `momentFUN=`)\n3.  create.EfficientFrontier (enhanced with type `mean-CSM` and\n    `mean-risk`, and customizable arg `momentFUN=`)\n\nSupport of S3 Methods for CVXR:\n1.  print.optimize.portfolio.CVXR\n2.  extractStats.optimize.portfolio.CVXR\n\nCustom Moment Functions for Robust Covariance Matrices:\n1.  custom.covRob.MM\n2.  custom.covRob.Rocke\n3.  custom.covRob.Mcd\n4.  custom.covRob.TSGS\n5.  MycovRobMcd\n6.  MycovRobTSGS\n\nTwo New Vignettes, the pdf files of which are downloadable from PortfolioAnalytics at\n\u003chttps://CRAN.R-project.org/package=PortfolioAnalytics\u003e:\n1.  cvxrPortfolioAnalytics, with CRAN title “CVXR for PortfolioAnalytics”.\n2.  robustCovMatForPA, with CRAN title “Robust Covariance Matrices for\n    PortfolioAnalytics”\n\n# PortfolioAnalytics Demo Scripts\nPortfolioAnalytics has contained a substantial number of demo R scripts in the *demo* folder for a long time.  Assuming that an R package is installed, but not necessarily loaded, you can view a list of the names of al the demo folder R scripts with the following R command\n\ndemo(package = “packageName”)\n\nUse the above for the PortfolioAnalytics package, and you will see a list of over 30 demo scripts,\namong which you will see the the following two demo scripts\n\n1.  demo_cvxrPortfolioAnalytics.R\n2.  demo_robustCovMatForPA.R\n\nwhich runs the code for the corresponding two Vignettes listed above.\n\nYou can view the code for any demo R script with the command “??” (but not with “help” command).  For example, in RStudio, use of the command\n\n?? demo_cvxrPortfolioAnalytics\n\nresults in a Help tab display with the followng two links:\n\n* *PortfolioAnalytics::demo_cvxrPortfolioAnalytics*\n* (*Run demo*).\n\nUse the first link, which results in a display of the entire R script in the Help tab.  Then copy/paste the script into your own new R file, and run it in chunks that are of interest to you. Many of the chunks will run quite quickly, e.g., a few seconds, but a few of them may take 2-4 minutes. Doing so for the demo_cvxrPortfolioAnalytics.R will help you learn some PortfolioAnalytics basics, as well as learn how to use new capabilities in Versions 2.0 and 2.1. Running the demo_robustCovMatForPA.R scripts will show you how to compute *robust minimum variance* portfolios based on returns *robust covariance matrix estimators* that are not much influenced by returns outliers.\n\nNOTE: We do not recommend general use of (*Run demo*). This is because it runs the entire demo script, which will often take much too long. Furthermore, some scripts may fail to execute properly when run this way. That said, the (*Run demo*) link can be handy for running R demo scripts that execute quickly.\n\n# New 2.1 Features\n\nThe 2.1 version of PortfolioAnalytics contains the following new demo scripts:\n\n1. demo_JPM2024MinDownsideRisk.R\n2. demo_JPM2024MinDownsideRiskCVXR.R\n\nThe first script replicates all the Exhibits (Figures and Tables) in the Journal of Portfolio Management paper “Minimum Downside Risk Portfolios\", published in October 2024. This first script uses CVXR package solvers “under the hood”, i.e., not directly visible, in PortfolioAnalytics.  The second script replicates just the back-test results in Exhibits 6, 8, 10, 12, 14, 16, 18, in the above paper, but it uses the CVXR code directly in the script, where on can easily see the CVXR code details.\n\nThe 2.1 release also contains:\n\n1. Extended functionalities for graphical displays of multiple efficient frontiers, and robust covariance estimator settings\n2. The term EQS for *expected quadratic shortfall* was replaced with CSM for *coherent second moment* risk.\n3. Updates to the vignettes cvxrPortfolioAnalytics and robustCovMatForPA, and their demo scripts.\n\n# Bug Reporting\n\nPlease contribute with bug fixes, comments, and testing scripts!\n\nPlease take your data and disguise it when submitting, or use data sets\nlike “edhec” like we do in the demos or or like “stocksCRSP” and\n“factorsSPGMI” in the PCRA package or with your constraints and other\nobjectives modified to demonstrate your problem on public data.\n\nPlease report any bugs or issues on the PortfolioAnalytics GitHub page\nat \u003chttps://github.com/braverock/PortfolioAnalytics/issues\u003e\n\n# Acknowledgements\n\nThe bulk of the work in creating PortfolioAnalytics 2.0 was done by\nXinran Zhao, along with contributions from Yifu Kang, under the support\nof a 2022 Google Summer of Code (GSOC 2022). Xinran and Yifu were\nmentored in GSOC 2022 by Professor Doug Martin and Professor Steve\nMurray in the Applied Mathematics Department at the University of\nWashington.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbraverock%2FPortfolioAnalytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbraverock%2FPortfolioAnalytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbraverock%2FPortfolioAnalytics/lists"}