QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
himalayaoption.cpp
Go to the documentation of this file.
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
22#include <ql/exercise.hpp>
23
24namespace QuantLib {
25
26 HimalayaOption::HimalayaOption(const std::vector<Date>& fixingDates,
27 Real strike)
28 : MultiAssetOption(ext::shared_ptr<Payoff>(
29 new PlainVanillaPayoff(Option::Call, strike)),
30 ext::shared_ptr<Exercise>(
31 new EuropeanExercise(fixingDates.back()))),
32 fixingDates_(fixingDates) {}
33
36
37 auto* arguments = dynamic_cast<HimalayaOption::arguments*>(args);
38 QL_REQUIRE(arguments != nullptr, "wrong argument type");
39
41 }
42
44 MultiAssetOption::arguments::validate();
45 QL_REQUIRE(!fixingDates.empty(), "no fixing dates given");
46 }
47
48}
49
European exercise.
Definition: exercise.hpp:96
Base exercise class.
Definition: exercise.hpp:35
void setupArguments(PricingEngine::arguments *) const override
std::vector< Date > fixingDates_
HimalayaOption(const std::vector< Date > &fixingDates, Real strike)
Base class for options on multiple assets.
void setupArguments(PricingEngine::arguments *) const override
base option class
Definition: option.hpp:36
Abstract base class for option payoffs.
Definition: payoff.hpp:36
Plain-vanilla payoff.
Definition: payoffs.hpp:105
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Definition: errors.hpp:117
Option exercise classes and payoff function.
QL_REAL Real
real number
Definition: types.hpp:50
Himalaya option on a number of assets.
Definition: any.hpp:35
Payoffs for various options.