boost::shared_ptr<BlackCapFloorEngine> MustCapFloor::setEngineQuantLibBalckFT(){ CurveData cData; // Fill out with some sample market data cData.sampleMktData(cData); // Build a curve linked to this market data boost::shared_ptr<YieldTermStructure> ocurve = (cData.buildCurve(cData)); // Link the curve to the term structure this->forwardingTermStructure.linkTo(ocurve); //Date today(6, October, 2014); Settings::instance().evaluationDate() = today; //Date todaysDate = Date(8, Apr, 2015); //capletsVolatilies = buildCurveOptionletAtmVol(cVol); //capletsVolatilies = buildOptionletSurfaceVol(cVol); //capletsVolatilies = buildOptionletCurveVol(cVol); cVol.termStructure.linkTo(ocurve); capletsVolatilies = (cVol.buildFlatCurveVol(cVol)); //capVol->enableExtrapolation(); return boost::shared_ptr<BlackCapFloorEngine>(new BlackCapFloorEngine(forwardingTermStructure, capletsVolatilies)); }
boost::shared_ptr<AnalyticCapFloorEngine> MustCapFloor::setEngineQuantLibLMM(){ CurveData cData; // Fill out with some sample market data cData.sampleMktData(cData); //Date today(10, October, 2014); //Settings::instance().evaluationDate() = today; // Build a curve linked to this market data boost::shared_ptr<YieldTermStructure> ocurve = (cData.buildCurve(cData)); // Link the curve to the term structure boost::shared_ptr<IborIndex> index = boost::shared_ptr<IborIndex>(new Euribor6M(forwardingTermStructure)); Date todaysDate = myIndex->fixingCalendar().adjust(today); Settings::instance().evaluationDate() = todaysDate; this->forwardingTermStructure.linkTo(ocurve); const Size size = floatingLeg.size(); boost::shared_ptr<LiborForwardModelProcess> process( new LiborForwardModelProcess(size, myIndex)); //// set-up the model ///* const Real a = 0.02; //const Real b = 0.12; //const Real c = 0.1; //const Real d = 0.01;*/ const Real a = 0.025; const Real b = 0.12; const Real c = 0.1; const Real d = 0.01; boost::shared_ptr<LmVolatilityModel> volaModel( new LmLinearExponentialVolatilityModel(process->fixingTimes(), a, b, c, d)); boost::shared_ptr<LmCorrelationModel> corrModel( new LmLinearExponentialCorrelationModel(size, 0.1, 0.1)); boost::shared_ptr<LiborForwardModel> liborModel( new LiborForwardModel(process, volaModel, corrModel)); return boost::shared_ptr<AnalyticCapFloorEngine> ( new AnalyticCapFloorEngine(liborModel, forwardingTermStructure)); }