Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
makecds.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 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/*
20 Copyright (C) 2014 Jose Aparicio
21 Copyright (C) 2014 Peter Caspers
22
23 This file is part of QuantLib, a free-software/open-source library
24 for financial quantitative analysts and developers - http://quantlib.org/
25
26 QuantLib is free software: you can redistribute it and/or modify it
27 under the terms of the QuantLib license. You should have received a
28 copy of the license along with this program; if not, please email
29 <quantlib-dev@lists.sf.net>. The license is also available online at
30 <http://quantlib.org/license.shtml>.
31
32 This program is distributed in the hope that it will be useful, but WITHOUT
33 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 FOR A PARTICULAR PURPOSE. See the license for more details.
35 */
36
37/*! \file makecds.hpp
38 \brief Helper class to instantiate standard market cds.
39 \ingroup instruments
40*/
41
42#ifndef quantext_makecds_hpp
43#define quantext_makecds_hpp
44
45#include <boost/optional.hpp>
46#include <ql/instruments/creditdefaultswap.hpp>
47
48namespace QuantExt {
49using namespace QuantLib;
50
51//! helper class
52/*! This class provides a more comfortable way
53 to instantiate standard cds.
54 \bug support last period dc
55 \ingroup instruments
56*/
58public:
59 MakeCreditDefaultSwap(const Period& tenor, const Real couponRate);
60 MakeCreditDefaultSwap(const Date& termDate, const Real couponRate);
61
62 operator CreditDefaultSwap() const;
63 operator QuantLib::ext::shared_ptr<CreditDefaultSwap>() const;
64
66 MakeCreditDefaultSwap& withSide(Protection::Side);
69 MakeCreditDefaultSwap& withDayCounter(const DayCounter&);
71 MakeCreditDefaultSwap& withDateGenerationRule(DateGeneration::Rule rule);
72 MakeCreditDefaultSwap& withCashSettlementDays(Natural cashSettlementDays);
73 MakeCreditDefaultSwap& withPricingEngine(const QuantLib::ext::shared_ptr<PricingEngine>&);
77
78private:
79 Protection::Side side_;
81 boost::optional<Period> tenor_;
82 boost::optional<Date> termDate_;
86 DayCounter dayCounter_;
88 DateGeneration::Rule rule_;
93 QuantLib::ext::shared_ptr<PricingEngine> engine_;
94};
95} // namespace QuantExt
96
97#endif
MakeCreditDefaultSwap & withPaysAtDefaultTime(bool)
Definition: makecds.cpp:151
MakeCreditDefaultSwap & withCouponTenor(Period)
Definition: makecds.cpp:116
MakeCreditDefaultSwap & withLastPeriodDayCounter(const DayCounter &)
Definition: makecds.cpp:126
MakeCreditDefaultSwap & withNominal(Real)
Definition: makecds.cpp:111
MakeCreditDefaultSwap & withRebatesAccrual(bool)
Definition: makecds.cpp:156
MakeCreditDefaultSwap & withPricingEngine(const QuantLib::ext::shared_ptr< PricingEngine > &)
Definition: makecds.cpp:141
MakeCreditDefaultSwap & withDayCounter(const DayCounter &)
Definition: makecds.cpp:121
QuantLib::ext::shared_ptr< PricingEngine > engine_
Definition: makecds.hpp:93
MakeCreditDefaultSwap & withDateGenerationRule(DateGeneration::Rule rule)
Definition: makecds.cpp:131
DateGeneration::Rule rule_
Definition: makecds.hpp:88
MakeCreditDefaultSwap & withCashSettlementDays(Natural cashSettlementDays)
Definition: makecds.cpp:136
boost::optional< Date > termDate_
Definition: makecds.hpp:82
MakeCreditDefaultSwap & withSide(Protection::Side)
Definition: makecds.cpp:106
MakeCreditDefaultSwap & withSettlesAccrual(bool)
Definition: makecds.cpp:146
boost::optional< Period > tenor_
Definition: makecds.hpp:81
MakeCreditDefaultSwap & withUpfrontRate(Real)
Definition: makecds.cpp:101