QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
swaptioncfs.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4Copyright (C) 2018 Sebastian Schlenkrich
5
6This file is part of QuantLib, a free-software/open-source library
7for financial quantitative analysts and developers - http://quantlib.org/
8
9QuantLib is free software: you can redistribute it and/or modify it
10under the terms of the QuantLib license. You should have received a
11copy 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
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
24#ifndef quantlib_swaptioncfs_hpp
25#define quantlib_swaptioncfs_hpp
26
27#include <ql/instruments/swaption.hpp>
28#include <ql/option.hpp>
29#include <ql/termstructures/yieldtermstructure.hpp>
30#include <ql/time/date.hpp>
31
32namespace QuantLib {
33
35 protected:
36 Date refDate_; // today, base for time calculations w.r.t. Act/365 (Fixed)
38 std::vector<Real> floatTimes_;
39 std::vector<Real> floatWeights_;
40
41 public:
42 inline const Leg& floatLeg() const { return floatLeg_; }
43 inline const std::vector<Real>& floatTimes() const { return floatTimes_; }
44 inline const std::vector<Real>& floatWeights() const { return floatWeights_; }
45 IborLegCashFlows(const Leg& iborLeg,
46 const Handle<YieldTermStructure>& discountCurve,
47 bool contTenorSpread = true);
48 IborLegCashFlows() = default;
49 ; // allow default constructor which does nothing
50 };
51
52
54 protected:
55 // resulting cash flows as leg
57 std::vector<Real> fixedTimes_;
58 std::vector<Real> fixedWeights_;
59 std::vector<Real> annuityWeights_;
60
61 public:
62 SwapCashFlows(const ext::shared_ptr<VanillaSwap>& swap,
63 const Handle<YieldTermStructure>& discountCurve,
64 bool contTenorSpread = true);
65 SwapCashFlows() = default;
66 ; // allow default constructor which does nothing
67 // inspectors
68 inline const Leg& fixedLeg() const { return fixedLeg_; }
69 inline const std::vector<Real>& fixedTimes() const { return fixedTimes_; }
70 inline const std::vector<Real>& fixedWeights() const { return fixedWeights_; }
71 inline const std::vector<Real>& annuityWeights() const { return annuityWeights_; }
72 };
73
74
76 protected:
77 ext::shared_ptr<Swaption> swaption_;
78 std::vector<Real> exerciseTimes_;
79
80 public:
81 SwaptionCashFlows(const ext::shared_ptr<Swaption>& swaption,
82 const Handle<YieldTermStructure>& discountCurve,
83 bool contTenorSpread = true);
84 SwaptionCashFlows() = default;
85 ; // allow default constructor which does nothing
86 // inspectors
87 inline ext::shared_ptr<Swaption> swaption() const { return swaption_; }
88 inline const std::vector<Real>& exerciseTimes() const { return exerciseTimes_; }
89 };
90
91
92}
93
94#endif
Concrete date class.
Definition: date.hpp:125
Shared handle to an observable.
Definition: handle.hpp:41
std::vector< Real > floatTimes_
Definition: swaptioncfs.hpp:38
const std::vector< Real > & floatWeights() const
Definition: swaptioncfs.hpp:44
const Leg & floatLeg() const
Definition: swaptioncfs.hpp:42
const std::vector< Real > & floatTimes() const
Definition: swaptioncfs.hpp:43
std::vector< Real > floatWeights_
Definition: swaptioncfs.hpp:39
const std::vector< Real > & fixedTimes() const
Definition: swaptioncfs.hpp:69
std::vector< Real > annuityWeights_
Definition: swaptioncfs.hpp:59
std::vector< Real > fixedTimes_
Definition: swaptioncfs.hpp:57
const std::vector< Real > & annuityWeights() const
Definition: swaptioncfs.hpp:71
const Leg & fixedLeg() const
Definition: swaptioncfs.hpp:68
const std::vector< Real > & fixedWeights() const
Definition: swaptioncfs.hpp:70
std::vector< Real > fixedWeights_
Definition: swaptioncfs.hpp:58
ext::shared_ptr< Swaption > swaption_
Definition: swaptioncfs.hpp:77
ext::shared_ptr< Swaption > swaption() const
Definition: swaptioncfs.hpp:87
const std::vector< Real > & exerciseTimes() const
Definition: swaptioncfs.hpp:88
std::vector< Real > exerciseTimes_
Definition: swaptioncfs.hpp:78
Definition: any.hpp:35
void swap(Array &v, Array &w) noexcept
Definition: array.hpp:903
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78