Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fxeuropeanbarrieroption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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 ored/portfolio/fxeuropeanbarrieroption.hpp
20 \brief FX European Barrier Option data model and serialization
21 \ingroup portfolio
22*/
23
24#pragma once
25
29#include <ql/instruments/barriertype.hpp>
30
31namespace ore {
32namespace data {
33using std::string;
34
35//! Serializable FX European Barrier Option
36/*!
37 \ingroup tradedata
38*/
40public:
41 //! Default constructor
43 : ore::data::Trade("FxEuropeanBarrierOption"), FxSingleAssetDerivative("FxEuropeanBarrierOption"),
44 boughtAmount_(0.0), soldAmount_(0.0) {}
45 //! Constructor
47 double boughtAmount, string soldCurrency, double soldAmount, string startDate = "",
48 string calendar = "", string fxIndex = "")
49 : ore::data::Trade("FxEuropeanBarrierOption", env),
50 FxSingleAssetDerivative("FxEuropeanBarrierOption", env, boughtCurrency, soldCurrency), option_(option),
52
53 //! Build QuantLib/QuantExt instrument, link pricing engine
54 void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
55
56 //! \name Inspectors
57 //@{
58 const OptionData& option() const { return option_; }
59 const BarrierData& barrier() const { return barrier_; }
60 double boughtAmount() const { return boughtAmount_; }
61 double soldAmount() const { return soldAmount_; }
62 const std::string& fxIndex() const { return fxIndex_; }
63 Real strike() const;
64 //@}
65
66 //! \name Serialisation
67 //@{
68 virtual void fromXML(XMLNode* node) override;
69 virtual XMLNode* toXML(XMLDocument& doc) const override;
70 //@}
71private:
72 bool checkBarrier(Real spot, Barrier::Type type, Real level);
77 //! If the option has automatic exercise (i.e. cash settled after maturity), need an FX index for settlement.
78 std::string fxIndex_;
79};
80} // namespace data
81} // namespace oreplus
Serializable obejct holding barrier data.
Definition: barrierdata.hpp:34
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable FX European Barrier Option.
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
bool checkBarrier(Real spot, Barrier::Type type, Real level)
std::string fxIndex_
If the option has automatic exercise (i.e. cash settled after maturity), need an FX index for settlem...
FxEuropeanBarrierOption(Envelope &env, OptionData option, BarrierData barrier, string boughtCurrency, double boughtAmount, string soldCurrency, double soldAmount, string startDate="", string calendar="", string fxIndex="")
Constructor.
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Build QuantLib/QuantExt instrument, link pricing engine.
Base class for all single asset FX Derivaties.
const std::string & soldCurrency() const
const std::string & boughtCurrency() const
Serializable object holding option data.
Definition: optiondata.hpp:42
Trade base class.
Definition: trade.hpp:55
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
FX base trade classes.
@ data
Definition: log.hpp:77
Calendar calendar
Definition: utilities.cpp:441
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade option data model and serialization