Skip to content

Commit 8b69c48

Browse files
committed
QPR-13647 scale notional, minor fixes
1 parent a5b59bc commit 8b69c48

5 files changed

Lines changed: 80 additions & 48 deletions

File tree

OREAnalytics/orea/app/marketcalibrationreport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ void MarketCalibrationReportBase::addInflationCurve(const QuantLib::Date& refdat
396396
if (info == nullptr)
397397
return;
398398

399-
const string inflationStr = "inflationCuve";
399+
const string inflationStr = "inflationCurve";
400400

401401
// check if we have already processed this curve
402402
if (checkCalibrations(label, inflationStr, id)) {

OREData/ored/marketdata/inflationcurve.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ InflationCurve::CurveBuildResults
315315
results.rateHelperTypes.push_back("ZeroCouponInflation");
316316
results.cashflowGenerators.push_back(
317317
std::function<std::vector<TradeCashflowReportData>()>([instrument, index, asof, nominalTs]() {
318-
return getCashflowReportData({instrument->swap()->leg(0), instrument->swap()->leg(1)},
319-
{false, true}, {1.0, 1.0}, index->currency().code(),
320-
{index->currency().code(), index->currency().code()}, asof,
321-
{*nominalTs, *nominalTs}, {1.0, 1.0}, {}, {});
318+
return getCashflowReportData(
319+
{instrument->swap()->leg(0), instrument->swap()->leg(1)}, {false, true}, {1.0E6, 1.0E6},
320+
index->currency().code(), {index->currency().code(), index->currency().code()}, asof,
321+
{*nominalTs, *nominalTs}, {1.0, 1.0}, {}, {}, {"Interest", ""}, {1.0E6, 1.0E6});
322322
}));
323323
}
324324
}
@@ -422,9 +422,9 @@ InflationCurve::CurveBuildResults
422422
results.cashflowGenerators.push_back(
423423
std::function<std::vector<TradeCashflowReportData>()>([instrument, index, asof, nominalTs]() {
424424
return getCashflowReportData({instrument->swap()->leg(0), instrument->swap()->leg(1)},
425-
{false, true}, {1.0, 1.0}, index->currency().code(),
425+
{false, true}, {1.0E6, 1.0E6}, index->currency().code(),
426426
{index->currency().code(), index->currency().code()}, asof,
427-
{*nominalTs, *nominalTs}, {1.0, 1.0}, {}, {});
427+
{*nominalTs, *nominalTs}, {1.0E6, 1.0E6}, {}, {});
428428
}));
429429
}
430430
}

OREData/ored/marketdata/yieldcurve.cpp

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,14 +2112,21 @@ void YieldCurve::addFutures(const std::size_t index, const QuantLib::ext::shared
21122112
futureConvention->overnightIndexFutureNettingType());
21132113
instruments.push_back(
21142114
{helper, "Short OI Future", marketQuote->name(), marketQuote->quote()->value(),
2115-
std::function<std::vector<TradeCashflowReportData>()>{[helper, index, this]() {
2116-
Leg l = {QuantLib::ext::make_shared<FixedRateCoupon>(
2115+
std::function<std::vector<TradeCashflowReportData>()>{[helper, index,
2116+
r = marketQuote->quote()->value(), this]() {
2117+
Leg l{QuantLib::ext::make_shared<FixedRateCoupon>(
21172118
helper->future()->maturityDate(), 1.0, 1.0 - helper->impliedQuote() / 100.0,
21182119
helper->future()->overnightIndex()->dayCounter(), helper->future()->valueDate(),
21192120
helper->future()->maturityDate())};
2120-
return getCashflowReportData(
2121-
{l}, {false}, {1.0}, currency_[index].code(), {currency_[index].code()}, asofDate_,
2122-
{*helper->future()->overnightIndex()->forwardingTermStructure()}, {1.0}, {}, {});
2121+
Leg m{QuantLib::ext::make_shared<FixedRateCoupon>(
2122+
helper->future()->maturityDate(), 1.0, 1.0 - r / 100.0,
2123+
helper->future()->overnightIndex()->dayCounter(), helper->future()->valueDate(),
2124+
helper->future()->maturityDate())};
2125+
return getCashflowReportData({l, m}, {false, true}, {1.0E6, 1.0E6}, currency_[index].code(),
2126+
{currency_[index].code(), currency_[index].code()}, asofDate_,
2127+
{*helper->future()->overnightIndex()->forwardingTermStructure(),
2128+
*helper->future()->overnightIndex()->forwardingTermStructure()},
2129+
{1.0, 1.0}, {}, {});
21232130
}}});
21242131

21252132
TLOG("adding OI future helper: price=" << futureQuote->quote()->value() << " start=" << startDate
@@ -2152,14 +2159,18 @@ void YieldCurve::addFutures(const std::size_t index, const QuantLib::ext::shared
21522159

21532160
instruments.push_back(
21542161
{helper, "Short MM Future", marketQuote->name(), marketQuote->quote()->value(),
2155-
std::function<std::vector<TradeCashflowReportData>()>{[helper, index, this]() {
2156-
Leg l = {QuantLib::ext::make_shared<FixedRateCoupon>(
2162+
std::function<std::vector<TradeCashflowReportData>()>{[helper, index,
2163+
r = marketQuote->quote()->value(), this]() {
2164+
Leg l{QuantLib::ext::make_shared<FixedRateCoupon>(
21572165
helper->maturityDate(), 1.0, 1.0 - helper->impliedQuote() / 100.0, helper->dayCounter(),
21582166
helper->earliestDate(), helper->maturityDate())};
2159-
return getCashflowReportData(
2160-
{l}, {false}, {1.0}, currency_[index].code(), {currency_[index].code()}, asofDate_,
2161-
{ext::shared_ptr<YieldTermStructure>(helper->termStructure(), QuantLib::null_deleter())},
2162-
{1.0}, {}, {});
2167+
Leg m{QuantLib::ext::make_shared<FixedRateCoupon>(
2168+
helper->maturityDate(), 1.0, 1.0 - r / 100.0, helper->dayCounter(),
2169+
helper->earliestDate(), helper->maturityDate())};
2170+
ext::shared_ptr<YieldTermStructure> ts(helper->termStructure(), QuantLib::null_deleter());
2171+
return getCashflowReportData({l, m}, {false, true}, {1.0E6, 1.0E6}, currency_[index].code(),
2172+
{currency_[index].code(), currency_[index].code()}, asofDate_,
2173+
{ts, ts}, {1.0, 1.0}, {}, {});
21632174
}}});
21642175
}
21652176
}
@@ -2215,13 +2226,24 @@ void YieldCurve::addFras(const std::size_t index, const QuantLib::ext::shared_pt
22152226

22162227
instruments.push_back(
22172228
{helper, "FRA", marketQuote->name(), marketQuote->quote()->value(),
2218-
std::function<std::vector<TradeCashflowReportData>()>{[helper, index, this]() {
2229+
std::function<std::vector<TradeCashflowReportData>()>{[helper, index,
2230+
r = marketQuote->quote()->value(), this]() {
22192231
QL_REQUIRE(!helper->iborCoupon()->iborIndex()->forwardingTermStructure().empty(),
22202232
"YieldCurve::addFras(): ibor index has empty forwarding term structure");
2221-
return getCashflowReportData({QuantLib::Leg{helper->iborCoupon()}}, {false}, {1.0},
2222-
currency_[index].code(), {currency_[index].code()}, asofDate_,
2223-
{*helper->iborCoupon()->iborIndex()->forwardingTermStructure()},
2224-
{1.0}, {}, {});
2233+
return getCashflowReportData(
2234+
{QuantLib::Leg{helper->iborCoupon()},
2235+
QuantLib::Leg{
2236+
QuantLib::ext::make_shared<FixedRateCoupon>(
2237+
helper->iborCoupon()->date(), 1.0, r, helper->iborCoupon()->dayCounter(),
2238+
helper->iborCoupon()->accrualStartDate(), helper->iborCoupon()->accrualEndDate(),
2239+
helper->iborCoupon()->referencePeriodStart(),
2240+
helper->iborCoupon()->referencePeriodEnd()),
2241+
}},
2242+
{false, true}, {1.0E6, 1.0E6}, currency_[index].code(),
2243+
{currency_[index].code(), currency_[index].code()}, asofDate_,
2244+
{*helper->iborCoupon()->iborIndex()->forwardingTermStructure(),
2245+
*helper->iborCoupon()->iborIndex()->forwardingTermStructure()},
2246+
{1.0, 1.0}, {}, {});
22252247
}}});
22262248
}
22272249
}
@@ -2294,9 +2316,9 @@ void YieldCurve::addOISs(const std::size_t index, const QuantLib::ext::shared_pt
22942316
: *oisHelper->swap()->iborIndex()->forwardingTermStructure();
22952317
return getCashflowReportData(
22962318
{oisHelper->swap()->fixedLeg(), oisHelper->swap()->floatingLeg()}, {false, true},
2297-
{1.0, 1.0}, currency_[index].code(),
2298-
{currency_[index].code(), currency_[index].code()}, asofDate_,
2299-
{dsc, dsc}, {1.0, 1.0}, {}, {});
2319+
{1.0E6, 1.0E6}, currency_[index].code(),
2320+
{currency_[index].code(), currency_[index].code()}, asofDate_, {dsc, dsc}, {1.0, 1.0},
2321+
{}, {});
23002322
}}});
23012323
} else {
23022324
if (oisQuote->startDate() == Null<Date>() || oisQuote->maturityDate() == Null<Date>()) {
@@ -2333,9 +2355,9 @@ void YieldCurve::addOISs(const std::size_t index, const QuantLib::ext::shared_pt
23332355
: *oisHelper->swap()->iborIndex()->forwardingTermStructure();
23342356
return getCashflowReportData(
23352357
{oisHelper->swap()->fixedLeg(), oisHelper->swap()->floatingLeg()}, {false, true},
2336-
{1.0, 1.0}, currency_[index].code(),
2337-
{currency_[index].code(), currency_[index].code()}, asofDate_,
2338-
{dsc, dsc}, {1.0, 1.0}, {}, {});
2358+
{1.0E6, 1.0E6}, currency_[index].code(),
2359+
{currency_[index].code(), currency_[index].code()}, asofDate_, {dsc, dsc}, {1.0, 1.0},
2360+
{}, {});
23392361
}}});
23402362
}
23412363
}
@@ -2394,7 +2416,7 @@ void YieldCurve::addSwaps(const std::size_t index, const QuantLib::ext::shared_p
23942416
: *swapHelper->swap()->floatIndex()->forwardingTermStructure();
23952417
return getCashflowReportData(
23962418
{swapHelper->swap()->fixedLeg(), swapHelper->swap()->floatLeg()},
2397-
{false, true}, {1.0, 1.0}, currency_[index].code(),
2419+
{false, true}, {1.0E6, 1.0E6}, currency_[index].code(),
23982420
{currency_[index].code(), currency_[index].code()}, asofDate_,
23992421
{dsc, dsc}, {1.0, 1.0}, {}, {});
24002422
}}});
@@ -2411,7 +2433,7 @@ void YieldCurve::addSwaps(const std::size_t index, const QuantLib::ext::shared_p
24112433
: *swapHelper->swap()->iborIndex()->forwardingTermStructure();
24122434
return getCashflowReportData(
24132435
{swapHelper->swap()->fixedLeg(), swapHelper->swap()->floatingLeg()},
2414-
{false, true}, {1.0, 1.0}, currency_[index].code(),
2436+
{false, true}, {1.0E6, 1.0E6}, currency_[index].code(),
24152437
{currency_[index].code(), currency_[index].code()}, asofDate_,
24162438
{dsc, dsc}, {1.0, 1.0}, {}, {});
24172439
}}});
@@ -2504,7 +2526,7 @@ void YieldCurve::addAverageOISs(const std::size_t index, const QuantLib::ext::sh
25042526
return getCashflowReportData(
25052527
{helper->averageOIS()->fixedLeg(), helper->averageOIS()->overnightLeg(),
25062528
helper->spreadLeg()},
2507-
{false, true, true}, {1.0, 1.0, 1.0}, currency_[index].code(),
2529+
{false, true, true}, {1.0E6, 1.0E6, 1.0E6}, currency_[index].code(),
25082530
{currency_[index].code(), currency_[index].code(), currency_[index].code()}, asofDate_,
25092531
{dsc, dsc, dsc}, {1.0, 1.0, 1.0}, {}, {});
25102532
}}});
@@ -2601,7 +2623,7 @@ void YieldCurve::addTenorBasisSwaps(const std::size_t index,
26012623
auto dsc = *helper->discountHandle();
26022624
return getCashflowReportData(
26032625
{helper->swap()->recLeg(), helper->swap()->payLeg()}, {false, true},
2604-
{1.0, 1.0}, currency_[index].code(),
2626+
{1.0E6, 1.0E6}, currency_[index].code(),
26052627
{currency_[index].code(), currency_[index].code()}, asofDate_, {dsc, dsc},
26062628
{1.0, 1.0}, {}, {});
26072629
}}});
@@ -2698,7 +2720,7 @@ void YieldCurve::addTenorBasisTwoSwaps(const std::size_t index,
26982720
return getCashflowReportData(
26992721
{helper->longSwap()->fixedLeg(), helper->longSwap()->floatingLeg(),
27002722
helper->shortSwap()->fixedLeg(), helper->shortSwap()->floatingLeg()},
2701-
{false, true, true, false}, {1.0, 1.0, 1.0, 1.0}, currency_[index].code(),
2723+
{false, true, true, false}, {1.0E6, 1.0E6, 1.0E6, 1.0E6}, currency_[index].code(),
27022724
{currency_[index].code(), currency_[index].code(), currency_[index].code(),
27032725
currency_[index].code()},
27042726
asofDate_, {dsc, dsc, dsc, dsc}, {1.0, 1.0, 1.0, 1.0}, {}, {});
@@ -2768,7 +2790,7 @@ void YieldCurve::addBMABasisSwaps(const std::size_t index, const QuantLib::ext::
27682790
? *discountCurve_[index]
27692791
: *helper->swap()->bmaIndex()->forwardingTermStructure();
27702792
return getCashflowReportData({helper->swap()->indexLeg(), helper->swap()->bmaLeg()}, {false, true},
2771-
{1.0, 1.0}, currency_[index].code(),
2793+
{1.0E6, 1.0E6}, currency_[index].code(),
27722794
{currency_[index].code(), currency_[index].code()}, asofDate_,
27732795
{dsc, dsc}, {1.0, 1.0}, {}, {});
27742796
}}});
@@ -2997,7 +3019,7 @@ void YieldCurve::addFXForwards(const std::size_t index, const QuantLib::ext::sha
29973019
Leg domCf = {QuantLib::ext::make_shared<SimpleCashFlow>(
29983020
fxForwardHelper->impliedQuote() + spotFx->value(), fxForwardHelper->latestDate())};
29993021
return getCashflowReportData(
3000-
{forCf, domCf}, {false, true}, {1.0, 1.0}, fxSpotTargetCcy.code(),
3022+
{forCf, domCf}, {false, true}, {1.0E6, 1.0E6}, fxSpotTargetCcy.code(),
30013023
{fxSpotSourceCcy.code(), fxSpotTargetCcy.code()}, asofDate_, {forCurve, domCurve},
30023024
{spotFx->value() * domCurve->discount(fxForwardHelper->earliestDate()) /
30033025
forCurve->discount(fxForwardHelper->earliestDate()),
@@ -3194,8 +3216,8 @@ void YieldCurve::addCrossCcyBasisSwaps(const std::size_t index,
31943216
}
31953217
return getCashflowReportData(
31963218
{helper->swap()->leg(forLegIndex), helper->swap()->leg(domLegIndex)}, {false, true},
3197-
{1.0, 1.0}, fxSpotTargetCcy.code(), {fxSpotSourceCcy.code(), fxSpotTargetCcy.code()},
3198-
asofDate_, {forCurve, domCurve},
3219+
{1.0E6, 1.0E6}, fxSpotTargetCcy.code(),
3220+
{fxSpotSourceCcy.code(), fxSpotTargetCcy.code()}, asofDate_, {forCurve, domCurve},
31993221
{fxSpotQuote->quote()->value() * domCurve->discount(fxSpotSettlementDate) /
32003222
forCurve->discount(fxSpotSettlementDate),
32013223
1.0},
@@ -3252,7 +3274,7 @@ void YieldCurve::addCrossCcyBasisSwaps(const std::size_t index,
32523274
domCurve = domesticCurveGiven ? *domesticDiscount : bootstrappedCurve;
32533275
return getCashflowReportData(
32543276
{helper->swap()->leg(0), helper->swap()->leg(1), helper->swap()->leg(2)},
3255-
{false, true, true}, {1.0, 1.0, 1.0}, domesticIndex->currency().code(),
3277+
{false, true, true}, {1.0E6, 1.0E6, 1.0E6}, domesticIndex->currency().code(),
32563278
{foreignIndex->currency().code(), domesticIndex->currency().code(),
32573279
domesticIndex->currency().code()},
32583280
asofDate_, {forCurve, domCurve, domCurve},
@@ -3386,7 +3408,7 @@ void YieldCurve::addCrossCcyFixFloatSwaps(const std::size_t index,
33863408
forCurve = *floatLegDisc;
33873409
domCurve = bootstrappedCurve;
33883410
return getCashflowReportData(
3389-
{helper->swap()->leg(0), helper->swap()->leg(1)}, {true, false}, {1.0, 1.0},
3411+
{helper->swap()->leg(0), helper->swap()->leg(1)}, {true, false}, {1.0E6, 1.0E6},
33903412
fxSpotTargetCcy.code(), {fxSpotTargetCcy.code(), fxSpotSourceCcy.code()}, asofDate_,
33913413
{domCurve, forCurve},
33923414
{1.0, fxSpotQuote->value() * domCurve->discount(fxSpotSettlementDate) /
@@ -3417,7 +3439,7 @@ void YieldCurve::addCrossCcyFixFloatSwaps(const std::size_t index,
34173439
forCurve->discount(fxSpotSettlementDate);
34183440
return getCashflowReportData(
34193441
{helper->swap()->leg(0), helper->swap()->leg(1), helper->swap()->leg(2)},
3420-
{true, false, resetsOnFloatLeg}, {1.0, 1.0, 1.0}, fxSpotTargetCcy.code(),
3442+
{true, false, resetsOnFloatLeg}, {1.0E6, 1.0E6, 1.0E6}, fxSpotTargetCcy.code(),
34213443
{fxSpotSourceCcy.code(), fxSpotTargetCcy.code(),
34223444
resetsOnFloatLeg ? fxSpotSourceCcy.code() : fxSpotTargetCcy.code()},
34233445
asofDate_, {forCurve, domCurve, resetsOnFloatLeg ? forCurve : domCurve},

0 commit comments

Comments
 (0)