// the only header you need to use QuantLib #pragma warning( disable:4819 ) //Disable some warning messages #include # include #include #include #include using namespace QuantLib; int main() { //~~~~~~~~~~~~~~~~~~~~~~~~~SABR Interpolation Curve std::cout << "SABR Interpolation" << std::endl; std::vector xVec(2), yVec(xVec.size()); xVec[0] = 100; yVec[0]=0.135790472; xVec[1] = 120; yVec[1]=0.117239291; //SABR::SABR(4.649315068, 110.5, 0.5, 1, 0.5, 0.5, false, false, false, false); //It just assigns value within the private components of the class SABRInterpolation SABRLinInterpolation(xVec.begin(), xVec.end(), yVec.begin(), 4.649315068, 110.5, 0.119748326, 1, 0.465537854, -0.423240889, false, false, false, false); std::cout << "Sabr Vol at Strike 102 " << SABRLinInterpolation(102) << std::endl; //Note that the extrapolation has to be at within the X range std::cout << "Sabr Vol at Strike 105 " << SABRLinInterpolation(105) << std::endl; std::cout << "Sabr Vol at Strike 110 " << SABRLinInterpolation(110) << std::endl<< std::endl; system("pause"); return 0; }