Maximize the omega ratio


Perform a scenario optimization that maximizes the omega ratio.


You need:

  • a three-dimensional array containing scenarios
  • Portfolio Probe
  • the pprobeSup package

The pprobeSup package needs to be loaded into your R session:


If pprobeSup is not installed on your machine, then you can get it with:


or alternatively with:


You also need to have the Portfolio Probe package loaded into your R session:


If you don’t have Portfolio Probe, see “Demo or Buy”.

Doing the example

You need to have the pprobeData package loaded into your R session:


This package may be installed from the same repository as pprobeSup.

Doing it


We use a scenario object created in “generate historical scenarios”.


We need to specify the constraints for the portfolio in addition to the utility and the scenarios.  The omega ratio also requires a target return which in this case we take to be 3%:

 omegaOpt <- scenario.optimizer(monScen,, extraArgs=list(target=0.03), 
   gross.value=1e6, long.only=TRUE, max.weight=.08, 

The constraints for this problem are that the gross value of the portfolio is (close to) $1 million, the portfolio is long-only, no asset may have a weight greater than 8% and there are between 20 and 30 names in the portfolio.

The result is an object that holds the best portfolio found, the trade to get there, and some other information.


There is a demand for the current prices in order to constrain the current portfolio value.  In this case the default prices are used, which is the first row of the first scenario.

The extraArgs argument to scenario.optimizer is used to give additional arguments to the utility function.

There’s not much else to explain.  Feed in the scenarios, utility and constraints.  Out comes an approximately optimal portfolio for that problem.

Further details

the number of iterations

You can specify the maximum number of iterations that can be used — the number of bites is the function’s analogy:

 omegaOpt2 <- scenario.optimizer(monScen,, extraArgs=list(target=0.03), 
    gross.value=1e6, long.only=TRUE, max.weight=.08, 
    port.size=c(20,30), regulate=c(nbites=100))

multiple times

We can get utilities at multiple future time points.  But to do an optimization, we need to combine those into a single number.  In this problem we have returns over two different time periods and then we do a weighted sum of them for each portfolio:

multomegaOpt <- scenario.optimizer(dqScen[c(1,21,41),,],
   extraArgs=list(target=0.03, weights=c(.8, .2)), 
   gross.value=1e6, long.only=TRUE, max.weight=.08, 
   port.size=c(20,30), regulate=c(nbite=100))

The length of the weights argument to the utility (given via extraArgs) needs to be one less than the number of time points in the scenarios.  Here we have 3 time points for the prices which means 2 returns.

A possibility that isn’t done is to allow cumulative returns.  The returns in this problem are from day 1 to day 21, and then from day 21 to day 41.  Cumulative returns would be from day 1 to day 21 and then from day 1 to day 41.

variance matrix

You can provide a variance matrix in order to impose variance constraints, tracking error constraints or risk fraction constraints.

See also