QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
bondforward.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 Allen Kuo
5 Copyright (C) 2022 Marcin Rybacki
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_bond_forward_hpp
26#define quantlib_bond_forward_hpp
27
28#include <ql/instruments/forward.hpp>
29#include <ql/instruments/bond.hpp>
30
31namespace QuantLib {
32
34
69 class BondForward : public Forward {
70 public:
72
81 const Date& valueDate,
82 const Date& maturityDate,
83 Position::Type type,
84 Real strike,
85 Natural settlementDays,
87 const Calendar& calendar,
89 const ext::shared_ptr<Bond>& bond,
93
95
96
98 Real forwardPrice() const;
99
101 Real cleanForwardPrice() const;
102
104
109
111 Real spotValue() const override;
112
114
115 protected:
116 ext::shared_ptr<Bond> bond_;
117 void performCalculations() const override;
118 };
119
120}
121
122#endif
Forward contract on a bond
Definition: bondforward.hpp:69
void performCalculations() const override
Definition: bondforward.cpp:91
Real forwardPrice() const
(dirty) forward bond price
Definition: bondforward.cpp:54
Real cleanForwardPrice() const
(dirty) forward bond price minus accrued on bond at delivery
Definition: bondforward.cpp:49
Real spotValue() const override
NPV of underlying bond.
Definition: bondforward.cpp:86
Real spotIncome(const Handle< YieldTermStructure > &incomeDiscountCurve) const override
NPV of bond coupons discounted using incomeDiscountCurve.
Definition: bondforward.cpp:59
ext::shared_ptr< Bond > bond_
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Abstract base forward class.
Definition: forward.hpp:66
const DayCounter & dayCounter() const
Definition: forward.hpp:176
Handle< YieldTermStructure > discountCurve() const
term structure relevant to the contract (e.g. repo curve)
Definition: forward.hpp:180
const Calendar & calendar() const
Definition: forward.hpp:168
BusinessDayConvention businessDayConvention() const
Definition: forward.hpp:172
Handle< YieldTermStructure > incomeDiscountCurve() const
term structure that discounts the underlying's income cash flows
Definition: forward.hpp:184
Shared handle to an observable.
Definition: handle.hpp:41
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Definition: any.hpp:35