Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
analyticcclgmfxoptionengine.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file analyticcclgmfxoptionengine.hpp
20 \brief analytic cc lgm fx option engine
21
22 \ingroup engines
23*/
24
25#ifndef quantext_cclgm_fxoptionengine_hpp
26#define quantext_cclgm_fxoptionengine_hpp
27
28#include <ql/instruments/vanillaoption.hpp>
30
31namespace QuantExt {
32
33//! Analytic cc lgm fx option engine
34/*! \ingroup engines
35 */
36class AnalyticCcLgmFxOptionEngine : public VanillaOption::engine {
37public:
38 AnalyticCcLgmFxOptionEngine(const QuantLib::ext::shared_ptr<CrossAssetModel>& model, const Size foreignCurrency);
39 void calculate() const override;
40
41 /*! if cache is enabled, the integrals independent of fx
42 volatility are cached, which can speed up calibration;
43 remember to flush the cache when the ir parameters
44 change, this can be done by another call to cache */
45 void cache(bool enable = true);
46
47 /*! the actual option price calculation, exposed to public,
48 since it is useful to directly use the core computation
49 sometimes */
50 Real value(const Time t0, const Time t, const QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff,
51 const Real domesticDiscount, const Real fxForward) const;
52
53private:
54 const QuantLib::ext::shared_ptr<CrossAssetModel> model_;
55 const Size foreignCurrency_;
57 mutable bool cacheDirty_;
59};
60
61// inline
62
63inline void AnalyticCcLgmFxOptionEngine::cache(bool enable) {
64 cacheEnabled_ = enable;
65 cacheDirty_ = true;
66}
67
68} // namespace QuantExt
69
70#endif
Real value(const Time t0, const Time t, const QuantLib::ext::shared_ptr< StrikedTypePayoff > payoff, const Real domesticDiscount, const Real fxForward) const
const QuantLib::ext::shared_ptr< CrossAssetModel > model_
cross asset model