QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
margrabeoption.hpp
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) 2010 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/*! \file margrabeoption.hpp
21 \brief Margrabe option on two assets
22*/
23
24#ifndef quantlib_margrabe_option_hpp
25#define quantlib_margrabe_option_hpp
26
28
29namespace QuantLib {
30
31 //! Margrabe option on two assets
32 /*! This option gives the holder the right to exchange Q2 stocks
33 of the second asset for Q1 stocks of the first at expiration.
34
35 \ingroup instruments
36 */
38 public:
39 class arguments;
40 class results;
41 class engine;
43 Integer Q2,
44 const ext::shared_ptr<Exercise>&);
45 void setupArguments(PricingEngine::arguments*) const override;
46 Real delta1() const;
47 Real delta2() const;
48 Real gamma1() const;
49 Real gamma2() const;
50 void fetchResults(const PricingEngine::results*) const override;
51
52 protected:
56 };
57
58 //! Extra %arguments for Margrabe option
59 class MargrabeOption::arguments : public MultiAssetOption::arguments {
60 public:
61 arguments() = default;
62 void validate() const override;
65 };
66
67 //! Extra %results for Margrabe option
69 public:
70 results() = default;
75 void reset() override {
81 }
82 };
83
84 //! %Margrabe option %engine base class
85 class MargrabeOption::engine : public GenericEngine<MargrabeOption::arguments,
86 MargrabeOption::results> {};
87}
88
89
90#endif
template base class for option pricing engines
Extra arguments for Margrabe option.
Margrabe option engine base class
Extra results for Margrabe option.
Margrabe option on two assets.
void setupArguments(PricingEngine::arguments *) const override
void fetchResults(const PricingEngine::results *) const override
Results from multi-asset option calculation
Base class for options on multiple assets.
template class providing a null value for a given type.
Definition: null.hpp:76
QL_REAL Real
real number
Definition: types.hpp:50
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Option on multiple assets.
Definition: any.hpp:35