Hello,
I have instantiated a yield curve and relinked it to a term structure built by using a list of instruments. The I used it to price a Vanilla swap but I got the following error: 2nd leg: empty Handle cannot be dereferenced. I tested the yield curve and it works fine by returning me good zero rates and discount factors. Here is the code Paolo / ****** CODE ******/ ..... boost::shared_ptr<YieldTermStructure> depofutswap_structure(new PiecewiseYieldCurve<Discount,LogLinear>(reference_date, instruments_collection, daycount, tolerance)); RelinkableHandle<YieldTermStructure> yieldCurve; yieldCurve.linkTo(depofutswap_structure); // Creating the X x Y swap BusinessDayConvention swaption_FloatLegConv = Unadjusted; BusinessDayConvention swaption_FixedLegConv = Unadjusted; VanillaSwap::Type swap_type = VanillaSwap::Payer; Date optionexpiry = cal.advance(startdate,option_tenor); Date swaplength = cal.advance(startdate,swap_tenor); Schedule swaption_FixedSch(optionexpiry, swaplength, Period(swaption_FixedLegFreq), calend, swaption_FixedLegConv, swaption_FixedLegConv, DateGeneration::Forward, false); Schedule swaption_FloatingSch(optionexpiry, swaplength, Period(swaption_FloatLegFreq), calend, swaption_FloatLegConv, swaption_FloatLegConv, DateGeneration::Forward, false); boost::shared_ptr<IborIndex> swaption_FloatingLegIndex(new Euribor(Period (swaption_FloatLegFreq), yieldCurve)); boost::shared_ptr<VanillaSwap> swaptionPtr(new VanillaSwap (swap_type, ////////// <<<---------- Error appears here principal, swaption_FixedSch, strike, swaption_FixedLegDc, swaption_FloatingSch, swaption_FloatingLegIndex, 0.0, swaption_FloatingLegIndex->dayCounter())); ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |