Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
compositeinstrumentwrapper.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/compositeinstrumentwrapper.hpp
20 \brief used to store multiple trade wrappers
21 \ingroup tradedata
22*/
23
24#pragma once
25
27
28#include <ql/handle.hpp>
29#include <ql/instrument.hpp>
30#include <ql/quote.hpp>
31#include <ql/settings.hpp>
32#include <ql/time/date.hpp>
33#include <ql/types.hpp>
34
35#include <vector>
36
37namespace ore {
38namespace data {
39
40using QuantLib::Date;
41using QuantLib::Handle;
42using QuantLib::Quote;
43using QuantLib::Real;
44using QuantLib::Settings;
45using QuantLib::Size;
46
47//! Composite Instrument Wrapper
48/*! A Composite Instrument Wrapper will return the sum npv for all wrappers passed in.
49 Notice that qlInstrument() will return a nullptr.
50 \ingroup tradedata
51*/
53public:
54 CompositeInstrumentWrapper(const std::vector<QuantLib::ext::shared_ptr<InstrumentWrapper>>& wrappers,
55 const std::vector<Handle<Quote>>& fxRates = {}, const Date& valuationDate = Date());
56
57 void initialise(const std::vector<QuantLib::Date>& dates) override;
58 void reset() override;
59 QuantLib::Real NPV() const override;
60 const std::map<std::string, boost::any>& additionalResults() const override;
61 void updateQlInstruments() override;
62 bool isOption() override;
63
64protected:
66 std::vector<QuantLib::ext::shared_ptr<InstrumentWrapper>> wrappers_;
67 std::vector<QuantLib::Handle<Quote>> fxRates_;
69 mutable std::map<std::string, boost::any> additionalResults_;
70};
71
72} // namespace data
73} // namespace ore
QuantLib::Real NPV() const override
Return the NPV of this instrument.
std::map< std::string, boost::any > additionalResults_
const std::map< std::string, boost::any > & additionalResults() const override
Return the additional results of this instrument.
void updateQlInstruments() override
call update on enclosed instrument(s)
std::vector< QuantLib::Handle< Quote > > fxRates_
void initialise(const std::vector< QuantLib::Date > &dates) override
Initialise with the given date grid.
std::vector< QuantLib::ext::shared_ptr< InstrumentWrapper > > wrappers_
void reset() override
reset is called every time a new path is about to be priced.
Base class for wrapper of QL instrument, used to store "state" of trade under each scenario.
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23