CPPI function

Constant-Proportion Portfolio Insurance

Constant-Proportion Portfolio Insurance

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

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.

Returns

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

References

Chapter 9 of Gilli, M., Maringer, D. and Schumann, E. (2019) Numerical Methods and Optimization in Finance. 2nd edition. Elsevier. tools:::Rd_expr_doi("10.1016/C2017-0-01621-X")

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

Author(s)

Original MATLAB code: Dietmar Maringer.

implementation: Enrico Schumann.

Examples

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")