QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
makecds.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) 2014 Jose Aparicio
5 Copyright (C) 2014 Peter Caspers
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
21/*! \file makecds.hpp
22 \brief Helper class to instantiate standard market cds.
23*/
24
25#ifndef quantlib_makecds_hpp
26#define quantlib_makecds_hpp
27
29#include <ql/optional.hpp>
30
31namespace QuantLib {
32
33 //! helper class
34 /*! This class provides a more comfortable way
35 to instantiate standard cds.
36 */
38 public:
39 MakeCreditDefaultSwap(const Period& tenor, Real couponRate);
40 MakeCreditDefaultSwap(const Date& termDate, Real couponRate);
41
42 operator CreditDefaultSwap() const;
43 operator ext::shared_ptr<CreditDefaultSwap>() const;
44
53
54 MakeCreditDefaultSwap& withPricingEngine(const ext::shared_ptr<PricingEngine>&);
55
56 MakeCreditDefaultSwap& withTradeDate(const Date& tradeDate);
57
58 private:
61 ext::optional<Period> tenor_;
62 ext::optional<Date> termDate_;
71
72 ext::shared_ptr<PricingEngine> engine_;
73 };
74}
75
76#endif
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
MakeCreditDefaultSwap & withLastPeriodDayCounter(DayCounter &)
Definition: makecds.cpp:113
MakeCreditDefaultSwap & withTradeDate(const Date &tradeDate)
Definition: makecds.cpp:135
MakeCreditDefaultSwap & withDayCounter(DayCounter &)
Definition: makecds.cpp:108
MakeCreditDefaultSwap & withCouponTenor(Period)
Definition: makecds.cpp:102
ext::optional< Period > tenor_
Definition: makecds.hpp:61
MakeCreditDefaultSwap & withNominal(Real)
Definition: makecds.cpp:96
ext::optional< Date > termDate_
Definition: makecds.hpp:62
MakeCreditDefaultSwap & withDateGenerationRule(DateGeneration::Rule rule)
Definition: makecds.cpp:119
DateGeneration::Rule rule_
Definition: makecds.hpp:68
MakeCreditDefaultSwap & withCashSettlementDays(Natural cashSettlementDays)
Definition: makecds.cpp:124
MakeCreditDefaultSwap & withPricingEngine(const ext::shared_ptr< PricingEngine > &)
Definition: makecds.cpp:129
ext::shared_ptr< PricingEngine > engine_
Definition: makecds.hpp:72
MakeCreditDefaultSwap & withSide(Protection::Side)
Definition: makecds.cpp:91
MakeCreditDefaultSwap & withUpfrontRate(Real)
Definition: makecds.cpp:85
Credit default swap.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Definition: any.hpp:35
Maps optional to either the boost or std implementation.