/src/quantlib/ql/experimental/exoticoptions/himalayaoption.cpp
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 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 | | <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 | | #include <ql/experimental/exoticoptions/himalayaoption.hpp> |
21 | | #include <ql/instruments/payoffs.hpp> |
22 | | #include <ql/exercise.hpp> |
23 | | |
24 | | namespace QuantLib { |
25 | | |
26 | | HimalayaOption::HimalayaOption(const std::vector<Date>& fixingDates, |
27 | | Real strike) |
28 | 0 | : MultiAssetOption(ext::shared_ptr<Payoff>( |
29 | 0 | new PlainVanillaPayoff(Option::Call, strike)), |
30 | 0 | ext::shared_ptr<Exercise>( |
31 | 0 | new EuropeanExercise(fixingDates.back()))), |
32 | 0 | fixingDates_(fixingDates) {} Unexecuted instantiation: QuantLib::HimalayaOption::HimalayaOption(std::__1::vector<QuantLib::Date, std::__1::allocator<QuantLib::Date> > const&, double) Unexecuted instantiation: QuantLib::HimalayaOption::HimalayaOption(std::__1::vector<QuantLib::Date, std::__1::allocator<QuantLib::Date> > const&, double) |
33 | | |
34 | 0 | void HimalayaOption::setupArguments(PricingEngine::arguments* args) const { |
35 | 0 | MultiAssetOption::setupArguments(args); |
36 | |
|
37 | 0 | auto* arguments = dynamic_cast<HimalayaOption::arguments*>(args); |
38 | 0 | QL_REQUIRE(arguments != nullptr, "wrong argument type"); |
39 | | |
40 | 0 | arguments->fixingDates = fixingDates_; |
41 | 0 | } |
42 | | |
43 | 0 | void HimalayaOption::arguments::validate() const { |
44 | 0 | MultiAssetOption::arguments::validate(); |
45 | 0 | QL_REQUIRE(!fixingDates.empty(), "no fixing dates given"); |
46 | 0 | } |
47 | | |
48 | | } |
49 | | |