R: Error: Empty Handle cannot be dereferenced

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

R: Error: Empty Handle cannot be dereferenced

tarpanelli@libero.it
Hi
I've modified the yield term structure from
RelinkableHandle<YieldTermStructure> to Handle<YieldTermStructure> .

I am not convinced that this is the right way to solve the issue but it
works!:)

Regards,

Paolo
>----Messaggio originale----
>Da: [hidden email]
>Data: 31/08/2010 14.18
>A: <[hidden email]>
>Ogg: [Quantlib-users] Error: Empty Handle cannot be dereferenced
>
>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
>



------------------------------------------------------------------------------
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