Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
bondtotalreturnswap.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#pragma once
20
23
24#include <ql/handle.hpp>
25#include <ql/instrument.hpp>
26#include <ql/instruments/bond.hpp>
27#include <ql/interestrate.hpp>
28#include <ql/position.hpp>
29#include <ql/termstructures/yieldtermstructure.hpp>
30#include <ql/time/daycounter.hpp>
31#include <ql/types.hpp>
32
33namespace QuantExt {
34using namespace QuantLib;
35
36//! Bond TRS class
37class BondTRS : public Instrument {
38public:
39 class arguments;
40 using engine = GenericEngine<BondTRS::arguments, BondTRS::results>;
42 //! Constructor
43 BondTRS(const QuantLib::ext::shared_ptr<QuantExt::BondIndex>& bondIndex, const Real bondNotional, const Real initialPrice,
44 const std::vector<Leg>& fundingLeg, const bool payTotalReturnLeg, const std::vector<Date>& valuationDates,
45 const std::vector<Date>& paymentDates, const QuantLib::ext::shared_ptr<QuantExt::FxIndex>& fxIndex = nullptr,
46 bool payBondCashFlowsImmediately = false, const Currency& fundingCurrency = Currency(),
47 const Currency& bondCurrency = Currency());
48
49 //! \name Instrument interface
50 //@{
51 bool isExpired() const override;
52 void setupArguments(PricingEngine::arguments*) const override;
53 //@}
54
55 //! \name Inspectors
56 //@{
57 const QuantLib::ext::shared_ptr<QuantExt::BondIndex>& bondIndex() const { return bondIndex_; }
58 const QuantLib::ext::shared_ptr<QuantExt::FxIndex>& fxIndex() const { return fxIndex_; }
59 Real bondNotional() const { return bondNotional_; }
60 const std::vector<Leg>& fundingLeg() const { return fundingLeg_; }
61 Real initialPrice() const { return initialPrice_; }
62 bool payTotalReturnLeg() const { return payTotalReturnLeg_; }
63 const Leg& returnLeg() const { return returnLeg_; }
65 const std::vector<Date>& valuationDates() const { return valuationDates_; }
66 const std::vector<Date>& paymentDates() const { return paymentDates_; }
67 //@}
68
69private:
70 QuantLib::ext::shared_ptr<QuantExt::BondIndex> bondIndex_;
73 std::vector<Leg> fundingLeg_;
75 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex_;
78 std::vector<Date> valuationDates_;
79 std::vector<Date> paymentDates_;
80 //
82};
83
84//! \ingroup instruments
86public:
87 QuantLib::ext::shared_ptr<QuantExt::BondIndex> bondIndex;
88 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex;
90 std::vector<Leg> fundingLeg;
95 void validate() const override {}
96 std::vector<Date> paymentDates;
97 std::vector<Date> valuationDates;
98};
99
100} // namespace QuantExt
bond index class representing historical and forward bond prices
QuantLib::ext::shared_ptr< QuantExt::BondIndex > bondIndex
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex
const QuantLib::ext::shared_ptr< QuantExt::BondIndex > & bondIndex() const
void setupArguments(PricingEngine::arguments *) const override
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex_
bool isExpired() const override
std::vector< Leg > fundingLeg_
const Leg & returnLeg() const
BondTRS::results results
bool payBondCashFlowsImmediately() const
const std::vector< Date > & valuationDates() const
const std::vector< Leg > & fundingLeg() const
std::vector< Date > valuationDates_
const std::vector< Date > & paymentDates() const
bool payTotalReturnLeg() const
std::vector< Date > paymentDates_
const QuantLib::ext::shared_ptr< QuantExt::FxIndex > & fxIndex() const
QuantLib::ext::shared_ptr< QuantExt::BondIndex > bondIndex_
GenericEngine< BondTRS::arguments, BondTRS::results > engine
FX index class.