36 std::vector<bool> remainingAssets(numAssets,
true);
37 Real averagePrice = 0.0;
38 Size fixings = numNodes-1;
39 for (
Size i = 1; i < numNodes; i++) {
44 for (
Size j = 0; j < numAssets; j++) {
45 if (remainingAssets[j]) {
46 Real price = multiPath[j][i];
47 Real yield = price/multiPath[j].front();
48 if (yield >= bestYield) {
55 remainingAssets[removeAsset] =
false;
56 averagePrice += bestPrice;
58 averagePrice /= std::min(fixings, numAssets);
Real operator()(const MultiPath &multiPath) const override
HimalayaMultiPathPricer(ext::shared_ptr< Payoff > payoff, DiscountFactor discount)
Correlated multiple asset paths.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
const ext::shared_ptr< Payoff > payoff_
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
Monte Carlo engine for Himalaya options.