QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
everestoption.cpp
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/everestoption.hpp>
21#include <ql/instruments/payoffs.hpp>
22
23namespace QuantLib {
24
26 Rate guarantee,
27 const ext::shared_ptr<Exercise>& exercise)
28 : MultiAssetOption(ext::shared_ptr<Payoff>(new NullPayoff), exercise),
29 notional_(notional), guarantee_(guarantee) {}
30
32 calculate();
33 QL_REQUIRE(yield_ != Null<Rate>(), "yield not provided");
34 return yield_;
35 }
36
39
40 auto* arguments = dynamic_cast<EverestOption::arguments*>(args);
41 QL_REQUIRE(arguments != nullptr, "wrong argument type");
42
45 }
46
49 const auto* results = dynamic_cast<const EverestOption::results*>(r);
50 QL_ENSURE(results != nullptr, "no results returned from pricing engine");
52 }
53
54
56 : notional(Null<Real>()), guarantee(Null<Rate>()) {}
57
59 MultiAssetOption::arguments::validate();
60 QL_REQUIRE(notional != Null<Rate>(), "no notional given");
61 QL_REQUIRE(notional != 0.0, "null notional given");
62 QL_REQUIRE(guarantee != Null<Rate>(), "no guarantee given");
63 }
64
65
68 yield = Null<Rate>();
69 }
70
71}
72
void setupArguments(PricingEngine::arguments *) const override
void fetchResults(const PricingEngine::results *) const override
EverestOption(Real notional, Rate guarantee, const ext::shared_ptr< Exercise > &)
void calculate() const override
Definition: instrument.hpp:129
Base class for options on multiple assets.
void setupArguments(PricingEngine::arguments *) const override
void fetchResults(const PricingEngine::results *) const override
template class providing a null value for a given type.
Definition: null.hpp:76
Dummy payoff class.
Definition: payoffs.hpp:36
Abstract base class for option payoffs.
Definition: payoff.hpp:36
QL_REAL Real
real number
Definition: types.hpp:50
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35