QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
riskyassetswap.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008, 2009 Roland Lichters
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file riskyassetswap.hpp
21 \brief Risky asset-swap instrument
22*/
23
24#ifndef quantlib_risky_asset_swap_hpp
25#define quantlib_risky_asset_swap_hpp
26
27#include <ql/instrument.hpp>
31#include <ql/time/schedule.hpp>
32
33namespace QuantLib {
34
35 //! Risky asset-swap instrument
36 class RiskyAssetSwap : public Instrument {
37 public:
40 Schedule fixedSchedule,
41 Schedule floatSchedule,
42 DayCounter fixedDayCounter,
43 DayCounter floatDayCounter,
48 Rate coupon = Null<Rate>());
49
51
52 Real floatAnnuity() const;
53
54 Real nominal() const { return nominal_; }
55 Rate spread() const { return spread_; }
56 bool fixedPayer() const { return fixedPayer_; }
57
58 private:
59 void setupExpired() const override;
60 bool isExpired() const override;
61 void performCalculations() const override;
62
63 Real fixedAnnuity() const;
64 Real parCoupon() const;
65 Real recoveryValue() const;
66 Real riskyBondPrice() const;
67
68 // calculated values
74
75 // input
84 mutable Real coupon_;
85 };
86
87
88 // risky-asset-swap helper for probability-curve bootstrap
90 public:
91 AssetSwapHelper(const Handle<Quote>& spread,
92 const Period& tenor,
93 Natural settlementDays,
94 Calendar calendar,
95 const Period& fixedPeriod,
96 BusinessDayConvention fixedConvention,
97 DayCounter fixedDayCount,
98 const Period& floatPeriod,
99 BusinessDayConvention floatConvention,
100 DayCounter floatDayCount,
101 Real recoveryRate,
103 const Period& integrationStepSize = Period());
104 Real impliedQuote() const override;
106
107 private:
108 void update() override;
109 void initializeDates();
110
123
125 ext::shared_ptr<RiskyAssetSwap> asw_;
127 };
128
129}
130
131#endif
132
BusinessDayConvention fixedConvention_
RelinkableHandle< DefaultProbabilityTermStructure > probability_
RelinkableHandle< YieldTermStructure > yieldTS_
void setTermStructure(DefaultProbabilityTermStructure *) override
Real impliedQuote() const override
ext::shared_ptr< RiskyAssetSwap > asw_
BusinessDayConvention floatConvention_
Base helper class for bootstrapping.
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Default probability term structure.
Shared handle to an observable.
Definition: handle.hpp:41
Abstract instrument class.
Definition: instrument.hpp:44
template class providing a null value for a given type.
Definition: null.hpp:76
Relinkable handle to an observable.
Definition: handle.hpp:117
Risky asset-swap instrument.
void performCalculations() const override
bool isExpired() const override
returns whether the instrument might have value greater than zero.
Handle< DefaultProbabilityTermStructure > defaultTS_
void setupExpired() const override
Handle< YieldTermStructure > yieldTS_
Payment schedule.
Definition: schedule.hpp:40
bootstrap helpers for default-probability term structures
default-probability term structure
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Rate
interest rates
Definition: types.hpp:70
Abstract instrument class.
Definition: any.hpp:35
date schedule
Interest-rate term structure.