constrainedBootstrapperExample.cpp
This example show how to build curve using constrained bootstrapper (ConstrainedBootstrapper). Programme uses data files stored as csv in ./data directory Plots below presents the interest rate curves build using different smoothing parameters. Larger smoothing parameter produce smoother curve
Here we present the calibration of the curve. Note that difference between model and market is controlled by smoothing parameter. Larger smoothing parameter expends the area where solver searches for minimum.
Here we present the effect of interpolation method on the curve.
#include <juliant.hpp>
#include "factoryInit.hpp"
using namespace julian;
int main(int argc, char *argv[]) {
RunTimeMeasurment timer;
//
// Setting the calendar and the today date
//
Date today(2018, JUN, 20);
PLNHoliday holiday;
.addHoliday(holiday)
.withSpotLag(2);
//
// Reading the command line arguments; If not provided, program uses default names
//
auto data_file = args.first.empty() ? "../data/curve_data.csv" : args.first;
auto settings_file = args.second.empty() ? "../data/curve_settings.csv" : args.second;
//
// Creating benchmark instruments
//
std::vector<Deposit> deposits = ir::readDeposit(df_depo, today, calendar);
std::vector<FRA> fras = ir::readFRA(df_fra, today, calendar);
std::vector<IRS> swaps = ir::readIRS(df_irs, today, calendar);
std::vector<SmartPointer<ir::BuildingBlock> > benchmarks;
benchmarks.insert(benchmarks.end(), deposits.begin(), deposits.end());
benchmarks.insert(benchmarks.end(), fras.begin(), fras.end());
benchmarks.insert(benchmarks.end(), swaps.begin(), swaps.end());
//
// Reading curve settings
//
//
// Constructing the curve
//
DataFrame estimation_resuts;
DataFrame calibration_results;
auto set_name = df_settings("Id", r);
std::cout << set_name << std::endl;
SmartPointer<ir::SmootherCostFunction> scf = df_settings.getObject<ir::SmootherCostFunction>("SmoothingInput",r);
scf = ir::FirstDerivativeCostFunction(scf);
}
scf = ir::SecondDerivativeCostFunction(scf);
}
InterestRate rate(compounding, yf);
ir::CompoundedInterpolator interpolator(interpolation, inputs);
.asOfDate(today)
.withCalendar(calendar)
.withInterestRate(rate)
.withInterpolator(interpolator)
.withSetOfInstruments(benchmarks)
.usingEstimator(estimator);
calibration_results.append(calib);
estimation_resuts.append(curve_data);
}
//
// Saving results
//
estimation_resuts.printToCsv("constrained_results");
}