Coverage Report

Created: 2025-08-11 06:28

/src/quantlib/ql/experimental/mcbasket/pathmultiassetoption.hpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2008 Andrea Odetti
5
6
 This file is part of QuantLib, a free-software/open-source library
7
 for financial quantitative analysts and developers - http://quantlib.org/
8
9
 QuantLib is free software: you can redistribute it and/or modify it
10
 under the terms of the QuantLib license.  You should have received a
11
 copy of the license along with this program; if not, please email
12
 <quantlib-dev@lists.sf.net>. The license is also available online at
13
 <http://quantlib.org/license.shtml>.
14
15
 This program is distributed in the hope that it will be useful, but WITHOUT
16
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17
 FOR A PARTICULAR PURPOSE.  See the license for more details.
18
*/
19
20
/*! \file pathmultiassetoption.hpp
21
    \brief Option on multiple assets
22
*/
23
24
#ifndef quantlib_path_multiasset_option_hpp
25
#define quantlib_path_multiasset_option_hpp
26
27
#include <ql/instrument.hpp>
28
#include <ql/stochasticprocess.hpp>
29
#include <ql/math/matrix.hpp>
30
#include <ql/experimental/mcbasket/pathpayoff.hpp>
31
32
namespace QuantLib {
33
34
    //! Base class for path-dependent options on multiple assets
35
    class PathMultiAssetOption : public Instrument {
36
      public:
37
        explicit PathMultiAssetOption(
38
                        const ext::shared_ptr<PricingEngine>& engine
39
                                        = ext::shared_ptr<PricingEngine>());
40
41
        //! \name Instrument interface
42
        //@{
43
        class arguments;
44
        class results;
45
        class engine;
46
47
        bool isExpired() const override;
48
49
        void setupArguments(PricingEngine::arguments*) const override;
50
51
        virtual ext::shared_ptr<PathPayoff> pathPayoff()  const = 0;
52
        virtual std::vector<Date>             fixingDates() const = 0;
53
54
      protected:
55
        void setupExpired() const override;
56
    };
57
58
    //! %Arguments for multi-asset option calculation
59
    class PathMultiAssetOption::arguments
60
        : public virtual PricingEngine::arguments {
61
      public:
62
        arguments() = default;
63
        void validate() const override;
64
65
        ext::shared_ptr<PathPayoff>        payoff;
66
        std::vector<Date>                    fixingDates;
67
    };
68
69
    //! %Results from multi-asset option calculation
70
    class PathMultiAssetOption::results : public Instrument::results {
71
      public:
72
0
        void reset() override { Instrument::results::reset(); }
73
    };
74
75
    class PathMultiAssetOption::engine
76
        : public GenericEngine<PathMultiAssetOption::arguments,
77
                               PathMultiAssetOption::results> {};
78
79
}
80
81
82
#endif