Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
bondrepo.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 qle/instruments/bondrepo.hpp
20 \brief bond repo instrument
21*/
22
23#pragma once
24
25#include <ql/cashflow.hpp>
26#include <ql/instruments/bond.hpp>
27#include <ql/pricingengine.hpp>
28
29namespace QuantExt {
30
31using namespace QuantLib;
32
33//! Bond repo instrument
34class BondRepo : public QuantLib::Instrument {
35public:
37 public:
40 QuantLib::ext::shared_ptr<Bond> security;
42 void validate() const override;
43 };
45 using engine = QuantLib::GenericEngine<arguments, results>;
46 BondRepo(const Leg& cashLeg, const bool cashLegPays, const QuantLib::ext::shared_ptr<Bond>& security,
47 const Real securityMultiplier);
48
49 // Observable interface
50 void deepUpdate() override;
51
52 // Instrument interface
53 bool isExpired() const override;
55 void fetchResults(const QuantLib::PricingEngine::results*) const override;
56
57 //! Inspectors
58 const Leg& cashLeg() const { return cashLeg_; }
59 bool cashLegPays() const { return cashLegPays_; }
60 QuantLib::ext::shared_ptr<Bond> security() const { return security_; }
61 Real securityMultiplier() const { return securityMultiplier_; }
62
63private:
64 const Leg cashLeg_;
65 const bool cashLegPays_;
66 const QuantLib::ext::shared_ptr<Bond> security_;
68
69 // Instrument interface
70 void setupExpired() const override;
71};
72
73//! %Arguments for Bond repo
74
75} // namespace QuantExt
QuantLib::ext::shared_ptr< Bond > security
Definition: bondrepo.hpp:40
void validate() const override
Definition: bondrepo.cpp:23
Bond repo instrument.
Definition: bondrepo.hpp:34
bool cashLegPays() const
Definition: bondrepo.hpp:59
void fetchResults(const QuantLib::PricingEngine::results *) const override
Definition: bondrepo.cpp:57
const Real securityMultiplier_
Definition: bondrepo.hpp:67
bool isExpired() const override
Definition: bondrepo.cpp:41
QuantLib::ext::shared_ptr< Bond > security() const
Definition: bondrepo.hpp:60
void deepUpdate() override
Definition: bondrepo.cpp:36
const QuantLib::ext::shared_ptr< Bond > security_
Definition: bondrepo.hpp:66
const Leg & cashLeg() const
Inspectors.
Definition: bondrepo.hpp:58
QuantLib::GenericEngine< arguments, results > engine
Definition: bondrepo.hpp:45
const bool cashLegPays_
Definition: bondrepo.hpp:65
void setupExpired() const override
Definition: bondrepo.cpp:58
const Leg cashLeg_
Definition: bondrepo.hpp:64
Real securityMultiplier() const
Definition: bondrepo.hpp:61
void setupArguments(QuantLib::PricingEngine::arguments *) const override
Definition: bondrepo.cpp:48