Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
npvrecord.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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 orea/engine/npvrecord.hpp
20 \brief Struct for holding an NPV record
21*/
22
23#pragma once
24
25#include <ql/types.hpp>
26#include <ql/time/date.hpp>
27
28#include <boost/multi_index_container.hpp>
29#include <boost/multi_index/ordered_index.hpp>
30#include <boost/multi_index/identity.hpp>
31#include <boost/multi_index/member.hpp>
32#include <boost/multi_index/composite_key.hpp>
33
34#include <string>
35
36namespace ore {
37namespace analytics {
38
39/*! A container for holding single NPV record or aggregated NPV records.
40*/
41struct NpvRecord {
42 std::string tradeId;
43 std::string portfolioId;
44 std::string baseCurrency;
45 QuantLib::Real baseAmount;
46 QuantLib::Date valuationDate;
47
48 //! Define how CRIF records are compared
49 bool operator<(const NpvRecord& nr) const {
50 return std::tie(tradeId, portfolioId, valuationDate, baseCurrency) <
51 std::tie(nr.tradeId, nr.portfolioId, nr.valuationDate, nr.baseCurrency);
52 }
53 bool operator==(const NpvRecord& nr) const {
54 return std::tie(tradeId, portfolioId, valuationDate, baseCurrency) ==
55 std::tie(nr.tradeId, nr.portfolioId, nr.valuationDate, nr.baseCurrency);
56 }
57};
58
59//! Enable writing of a NpvRecord
60std::ostream& operator<<(std::ostream& out, const NpvRecord& nr);
61
62
63}
64}
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
QuantLib::Date valuationDate
Definition: npvrecord.hpp:46
QuantLib::Real baseAmount
Definition: npvrecord.hpp:45
bool operator==(const NpvRecord &nr) const
Definition: npvrecord.hpp:53
bool operator<(const NpvRecord &nr) const
Define how CRIF records are compared.
Definition: npvrecord.hpp:49