# CPPI: Constant-Proportion Portfolio Insurance In enricoschumann/NMOF: Numerical Methods and Optimization in Finance

## Description

Simulate constant-proportion portfolio insurance (CPPI) for a given price path.

## Usage

 `1` ```CPPI(S, multiplier, floor, r, tau = 1, gap = 1) ```

## Arguments

 `S` numeric: price path of risky asset `multiplier` numeric `floor` numeric: a percentage, should be smaller than 1 `r` numeric: interest rate (per time period tau) `tau` numeric: time periods `gap` numeric: how often to rebalance. 1 means every timestep, 2 means every second timestep, and so on.

## Details

Based on Dietmar Maringer's MATLAB code (function CPPIgap, Listing 9.1).

See Gilli, Maringer and Schumann, 2011, chapter 9.

## Value

A list:

 `V` normalised value (always starts at 1) `C` cushion `B` bond investment `F` floor `E` exposure `N` units of risky asset `S` price path

## Author(s)

Original MATLAB code: Dietmar Maringer. R implementation: Enrico Schumann.

## References

Chapter 9 of Gilli, M., Maringer, D. and Schumann, E. (2011) Numerical Methods and Optimization in Finance. Elsevier. http://www.elsevierdirect.com/product.jsp?isbn=9780123756626

Schumann, E. (2017) Financial Optimisation with R (NMOF Manual). http://enricoschumann.net/NMOF.htm#NMOFmanual

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```tau <- 2 S <- gbm(npaths = 1, timesteps = tau*256, r = 0.02, v = 0.2^2, tau = tau, S0 = 100) ## rebalancing every day sol <- CPPI(S, multiplier = 5, floor = 0.9, r = 0.01, tau = tau, gap = 1) par(mfrow = c(3,1), mar = c(3,3,1,1)) plot(0:(length(S)-1), S, type = "s", main = "stock price") plot(0:(length(S)-1), sol\$V, type = "s", main = "value") plot(0:(length(S)-1), 100*sol\$E/sol\$V, type = "s", main = "% invested in risky asset") ## rebalancing every 5th day sol <- CPPI(S, multiplier = 5, floor = 0.9, r = 0.01, tau = tau, gap = 5) par(mfrow = c(3,1), mar = c(3,3,1,1)) plot(0:(length(S)-1), S, type = "s", main = "stock price") plot(0:(length(S)-1), sol\$V, type = "s", main = "value") plot(0:(length(S)-1), 100*sol\$E/sol\$V, type = "s", main = "% invested in risky asset") ```

enricoschumann/NMOF documentation built on Feb. 14, 2019, 2:21 p.m.