Value Averaging
Purpose
To Simulate a Simple VA exercise
Data Preparation
> library(xts) > niftybees <- read.csv("C:/Cauldron/Benchmark/Interns/niftybees.csv", + header = T, stringsAsFactors = F) > niftybees$trade.date <- as.Date(niftybees[, 1], format = "%d-%b-%y") > niftybees <- xts(niftybees[, 2], niftybees$trade.date) |
Plot of NIFTY BeES over the last 7.5 years
> plot(niftybees, main = "NIFTY BeES") |
Prepare Resampled Returns
> library(fSeries) > niftybees.ret <- as.xts(returns(niftybees)[-1, ]) > plot(niftybees.ret, main = "NIFTY BeES Returns") |
> GetRealization <- function(spot, spotreturns, steps) { + x <- sample(spotreturns, steps) + y <- spot * cumprod(1 + x) + return(y) + } |
Plain Vanilla VIP
Business Case : Target Maturity Date = 5 Years Growth Rate = 1 percent every month Amount = 5000 Rs Per month What is the payoff at the end of 5 years
> NiftySpot <- 530 > T <- 60 > g <- 0.01 > C <- 2000 > portfolio <- vector(mode = "numeric", length = (T + 1)) > units <- vector(mode = "numeric", length = (T + 1)) > target <- vector(mode = "numeric", length = (T + 1)) > monthly.inv <- vector(mode = "numeric", length = (T + 1)) > portfolio[1] <- C > target[1] <- C > units[1] <- C/NiftySpot > monthly.inv[1] <- C > price.path <- GetRealization(NiftySpot, niftybees.ret, (T)) > price.path <- c(NiftySpot, price.path) > i <- 2 > for (i in 2:(T + 1)) { + print(i) + current.val <- units[i - 1] * price.path[i] + target[i] <- target[i - 1] * (1 + g) + C + if (current.val < target[i]) { + delta.val <- target[i] - current.val + delta.units <- delta.val/price.path[i] + units[i] <- units[i - 1] + delta.units + monthly.inv[i] <- delta.units * price.path[i] + } + if (current.val > target[i]) { + delta.val <- current.val - target[i] + delta.units <- delta.val/price.path[i] + units[i] <- units[i - 1] - delta.units + monthly.inv[i] <- 0 + } + } [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 [1] 7 [1] 8 [1] 9 [1] 10 [1] 11 [1] 12 [1] 13 [1] 14 [1] 15 [1] 16 [1] 17 [1] 18 [1] 19 [1] 20 [1] 21 [1] 22 [1] 23 [1] 24 [1] 25 [1] 26 [1] 27 [1] 28 [1] 29 [1] 30 [1] 31 [1] 32 [1] 33 [1] 34 [1] 35 [1] 36 [1] 37 [1] 38 [1] 39 [1] 40 [1] 41 [1] 42 [1] 43 [1] 44 [1] 45 [1] 46 [1] 47 [1] 48 [1] 49 [1] 50 [1] 51 [1] 52 [1] 53 [1] 54 [1] 55 [1] 56 [1] 57 [1] 58 [1] 59 [1] 60 [1] 61 > results <- cbind(target, monthly.inv) |
Basic Plots of Value Path, Monthly Outflow and Asset Path realization
> layout(rbind(c(1, 2), c(3, 3))) > plot(results[, 1]/1e+05, type = "l", ylim = c(0, 2), col = "blue", + lwd = 2, ylab = "INR (Lakhs) ", xlab = "Time", main = "Value Path") > plot(results[, 2] * 10, type = "l", , col = "blue", lwd = 2, + ylab = "Monthly Outflow", xlab = "Time", main = "Monthly Outflow") > abline(h = C) > abline(h = 0) > plot(price.path, type = "l", lwd = 2, col = "blue", main = "Hypothetical Asset Value Realization") |
If you are designing a target maturity product, the volatility that you see at the end of 5 years is going to kill you . Hence there is an obvious need for shifting to lesser risk assets as the investor approaches the maturity period.