The dated date is accrual starting date. Not all the bonds start accrual interest at issue date, dated date can be before the issue date.
In order to get the correct coupon payment, dated date is used to determine the coupon at coupon payment date. Hope this helps. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Toyin Akin Sent: Tuesday, August 02, 2005 11:24 AM To: [hidden email] Subject: [Quantlib-users] Bonds Helper class... Hi guys, What do you guys think of this first implementation of a Bonds Helper class in order to strip a bonds curve. (Deposits+Futures+Bonds) I'm not too sure whether both the issueDate and datedDate are needed. What exactly is the dated date? Header file : ############################################################################################# #ifndef quantlib_bondhelper_hpp #define quantlib_bondhelper_hpp #include <ql/Instruments/FixedCouponBond.hpp> #include <ql/TermStructures/ratehelpers.hpp> namespace QuantLib { class BondHelper : public RateHelper { public: BondHelper(const Handle<Quote>& Price, const Date& issueDate, const Date& datedDate, const Date& maturityDate, Integer settlementDays, const std::vector<Rate>& coupons, Frequency couponFrequency, const DayCounter& dayCounter, const Calendar& calendar, BusinessDayConvention convention = Following, Real redemption = 100.0, const Date& stub = Date(), bool fromEnd = true); Real impliedQuote() const; // implementing discountGuess() is not worthwhile, // and may not avoid the root-finding process Date latestDate() const; void setTermStructure(YieldTermStructure*); protected: Integer settlementDays_; Calendar calendar_; BusinessDayConvention businessDayConvention_; DayCounter dayCount_; Date stub_; bool fromEnd_; std::vector<Rate> coupons_; Date issueDate_, datedDate_, maturityDate_; Frequency frequency_; Real redemption_; Date settlement_, latestDate_; boost::shared_ptr<FixedCouponBond> bond_; Handle<YieldTermStructure> termStructureHandle_; }; } #endif ############################################################################################# cpp file : ############################################################################################# #include <ql/TermStructures/BondHelper.hpp> namespace QuantLib { namespace { void no_deletion(YieldTermStructure*) {} } BondHelper::BondHelper(const Handle<Quote>& Price, const Date& issueDate, const Date& datedDate, const Date& maturityDate, Integer settlementDays, const std::vector<Rate>& coupons, Frequency couponFrequency, const DayCounter& dayCounter, const Calendar& calendar, BusinessDayConvention convention, Real redemption, const Date& stub, bool fromEnd) : RateHelper(Price) { coupons_ = coupons; settlementDays_ = settlementDays; businessDayConvention_ = convention; calendar_ = calendar; dayCount_ = dayCounter; stub_ = stub; fromEnd_ = fromEnd; issueDate_ = issueDate; datedDate_ = datedDate; maturityDate_ = maturityDate; frequency_ = couponFrequency; redemption_ = redemption; registerWith(Settings::instance().evaluationDate()); } void BondHelper::setTermStructure(YieldTermStructure* t) { // do not set the relinkable handle as an observer - // force recalculation when needed termStructureHandle_.linkTo( boost::shared_ptr<YieldTermStructure>(t,no_deletion), false); RateHelper::setTermStructure(t); Date today = Settings::instance().evaluationDate(); settlement_ = calendar_.advance(today,settlementDays_,Days); bond_ = boost::shared_ptr<FixedCouponBond>( new FixedCouponBond(issueDate_, datedDate_, maturityDate_, settlementDays_, coupons_, frequency_, dayCount_, calendar_, businessDayConvention_, redemption_, termStructureHandle_, stub_, fromEnd_)); latestDate_ = maturityDate_; } Date BondHelper::latestDate() const { QL_REQUIRE(termStructure_ != 0, "null term structure set"); return latestDate_; } Real BondHelper::impliedQuote() const { QL_REQUIRE(termStructure_ != 0, "term structure not set"); // we didn't register as observers - force calculation bond_->recalculate(); return bond_->NPV(); } } ############################################################################################# If you find it useful, can you merge this into the Quantlib source? Best Regards, Toy out. ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Quantlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. |
Free forum by Nabble | Edit this page |