Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
indexcreditdefaultswap.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/*! \file qle/instruments/indexcreditdefaultswap.hpp
20 \brief Index Credit default swap
21*/
22
23#ifndef quantext_index_credit_default_swap_hpp
24#define quantext_index_credit_default_swap_hpp
25
26#include <ql/instruments/creditdefaultswap.hpp>
27
28#include <ql/cashflow.hpp>
29#include <ql/default.hpp>
30#include <ql/instrument.hpp>
31#include <ql/termstructures/defaulttermstructure.hpp>
32#include <ql/time/schedule.hpp>
33
34namespace QuantLib {
35class YieldTermStructure;
36class Claim;
37} // namespace QuantLib
38
39namespace QuantExt {
40using namespace QuantLib;
41
42class IndexCreditDefaultSwap : public QuantLib::CreditDefaultSwap {
43public:
44 class arguments;
45 class results;
46 class engine;
47
48 IndexCreditDefaultSwap(Protection::Side side, Real notional, std::vector<Real> underlyingNotionals, Rate spread,
49 const Schedule& schedule, BusinessDayConvention paymentConvention,
50 const DayCounter& dayCounter, bool settlesAccrual = true,
51 ProtectionPaymentTime protectionPaymentTime = atDefault,
52 const Date& protectionStart = Date(),
53 const QuantLib::ext::shared_ptr<Claim>& claim = QuantLib::ext::shared_ptr<Claim>(),
54 const DayCounter& lastPeriodDayCounter = DayCounter(),
55 bool rebatesAccrual = true,
56 const Date& tradeDate = Date(),
57 Natural cashSettlementDays = 3)
58 : QuantLib::CreditDefaultSwap(side, notional, spread, schedule, paymentConvention, dayCounter, settlesAccrual,
59 protectionPaymentTime, protectionStart, claim, lastPeriodDayCounter, rebatesAccrual,
60 tradeDate, cashSettlementDays),
62
63 IndexCreditDefaultSwap(Protection::Side side, Real notional, std::vector<Real> underlyingNotionals, Rate upfront,
64 Rate spread, const Schedule& schedule, BusinessDayConvention paymentConvention,
65 const DayCounter& dayCounter, bool settlesAccrual = true,
66 ProtectionPaymentTime protectionPaymentTime = atDefault,
67 const Date& protectionStart = Date(), const Date& upfrontDate = Date(),
68 const QuantLib::ext::shared_ptr<Claim>& claim = QuantLib::ext::shared_ptr<Claim>(),
69 const DayCounter& lastPeriodDayCounter = DayCounter(),
70 bool rebatesAccrual = true,
71 const Date& tradeDate = Date(),
72 Natural cashSettlementDays = 3)
73 : QuantLib::CreditDefaultSwap(side, notional, upfront, spread, schedule, paymentConvention, dayCounter, settlesAccrual,
74 protectionPaymentTime, protectionStart, upfrontDate, claim, lastPeriodDayCounter,
75 rebatesAccrual, tradeDate, cashSettlementDays),
77
78 //@}
79 //! \name Inspectors
80 //@{
81 const std::vector<Real>& underlyingNotionals() const { return underlyingNotionals_; }
82 //@}
83
84 //@}
85 //! \name Instrument interface
86 //@{
87 void setupArguments(PricingEngine::arguments*) const override;
88 //@}
89
90protected:
91 std::vector<Real> underlyingNotionals_;
92 //! \name Additional interface
93 //@{
94 virtual QuantLib::ext::shared_ptr<PricingEngine> buildPricingEngine(const Handle<DefaultProbabilityTermStructure>& p,
95 Real r, const Handle<YieldTermStructure>& d,
96 PricingModel model = Midpoint) const override;
97 //@}
98};
99
101public:
102 std::vector<Real> underlyingNotionals;
103};
104
106
108 : public GenericEngine<IndexCreditDefaultSwap::arguments, IndexCreditDefaultSwap::results> {};
109
110} // namespace QuantExt
111
112#endif
const std::vector< Real > & underlyingNotionals() const
IndexCreditDefaultSwap(Protection::Side side, Real notional, std::vector< Real > underlyingNotionals, Rate upfront, Rate spread, const Schedule &schedule, BusinessDayConvention paymentConvention, const DayCounter &dayCounter, bool settlesAccrual=true, ProtectionPaymentTime protectionPaymentTime=atDefault, const Date &protectionStart=Date(), const Date &upfrontDate=Date(), const QuantLib::ext::shared_ptr< Claim > &claim=QuantLib::ext::shared_ptr< Claim >(), const DayCounter &lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, const Date &tradeDate=Date(), Natural cashSettlementDays=3)
void setupArguments(PricingEngine::arguments *) const override
virtual QuantLib::ext::shared_ptr< PricingEngine > buildPricingEngine(const Handle< DefaultProbabilityTermStructure > &p, Real r, const Handle< YieldTermStructure > &d, PricingModel model=Midpoint) const override
IndexCreditDefaultSwap(Protection::Side side, Real notional, std::vector< Real > underlyingNotionals, Rate spread, const Schedule &schedule, BusinessDayConvention paymentConvention, const DayCounter &dayCounter, bool settlesAccrual=true, ProtectionPaymentTime protectionPaymentTime=atDefault, const Date &protectionStart=Date(), const QuantLib::ext::shared_ptr< Claim > &claim=QuantLib::ext::shared_ptr< Claim >(), const DayCounter &lastPeriodDayCounter=DayCounter(), bool rebatesAccrual=true, const Date &tradeDate=Date(), Natural cashSettlementDays=3)