Skip to content

Commit 6f06507

Browse files
pcaspersjenkins
authored andcommitted
Merge remote-tracking branch 'origin/master'
2 parents 2b98a48 + 41fb46b commit 6f06507

3 files changed

Lines changed: 30 additions & 14 deletions

File tree

OREAnalytics/orea/app/analytic.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <orea/engine/valuationengine.hpp>
3030
#include <orea/aggregation/dimregressioncalculator.hpp>
3131

32+
#include <ored/marketdata/compositeloader.hpp>
3233
#include <ored/marketdata/todaysmarket.hpp>
3334
#include <ored/marketdata/bondspreadimply.hpp>
3435
#include <ored/portfolio/builders/currencyswap.hpp>
@@ -163,17 +164,21 @@ void Analytic::buildMarket(const boost::shared_ptr<ore::data::InMemoryLoader>& l
163164
// first build the market if we have a todaysMarketParams
164165
if (configurations().todaysMarketParams) {
165166
try {
166-
// Note: we usually update the loader with implied data, but we simply use the provided loader here
167-
loader_ = loader;
167+
// imply bond spreads (no exclusion of securities in ore, just in ore+) and add results to loader
168+
auto bondSpreads = implyBondSpreads(configurations().asofDate, inputs_, configurations_.todaysMarketParams,
169+
loader, configurations_.curveConfig, std::string());
170+
171+
// Join the loaders
172+
loader_ = boost::make_shared<CompositeLoader>(loader, bondSpreads);
173+
168174
// Check that the loader has quotes
169-
QL_REQUIRE( loader_->hasQuotes(inputs()->asof()),
170-
"There are no quotes available for date " << inputs()->asof());
175+
QL_REQUIRE(loader_->hasQuotes(configurations().asofDate),
176+
"There are no quotes available for date " << configurations().asofDate);
171177
// Build the market
172-
market_ = boost::make_shared<TodaysMarket>(inputs()->asof(), configurations().todaysMarketParams, loader_,
173-
configurations().curveConfig, inputs()->continueOnError(),
174-
true, inputs()->lazyMarketBuilding(), inputs()->refDataManager(),
175-
false, *inputs()->iborFallbackConfig());
176-
// Note: we usually wrap the market into a PC market, but skip this step here
178+
market_ = boost::make_shared<TodaysMarket>(
179+
configurations().asofDate, configurations().todaysMarketParams, loader_, configurations().curveConfig,
180+
inputs()->continueOnError(), true, inputs()->lazyMarketBuilding(), inputs()->refDataManager(), false,
181+
*inputs()->iborFallbackConfig());
177182
} catch (const std::exception& e) {
178183
if (marketRequired)
179184
QL_FAIL("Failed to build market: " << e.what());

OREData/ored/portfolio/builders/capfloorediborleg.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include <ored/portfolio/builders/capfloorediborleg.hpp>
20+
#include <ql/termstructures/volatility/optionlet/constantoptionletvol.hpp>
2021
#include <ored/utilities/log.hpp>
2122

2223
#include <boost/make_shared.hpp>
@@ -28,7 +29,13 @@ boost::shared_ptr<FloatingRateCouponPricer> CapFlooredIborLegEngineBuilder::engi
2829

2930
std::string ccyCode = parseIborIndex(index)->currency().code();
3031
Handle<YieldTermStructure> yts = market_->discountCurve(ccyCode, configuration(MarketContext::pricing));
31-
Handle<OptionletVolatilityStructure> ovs = market_->capFloorVol(index, configuration(MarketContext::pricing));
32+
Handle<OptionletVolatilityStructure> ovs;
33+
if (parseBool(engineParameter("ZeroVolatility", {}, false, "false"))) {
34+
ovs = Handle<OptionletVolatilityStructure>(boost::make_shared<ConstantOptionletVolatility>(
35+
0, NullCalendar(), Unadjusted, 0.0, Actual365Fixed(), Normal));
36+
} else {
37+
ovs = market_->capFloorVol(index, configuration(MarketContext::pricing));
38+
}
3239
BlackIborCouponPricer::TimingAdjustment timingAdjustment = BlackIborCouponPricer::Black76;
3340
boost::shared_ptr<SimpleQuote> correlation = boost::make_shared<SimpleQuote>(1.0);
3441
// for backwards compatibility we do not require the additional timing adjustment fields

OREData/ored/portfolio/makenonstandardlegs.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,15 @@ Leg makeNonStandardIborLeg(const boost::shared_ptr<IborIndex>& index, const std:
156156
for (auto const& d : calcDates)
157157
effCalcDates.insert(d);
158158

159-
for (auto const& d : resetDates)
160-
effCalcDates.insert(d);
159+
for (auto const& d : resetDates) {
160+
if (d >= calcDates.front() && d < calcDates.back())
161+
effCalcDates.insert(d);
162+
}
161163

162164
if (strictNotionalDates) {
163165
for (auto const& d : notionalDates) {
164-
effCalcDates.insert(d);
166+
if (d >= calcDates.front() && d < calcDates.back())
167+
effCalcDates.insert(d);
165168
}
166169
}
167170

@@ -279,7 +282,8 @@ Leg makeNonStandardFixedLeg(const std::vector<Date>& calcDates, const std::vecto
279282

280283
if (strictNotionalDates)
281284
for (auto const& d : notionalDates) {
282-
effCalcDates.insert(d);
285+
if (d >= calcDates.front() && d < calcDates.back())
286+
effCalcDates.insert(d);
283287
}
284288

285289
// build coupons

0 commit comments

Comments
 (0)