Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fxoption.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 portfolio/fxoption.hpp
20 \brief FX Option data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
27
29
30namespace ore {
31namespace data {
32using std::string;
33
34//! Serializable FX Option
35/*!
36 \ingroup tradedata
37*/
39public:
40 //! Default constructor
42 //! Constructor
43 FxOption(const Envelope& env, const OptionData& option, const string& boughtCurrency, double boughtAmount,
44 const string& soldCurrency, double soldAmount, const std::string& fxIndex = "")
48 tradeType_ = "FxOption";
49 }
50
51 //! Build QuantLib/QuantExt instrument, link pricing engine
52 void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
53
54 //! \name Inspectors
55 //@{
56 const string& boughtCurrency() const { return assetName_; }
57 double boughtAmount() const { return quantity_; }
58 const string& soldCurrency() const { return currency_; }
59 double soldAmount() const { return strike_.value() * quantity_; }
60 const std::string& fxIndex() const { return fxIndex_; }
61 //@}
62
63 //! \name Serialisation
64 //@{
65 virtual void fromXML(XMLNode* node) override;
66 virtual XMLNode* toXML(XMLDocument& doc) const override;
67 //@}
68
69private:
70 //! If the option has automatic exercise, need an FX index for settlement.
71 std::string fxIndex_;
72};
73} // namespace data
74} // namespace ore
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable FX Option.
Definition: fxoption.hpp:38
double soldAmount() const
Definition: fxoption.hpp:59
const string & soldCurrency() const
Definition: fxoption.hpp:58
virtual void fromXML(XMLNode *node) override
Definition: fxoption.cpp:128
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: fxoption.cpp:144
FxOption(const Envelope &env, const OptionData &option, const string &boughtCurrency, double boughtAmount, const string &soldCurrency, double soldAmount, const std::string &fxIndex="")
Constructor.
Definition: fxoption.hpp:43
std::string fxIndex_
If the option has automatic exercise, need an FX index for settlement.
Definition: fxoption.hpp:71
const string & boughtCurrency() const
Definition: fxoption.hpp:56
FxOption()
Default constructor.
Definition: fxoption.hpp:41
const std::string & fxIndex() const
Definition: fxoption.hpp:60
double boughtAmount() const
Definition: fxoption.hpp:57
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Build QuantLib/QuantExt instrument, link pricing engine.
Definition: fxoption.cpp:41
Serializable object holding option data.
Definition: optiondata.hpp:42
string tradeType_
Definition: trade.hpp:196
QuantLib::Real value() const
Serializable Vanilla Option.
const OptionData & option() const
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Trade Factory.
vanilla option representation