27 QuantLib::ext::shared_ptr<QuantExt::MultiPathGeneratorBase> pathGenerator,
28 QuantLib::ext::shared_ptr<ScenarioFactory> scenarioFactory,
29 QuantLib::ext::shared_ptr<ScenarioSimMarketParameters> simMarketConfig, Date today,
32 scenarioFactory_(scenarioFactory), simMarketConfig_(simMarketConfig) {
33 QL_REQUIRE(
timeGrid_.size() ==
dates_.size() + 1,
"date/time grid size mismatch");
37 std::vector<QuantLib::ext::shared_ptr<Scenario>> scenarios(
dates_.size());
40 DayCounter dc =
model_->parametrization()->termStructure()->dayCounter();
42 std::string ccy =
model_->parametrization()->currency().code();
43 vector<RiskFactorKey> keys;
47 for (Size i = 0; i <
dates_.size(); i++) {
55 Real z0 = sample.value[0][i + 1];
56 scenarios[i]->setNumeraire(
model_->numeraire(t, z0));
58 Real z = sample.value[0][i + 1];
61 Real T = dc.yearFraction(
dates_[i], d);
62 Real discount =
model_->discountBond(t, t + T, z);
63 scenarios[i]->add(keys[k], discount);
std::vector< QuantLib::ext::shared_ptr< Scenario > > nextPath() override
QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > simMarketConfig_
QuantLib::ext::shared_ptr< QuantExt::MultiPathGeneratorBase > pathGenerator_
LgmScenarioGenerator(QuantLib::ext::shared_ptr< QuantExt::LGM > model, QuantLib::ext::shared_ptr< QuantExt::MultiPathGeneratorBase > multiPathGenerator, QuantLib::ext::shared_ptr< ScenarioFactory > scenarioFactory, QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > simMarketConfig, Date today, DateGrid grid)
Constructor.
QuantLib::ext::shared_ptr< ScenarioFactory > scenarioFactory_
QuantLib::ext::shared_ptr< QuantExt::LGM > model_
Scenario generator that generates an entire path.
const QuantLib::ext::shared_ptr< ModelCG > model_
Scenario generation using LGM paths.
Size size(const ValueType &v)