/src/quantlib/ql/experimental/exoticoptions/pagodaoption.cpp
Line | Count | Source |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2008 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis |
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 | | <https://www.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 | | #include <ql/experimental/exoticoptions/pagodaoption.hpp> |
21 | | #include <ql/instruments/payoffs.hpp> |
22 | | #include <ql/exercise.hpp> |
23 | | |
24 | | namespace QuantLib { |
25 | | |
26 | | PagodaOption::PagodaOption(const std::vector<Date>& fixingDates, |
27 | | Real roof, |
28 | | Real fraction) |
29 | 0 | : MultiAssetOption(ext::shared_ptr<Payoff>(new NullPayoff), |
30 | 0 | ext::shared_ptr<Exercise>( |
31 | 0 | new EuropeanExercise(fixingDates.back()))), |
32 | 0 | fixingDates_(fixingDates), roof_(roof), fraction_(fraction) {}Unexecuted instantiation: QuantLib::PagodaOption::PagodaOption(std::__1::vector<QuantLib::Date, std::__1::allocator<QuantLib::Date> > const&, double, double) Unexecuted instantiation: QuantLib::PagodaOption::PagodaOption(std::__1::vector<QuantLib::Date, std::__1::allocator<QuantLib::Date> > const&, double, double) |
33 | | |
34 | | |
35 | 0 | void PagodaOption::setupArguments(PricingEngine::arguments* args) const { |
36 | 0 | MultiAssetOption::setupArguments(args); |
37 | |
|
38 | 0 | auto* arguments = dynamic_cast<PagodaOption::arguments*>(args); |
39 | 0 | QL_REQUIRE(arguments != nullptr, "wrong argument type"); |
40 | | |
41 | 0 | arguments->fixingDates = fixingDates_; |
42 | 0 | arguments->roof = roof_; |
43 | 0 | arguments->fraction = fraction_; |
44 | 0 | } |
45 | | |
46 | | |
47 | | PagodaOption::arguments::arguments() |
48 | 0 | : roof(Null<Real>()), fraction(Null<Real>()) {}Unexecuted instantiation: QuantLib::PagodaOption::arguments::arguments() Unexecuted instantiation: QuantLib::PagodaOption::arguments::arguments() |
49 | | |
50 | 0 | void PagodaOption::arguments::validate() const { |
51 | 0 | MultiAssetOption::arguments::validate(); |
52 | 0 | QL_REQUIRE(!fixingDates.empty(), "no fixingDates given"); |
53 | 0 | QL_REQUIRE(roof != Null<Real>(), "no roof given"); |
54 | 0 | QL_REQUIRE(fraction != Null<Real>(), "no fraction given"); |
55 | 0 | } |
56 | | |
57 | | } |