Hello Everyone,
I am trying to calculate the NPV of a straight bond. I
instantiated the yield curve and I relinked it to discountingTermStructure. But
when I call fixedRateBond.NPV(), I got this message “empty Handle cannot
be dereferenced”. Here is the code:
boost::shared_ptr<YieldTermStructure> depoSwapTermStructure(
new
PiecewiseYieldCurve<Discount,LogLinear>(
settlementDate,
depoSwapInstruments,
termStructureDayCounter,
std::vector<Handle<Quote>
>(),
std::vector<Date>(),
tolerance));
RelinkableHandle<YieldTermStructure> discountingTermStructure;
boost::shared_ptr<PricingEngine> bondEngine(
new
DiscountingBondEngine(discountingTermStructure));
fixedRateBond.setPricingEngine(bondEngine);
std::cout << fixedRateBond.NPV() << std::endl;
Someone would be so kind to give me some hints?
Thank you in advance for your help.
Gilles
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.
------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
| Free forum by Nabble | Edit this page |