Re: Spread Curve

Posted by Khanh Nguyen on
URL: http://quantlib.414.s1.nabble.com/Fixed-bond-Empty-Handle-cannot-be-dereferenced-tp7595p7600.html

I am not sure whether this could help you, but you can check this out.

http://quantlib.org/reference/class_quant_lib_1_1_forward_spreaded_term_structure.html

-k

On Tue, Jul 7, 2009 at 8:39 AM, Bogaert, Gilles<[hidden email]> wrote:

> Dear All,
>
> I got a question concerning the spread curve. I built at first a zero
> curve. Then I wanted to add a spread to this curve. My aim was to add a
> flat spread curve to pull up the previous zero curve. To do so, I built
> a spread vector with a value of 0.01684 and a date vector with the same
> dates than my bond schedule.
> I checked the rates [depoSwapTermStructureSpreaded->zeroRate(sch.at(i))]
> for the same dates than the schedule dates. I compared these spreads to
> the risk free curve and I deducted a spread of 0.0175-0.0176. Should I
> not receive a spread of 0.01684? What did I do wrong?
>
> Thank you in advance for your help.
>
> Best regards,
>
> Gilles
>
> ----------
> Here it is the code:
>        Rate MySpreadQuote = 0.01684;
>        boost::shared_ptr<Quote> MySpreadRate (new SimpleQuote
> (MySpreadQuote));
>
>        boost::shared_ptr<YieldTermStructure> depoSwapTermStructure(
>                        new PiecewiseYieldCurve<Discount,LogLinear>(
>                                        settlementDate,
> depoSwapInstruments,
>                                        termStructureDayCounter,
>                                        std::vector<Handle<Quote> >(),
>                                        std::vector<Date>(),
>                                        tolerance));
>
>        RelinkableHandle<YieldTermStructure> discountingTermStructure;
>        discountingTermStructure.linkTo(depoSwapTermStructure);
>        RelinkableHandle<YieldTermStructure> MyHandle;
>        MyHandle.linkTo(depoSwapTermStructure);
>
>        std::vector<Handle<Quote> > MySpreadRateVector(sch.size());
>        std::vector<Date> mydates(sch.size());
>
>        /* (...) I fed my dates vector and spreads vector (...) */
>        for (int i=0; i < sch.size(); i++)
>        {
>                MySpreadRateVector[i] = Handle<Quote>(MySpreadRate);
>                mydates[i]=sch.at(i);
>        }
>
>        boost::shared_ptr<YieldTermStructure>
> depoSwapTermStructureSpreaded(
>                                                new
> PiecewiseZeroSpreadedTermStructure(
>
> MyHandle,MySpreadRateVector,mydates));
> --------
> The information in this e-mail is confidential and may be legally privileged. It is intended
> solely for the addressee. Access to this e-mail by anyone else is unauthorized. If you have
> received this communication in error, please address with the subject heading "Received in
> error," send back to the sender, then delete the e-mail and destroy any copies of it. If you
> are not the intended recipient, any disclosure, copying, distribution or any action taken or
> omitted to be taken in reliance on it, is prohibited and may be unlawful. Any opinions or
> advice contained in this e-mail are subject to the terms and conditions expressed in the
> governing KPMG client engagement letter. Opinions, conclusions and other information in this
> e-mail and any attachments that do not relate to the official business of the firm are
> neither given nor endorsed by it. KPMG cannot guarantee that e-mail communications are secure
> or error-free, as information could be intercepted, corrupted, amended, lost, destroyed,
> arrive late or incomplete, or contain viruses.
>
> KPMG is the Luxembourg member firm of KPMG international. KPMG International is a Swiss
> cooperative that serves as a coordinating entity for a network of independent firms operating
> under the KPMG name. KPMG International provides no services to clients. Each member firm of
> KPMG International is a legally distinct and separate entity and each describes itself as
> such. Information about the structure and jurisdiction of your local KPMG member firm can be
> obtained from your KPMG representative.
>
> This footnote also confirms that this e-mail message has been swept by AntiVirus software for
> the presence of computer viruses. However, the ultimate responsibility for virus checking
> lies with the recipient of this e-mail.
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/blackberry
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users