Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
tradeactions.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 ored/portfolio/envelope.hpp
20 \brief trade envelope data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
28
29#include <vector>
30
31namespace ore {
32namespace data {
35using std::string;
36using std::vector;
37
38//! Serializable object holding a trade action
39/*!
40 \ingroup tradedata
41*/
43public:
44 //! Default constructor
46
47 //! Constructor
48 TradeAction(const string& type, const string& owner, const ScheduleData& schedule)
50
51 //! \name Inspectors
52 //@{
53 const string& type() const { return type_; }
54 const string& owner() const { return owner_; }
55 const ScheduleData& schedule() const { return schedule_; }
56 //@}
57
58 //! \name Serialisation
59 //@{
60 virtual void fromXML(XMLNode* node) override;
61 virtual XMLNode* toXML(XMLDocument& doc) const override;
62 //@}
63
64private:
65 string type_;
66 string owner_;
68};
69
70//! Serializable object holding generic trade actions
72public:
73 TradeActions(const vector<TradeAction>& actions = vector<TradeAction>()) : actions_(actions) {}
74
75 void addAction(const TradeAction& action) { actions_.push_back(action); }
76
77 const vector<TradeAction>& actions() const { return actions_; }
78
79 //! Returns true of this set of actions is empty
80 bool empty() const { return actions_.size() == 0; }
81
82 //! Clear the trade actions
83 void clear() { actions_.clear(); }
84
85 virtual void fromXML(XMLNode* node) override;
86 virtual XMLNode* toXML(XMLDocument& doc) const override;
87
88private:
89 vector<TradeAction> actions_;
90};
91} // namespace data
92} // namespace ore
Serializable schedule data.
Definition: schedule.hpp:202
Serializable object holding a trade action.
const ScheduleData & schedule() const
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
TradeAction(const string &type, const string &owner, const ScheduleData &schedule)
Constructor.
const string & type() const
const string & owner() const
TradeAction()
Default constructor.
Serializable object holding generic trade actions.
bool empty() const
Returns true of this set of actions is empty.
virtual void fromXML(XMLNode *node) override
vector< TradeAction > actions_
virtual XMLNode * toXML(XMLDocument &doc) const override
void addAction(const TradeAction &action)
void clear()
Clear the trade actions.
TradeActions(const vector< TradeAction > &actions=vector< TradeAction >())
const vector< TradeAction > & actions() const
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade schedule data model and serialization
XML utility functions.