Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
bondrepo.cpp
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
20
21namespace QuantExt {
22
24 QL_REQUIRE(!cashLeg.empty(), "BondRepo::validate(): cashLeg is empty");
25 QL_REQUIRE(security, "BondRepo::validate(): security is null");
26}
27
28BondRepo::BondRepo(const Leg& cashLeg, const bool cashLegPays, const QuantLib::ext::shared_ptr<Bond>& security,
29 const Real securityMultiplier)
31 for (auto const& c : cashLeg_)
32 registerWith(c);
33 registerWith(security_);
34}
35
37 security_->deepUpdate();
38 update();
39}
40
41bool BondRepo::isExpired() const {
42 for (auto const& c : cashLeg_)
43 if (!c->hasOccurred())
44 return false;
45 return true;
46}
47
50 QL_REQUIRE(arguments != 0, "BondRepo::setupArguments(): wrong argument type");
55}
56
57void BondRepo::fetchResults(const QuantLib::PricingEngine::results* r) const { Instrument::fetchResults(r); }
58void BondRepo::setupExpired() const { Instrument::setupExpired(); }
59
60} // namespace QuantExt
bond repo instrument
QuantLib::ext::shared_ptr< Bond > security
Definition: bondrepo.hpp:40
void validate() const override
Definition: bondrepo.cpp:23
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
BondRepo(const Leg &cashLeg, const bool cashLegPays, const QuantLib::ext::shared_ptr< Bond > &security, const Real securityMultiplier)
Definition: bondrepo.cpp:28
const Leg & cashLeg() const
Inspectors.
Definition: bondrepo.hpp:58
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