@@ -75,6 +75,7 @@ void ForwardBond::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
7575 }
7676 Real amount = amount_.empty () ? Null<Real>() : parseReal (amount_);
7777 Real lockRate = lockRate_.empty () ? Null<Real>() : parseReal (lockRate_);
78+ Real dv01 = dv01_.empty () ? Null<Real>() : parseReal (dv01_);
7879 DayCounter lockRateDayCounter = lockRateDayCounter_.empty () ? Actual360 () : parseDayCounter (lockRateDayCounter_);
7980 bool settlementDirty = settlementDirty_.empty () ? true : parseBool (settlementDirty_);
8081 Real compensationPayment = parseReal (compensationPayment_);
@@ -84,6 +85,7 @@ void ForwardBond::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
8485 QL_REQUIRE ((amount == Null<Real>() && lockRate != Null<Real>()) ||
8586 (amount != Null<Real>() && lockRate == Null<Real>()),
8687 " ForwardBond: exactly one of Amount of LockRate must be given" );
88+ QL_REQUIRE (dv01 >= 0.0 , " negative DV01 given" );
8789 QL_REQUIRE (compensationPaymentDate <= fwdMaturityDate, " Premium cannot be paid after forward contract maturity" );
8890
8991 if (lockRate != Null<Real>())
@@ -138,7 +140,7 @@ void ForwardBond::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
138140 : boost::make_shared<QuantExt::ForwardBond>(bond, lockRate, lockRateDayCounter, longInForward,
139141 fwdMaturityDate, fwdSettlementDate, isPhysicallySettled,
140142 settlementDirty, compensationPayment,
141- compensationPaymentDate, bondData_.bondNotional ());
143+ compensationPaymentDate, bondData_.bondNotional (), dv01 );
142144
143145 boost::shared_ptr<fwdBondEngineBuilder> fwdBondBuilder =
144146 boost::dynamic_pointer_cast<fwdBondEngineBuilder>(builder_fwd);
@@ -177,6 +179,7 @@ void ForwardBond::fromXML(XMLNode* node) {
177179 lockRate_ = XMLUtils::getChildValue (fwdSettlementNode, " LockRate" , false );
178180 lockRateDayCounter_ = XMLUtils::getChildValue (fwdSettlementNode, " LockRateDayCounter" , false );
179181 settlementDirty_ = XMLUtils::getChildValue (fwdSettlementNode, " SettlementDirty" , false );
182+ dv01_ = XMLUtils::getChildValue (fwdSettlementNode, " dv01" , false );
180183
181184 XMLNode* fwdPremiumNode = XMLUtils::getChildNode (fwdBondNode, " PremiumData" );
182185 if (fwdPremiumNode) {
@@ -207,6 +210,8 @@ XMLNode* ForwardBond::toXML(XMLDocument& doc) {
207210 XMLUtils::addChild (doc, fwdSettlementNode, " Amount" , amount_);
208211 if (!lockRate_.empty ())
209212 XMLUtils::addChild (doc, fwdSettlementNode, " LockRate" , lockRate_);
213+ if (!dv01_.empty ())
214+ XMLUtils::addChild (doc, fwdSettlementNode, " dv01" , dv01_);
210215 if (!lockRateDayCounter_.empty ())
211216 XMLUtils::addChild (doc, fwdSettlementNode, " LockRateDayCounter" , lockRateDayCounter_);
212217 if (!settlementDirty_.empty ())
0 commit comments