# Inputs for calibration of spot curve
yield.curve <- c(0.015,0.0175, 0.0225, 0.0275, 0.0325, 0.0375,0.04,0.0425,0.045,0.0475,0.05)
names(yield.curve) <- c(0.5,1,2,3,4,5,6,7,8,9,10)
nodes <- seq(0,10,0.001)
# Calibration of local spot curve
rates <- curve.calibration (yield.curve = yield.curve, market.assets = NULL,
analysis.date = "2019-01-03" , asset.type = "IBRSwaps",
freq = 4, rate.type = 0, fwd = 0, npieces = NULL,
obj = "Price", nodes = nodes, approximation = "linear")
# Input for Basis Curve
ex.rate <- 4814
swaps <- rbind(c("2024-03-01", "FF", 0.07 , 0.0325, NA , NA , 2000 * ex.rate, 2000),
c("2025-03-01", "VV", NA , NA , 0.015, 0.0175, 2000 * ex.rate, 2000),
c("2026-03-01", "FF", 0.075, 0.03 , NA , NA , 5000000, 5000000 / ex.rate),
c("2027-03-01", "VV", NA , NA , 0.01 , 0.015 , 5000000, 5000000 / ex.rate),
c("2028-03-01", "FF", 0.08 ,0.035 , NA , NA , 3000000, 3000000 / ex.rate),
c("2029-03-01", "VV", NA , NA , 0.01 , 0.0125, 3000000, 3000000 / ex.rate))
colnames(swaps) <- c("Mat" ,"Legs", "C1" , "C2", "spread1", "spread2", "prin1", "prin2")
# Function
basis.curve(swaps = swaps, ex.rate = 4814, analysis.date = "2023-03-01",
rates = rates, rates2 = rates / 4, freq = c(2,2,2,2,1,1),
rate.type = 1, npieces = 4, obj = "Price", Weights = NULL,
nsimul = 1, nodes = nodes, approximation = "linear")
Run the code above in your browser using DataLab