Contemporary Portfolio Optimization with R

© 2013-2018 Ronald Hochreiter /

This package aims at implementing something along the lines of a tidy portfolio optimization framework, simplifying the whole process from data to decision as good as possible.

More about Finance with R can be found at

Main Motivation

The main motivation is to create a R package that simplifies the process of portfolio optimization as much as possible. Furthermore providing an approach to portfolio optimization which is completely agnostic to risk measures and optimization methods. Finally the approach should naturally fit into the contemporary R piping concept using packages like magrittr.


Instant gratification

# Load the package

# Use any scenario data, e.g. the one provided with the package

# Do a portfolio optimization in one line

Piping using magrittr

Furthermore, everything should be pipeable and such is the design of the package, i.e.

# The above initial portfolio optimization can be piped as follows 
scenario.set %>% 
  optimal.portfolio %>% 

# Of course, this is interesting if you change lots of parameters and keeps your
# portfolio models readable and well-shaped for communication
scenario.set %>% 
  portfolio.model %>% 
  objective("expected.shortfall") %>% 
  alpha(0.1) %>% 
  upper.bound(0.2) %>%
  optimal.portfolio %>% 

Further examples

There are some tutorials built into the package, which you may e.g. open with the following commands: