Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
discountingforwardbondengine.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 qle/pricingengines/discountingforwardbondengine.hpp
20 \brief Engine to value a Forward Bond contract
21
22 \ingroup engines
23*/
24
25#ifndef quantext_discounting_forward_bond_engine_hpp
26#define quantext_discounting_forward_bond_engine_hpp
27
28#include <ql/termstructures/defaulttermstructure.hpp>
29#include <ql/termstructures/yieldtermstructure.hpp>
30#include <ql/time/period.hpp>
31
33
34#include <ql/tuple.hpp>
35
36namespace QuantExt {
37
38//! Discounting Forward Bond Engine
39
40/*!
41 \ingroup engines
42*/
44public:
45 DiscountingForwardBondEngine(const Handle<YieldTermStructure>& discountCurve,
46 const Handle<YieldTermStructure>& incomeCurve,
47 const Handle<YieldTermStructure>& bondReferenceYieldCurve,
48 const Handle<Quote>& bondSpread,
49 const Handle<DefaultProbabilityTermStructure>& defaultCurve,
50 const Handle<Quote>& recoveryRate, Period timestepPeriod,
51 boost::optional<bool> includeSettlementDateFlows = boost::none,
52 const Date& settlementDate = Date(), const Date& npvDate = Date());
53
54 void calculate() const override;
55 Real calculateBondNpv(Date, Date) const;
56 QuantLib::ext::tuple<Real, Real> calculateForwardContractPresentValue(Real spotValue, Real cmpPayment, Date npvDate,
57 Date computeDate, Date settlementDate,
58 bool cashSettlement, Date cmpPaymentDate,
59 bool dirty) const;
60
61 const Handle<YieldTermStructure>& discountCurve() const { return discountCurve_; }
62 const Handle<YieldTermStructure>& incomeCurve() const { return incomeCurve_; }
63 const Handle<YieldTermStructure>& bondReferenceYieldCurve() const { return bondReferenceYieldCurve_; }
64 const Handle<Quote>& bondSpread() const { return bondSpread_; }
65 const Handle<DefaultProbabilityTermStructure>& bondDefaultCurve() const { return bondDefaultCurve_; }
66 const Handle<Quote>& bondRecoveryRate() const { return bondRecoveryRate_; }
67
68private:
69 Handle<YieldTermStructure> discountCurve_;
70 Handle<YieldTermStructure> incomeCurve_;
71 Handle<YieldTermStructure> bondReferenceYieldCurve_;
72 Handle<Quote> bondSpread_;
73 Handle<DefaultProbabilityTermStructure> bondDefaultCurve_;
74 Handle<Quote> bondRecoveryRate_;
76 boost::optional<bool> includeSettlementDateFlows_;
79};
80} // namespace QuantExt
81
82#endif
Handle< DefaultProbabilityTermStructure > bondDefaultCurve_
const Handle< YieldTermStructure > & bondReferenceYieldCurve() const
const Handle< YieldTermStructure > & incomeCurve() const
QuantLib::ext::tuple< Real, Real > calculateForwardContractPresentValue(Real spotValue, Real cmpPayment, Date npvDate, Date computeDate, Date settlementDate, bool cashSettlement, Date cmpPaymentDate, bool dirty) const
const Handle< YieldTermStructure > & discountCurve() const
const Handle< DefaultProbabilityTermStructure > & bondDefaultCurve() const
Forward bond class.