20#include <ql/experimental/exoticoptions/mchimalayaengine.hpp>
21#include <ql/payoff.hpp>
28 : payoff_(
std::move(payoff)), discount_(discount) {}
34 QL_REQUIRE(numAssets > 0,
"no asset given");
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);
60 Real payoff = (*payoff_)(averagePrice);
Real operator()(const MultiPath &multiPath) const override
HimalayaMultiPathPricer(ext::shared_ptr< Payoff > payoff, DiscountFactor discount)
Correlated multiple asset paths.
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container