Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
bondbasket.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 portfolio/bondbasket.hpp
20 \brief credit bond basket data model and serialization
21 \ingroup portfolio
22*/
23
24#pragma once
25
27
33
34#include <vector>
35
36namespace ore {
37namespace data {
38using namespace QuantLib;
40using std::string;
41using std::vector;
42
43//! Serializable Bond-Basket Data
44/*!
45 \ingroup tradedata
46*/
47
49public:
50 //! Default constructor
52
53 //! \name Serialisation
54 //@{
55 virtual void fromXML(XMLNode* node) override;
56 virtual XMLNode* toXML(ore::data::XMLDocument& doc) const override;
57
58 //! Add underlying Bond names
59 std::map<AssetClass, std::set<std::string>>
60 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr) const;
61
62 bool empty() { return bonds_.empty(); }
63 void clear();
64
65 QuantLib::ext::shared_ptr<QuantExt::BondBasket> build(const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
66 const QuantLib::Currency& ccy,
67 const std::string& reinvestmentEndDate);
68 //@}
69
70 const std::vector<QuantLib::ext::shared_ptr<Bond>>& bonds() const { return bonds_; }
71
73private:
74
75 bool isFeeFlow(const ext::shared_ptr<QuantLib::CashFlow>& cf, const std::string& name);
76 void setReinvestmentScalar();
77
78 vector<QuantLib::ext::shared_ptr<Bond>> bonds_;
79 std::map <string, QuantLib::ext::shared_ptr<QuantExt::FxIndex>> fxIndexMap_;
81 QuantLib::Date reinvestment_;
82 std::map<std::string, std::vector<double> > reinvestmentScalar_;
83 std::map<std::string, std::vector<std::string> > flowType_;
84
85};
86} // namespace data
87} // namespace ore
Bond trade data model and serialization.
std::map< std::string, std::vector< std::string > > flowType_
Definition: bondbasket.hpp:83
std::map< std::string, std::vector< double > > reinvestmentScalar_
Definition: bondbasket.hpp:82
const RequiredFixings & requiredFixings() const
Definition: bondbasket.hpp:72
std::map< string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > fxIndexMap_
Definition: bondbasket.hpp:79
RequiredFixings requiredFixings_
Definition: bondbasket.hpp:80
QuantLib::Date reinvestment_
Definition: bondbasket.hpp:81
vector< QuantLib::ext::shared_ptr< Bond > > bonds_
Definition: bondbasket.hpp:78
const std::vector< QuantLib::ext::shared_ptr< Bond > > & bonds() const
Definition: bondbasket.hpp:70
BondBasket()
Default constructor.
Definition: bondbasket.hpp:51
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
Pricing Engine Factory.
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Map text representations to QuantLib/QuantExt types.
trade schedule data model and serialization
string name
base trade data model and serialization