QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
pagodaoption.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 PagodaOption::PagodaOption(const std::vector<Date>& fixingDates,
27 Real roof,
28 Real fraction)
29 : MultiAssetOption(ext::shared_ptr<Payoff>(new NullPayoff),
30 ext::shared_ptr<Exercise>(
31 new EuropeanExercise(fixingDates.back()))),
32 fixingDates_(fixingDates), roof_(roof), fraction_(fraction) {}
33
34
37
38 auto* arguments = dynamic_cast<PagodaOption::arguments*>(args);
39 QL_REQUIRE(arguments != nullptr, "wrong argument type");
40
44 }
45
46
48 : roof(Null<Real>()), fraction(Null<Real>()) {}
49
51 MultiAssetOption::arguments::validate();
52 QL_REQUIRE(!fixingDates.empty(), "no fixingDates given");
53 QL_REQUIRE(roof != Null<Real>(), "no roof given");
54 QL_REQUIRE(fraction != Null<Real>(), "no fraction given");
55 }
56
57}
European exercise.
Definition: exercise.hpp:96
Base exercise class.
Definition: exercise.hpp:35
Base class for options on multiple assets.
void setupArguments(PricingEngine::arguments *) const override
template class providing a null value for a given type.
Definition: null.hpp:76
Dummy payoff class.
Definition: payoffs.hpp:36
void validate() const override
void setupArguments(PricingEngine::arguments *) const override
std::vector< Date > fixingDates_
PagodaOption(const std::vector< Date > &fixingDates, Real roof, Real fraction)
Abstract base class for option payoffs.
Definition: payoff.hpp:36
#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
Definition: any.hpp:35
Roofed Asian option on a number of assets.
Payoffs for various options.