Skip to content

Commit f2960ed

Browse files
author
sebastien.bouvard
committed
QPR-13739 RunningCoupon from restore with fallback to 100
1 parent c02866e commit f2960ed

2 files changed

Lines changed: 3 additions & 21 deletions

File tree

OREData/ored/marketdata/defaultcurve.cpp

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ void DefaultCurve::buildCdsCurve(const std::string& curveID, const DefaultCurveC
435435
}
436436
}else if(config.type() == DefaultCurveConfig::Config::Type::ConvSpreadCDS){
437437
refData.type = "ConvSpreadCDS";
438-
// Currently same than SpreadCDS
439438
for (auto quote : quotes) {
440439
try {
441440
if ((cdsConv->rule() == DateGeneration::CDS || cdsConv->rule() == DateGeneration::CDS2015 ||
@@ -484,7 +483,7 @@ void DefaultCurve::buildCdsCurve(const std::string& curveID, const DefaultCurveC
484483
)
485484
);
486485

487-
Rate fixedCoupon = 100 / 10000.0;
486+
Rate fixedCoupon = config.runningSpread() == QuantLib::Null<Real>() ? 100 / 10000.0 : config.runningSpread();
488487

489488
// Fixed-coupon CDS; ask for fairUpfront
490489
Date upfrontSettle = cdsConv->calendar().advance(asof, cdsConv->upfrontSettlementDays() * Days);
@@ -496,31 +495,13 @@ void DefaultCurve::buildCdsCurve(const std::string& curveID, const DefaultCurveC
496495
ext::shared_ptr<PricingEngine> engine(new IsdaCdsEngine(dProb, recoveryRate_, discountCurve));
497496
fixedCpnTrade->setPricingEngine(engine);
498497

499-
// Upfront helper (ISDA) — we’ll ask it for implied fair upfront
500-
// Date upfrontSettle = cdsConv->calendar().advance(asof, cdsConv->upfrontSettlementDays() * Days);
501-
// QuantLib::RelinkableHandle<QuantLib::DefaultProbabilityTermStructure> prob;
502-
// auto flatHazard = QuantLib::ext::make_shared<QuantLib::FlatHazardRate>(0, cdsConv->calendar(), h, Actual365Fixed());
503-
// prob.linkTo(flatHazard);
504-
// auto upfrontHelper = QuantLib::ext::make_shared<UpfrontCdsHelper>(
505-
// /*upfront*/ Rate(0.0), fixedCoupon, quote.term, cdsConv->settlementDays(), cdsConv->calendar(),
506-
// cdsConv->frequency(), cdsConv->paymentConvention(), cdsConv->rule(), Actual360(), recoveryRate_,
507-
// discountCurve, CreditDefaultSwap::ISDA, cdsConv->upfrontSettlementDays(),
508-
// cdsConv->settlesAccrual(), ppt, Date());
509-
510-
// Wire the flat hazard to the helper so its internal CDS uses it
511-
// upfrontHelper->setTermStructure(prob.currentLink().get());
512-
513-
// Real npv = fixedCpnTrade->NPV();
514498
// Real fairSpreadClean = fixedCpnTrade->fairSpreadClean();
515499
Rate calcUpfront = fixedCpnTrade->fairUpfront();
516-
// Compare NPV against PV of upfront (discounted to asof)
517-
// Real df = discountCurve->discount(upfrontSettle);
518-
// Real pvUpfront = calcUpfront * df * fixedCpnTrade->notional();
519500

520501
auto tmp = QuantLib::ext::make_shared<UpfrontCdsHelper>(
521502
calcUpfront, fixedCoupon, quote.term, cdsConv->settlementDays(), cdsConv->calendar(),
522503
cdsConv->frequency(), cdsConv->paymentConvention(), cdsConv->rule(), cdsConv->dayCounter(),
523-
recoveryRate_, discountCurve, CreditDefaultSwap::PricingModel::ISDA, cdsConv->upfrontSettlementDays(), cdsConv->settlesAccrual(), ppt,
504+
recoveryRate_, discountCurve, CreditDefaultSwap::PricingModel::Midpoint, cdsConv->upfrontSettlementDays(), cdsConv->settlesAccrual(), ppt,
524505
config.startDate(), cdsConv->lastPeriodDayCounter());
525506

526507
if (tmp->latestDate() > asof) {

OREData/ored/portfolio/referencedata.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ class CreditReferenceDatum : public ReferenceDatum {
480480
QuantLib::Date predecessorImplementationDate;
481481
string entityType;
482482
string primaryPriceType;
483+
Real runningSpread;
483484
};
484485
CreditReferenceDatum() {}
485486

0 commit comments

Comments
 (0)