Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fxderivative.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 ORE is free software: you can redistribute it and/or modify it
8 under the terms of the Modified BSD License. You should have received a
9 copy of the license along with this program.
10 The license is also available online at <http://opensourcerisk.org>
11 This program is distributed on the basis that it will form a useful
12 contribution to risk analytics and model standardisation, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
15*/
16
17/*! \file ored/portfolio/fxderivative.hpp
18 \brief FX base trade classes
19 \ingroup portfolio
20*/
21
22#pragma once
23
25
26namespace ore {
27namespace data {
28
29//! Base class for all FX Derivaties
30class FxDerivative : virtual public ore::data::Trade {
31protected:
32 FxDerivative(const std::string& tradeType) : ore::data::Trade(tradeType) {}
33
34 FxDerivative(const std::string& tradeType, ore::data::Envelope& env) : ore::data::Trade(tradeType, env) {}
35};
36
37//! Base class for all single asset FX Derivaties
39protected:
41
42 FxSingleAssetDerivative(const std::string& tradeType, ore::data::Envelope& env, const std::string& boughtCurrency,
43 const std::string& soldCurrency)
46
47 // Protected members
48 std::string boughtCurrency_;
49 std::string soldCurrency_;
50
51 // ... and references for FOR/DOM based trades
52 // This is a bit dangerous, if any subclass mixed For-Dom with Bought-Sold it will get messed up!
53 // The alternative is to declare 4 strings, all separate and have checks down every time a getter
54 // is called below and importantly in the dtor of this class, i.e. check that one and only one pair
55 // has been initialised here.
58
59public:
60 const std::string& boughtCurrency() const { return boughtCurrency_; }
61 const std::string& soldCurrency() const { return soldCurrency_; }
62 const std::string& foreignCurrency() const { return foreignCurrency_; }
63 const std::string& domesticCurrency() const { return domesticCurrency_; }
64};
65
66} // namespace data
67} // namespace oreplus
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Base class for all FX Derivaties.
FxDerivative(const std::string &tradeType)
FxDerivative(const std::string &tradeType, ore::data::Envelope &env)
Base class for all single asset FX Derivaties.
FxSingleAssetDerivative(const std::string &tradeType, ore::data::Envelope &env, const std::string &boughtCurrency, const std::string &soldCurrency)
const std::string & domesticCurrency() const
const std::string & foreignCurrency() const
FxSingleAssetDerivative(const std::string &tradeType)
const std::string & soldCurrency() const
const std::string & boughtCurrency() const
Trade base class.
Definition: trade.hpp:55
const string & tradeType() const
Definition: trade.hpp:133
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
base trade data model and serialization