Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
creditlinkedswap.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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 creditlinkedswap.hpp
20 \brief credit linked swap instrument
21*/
22
23#pragma once
24
25#include <ql/instruments/creditdefaultswap.hpp>
26
27#include <ql/cashflow.hpp>
28#include <ql/currency.hpp>
29#include <ql/instrument.hpp>
30
31namespace QuantExt {
32using namespace QuantLib;
33
34class CreditLinkedSwap : public QuantLib::Instrument {
35public:
37
38 CreditLinkedSwap(const std::vector<Leg>& legs, const std::vector<bool>& legPayers,
39 const std::vector<LegType>& legTypes, const bool settlesAccrual, const Real fixedRecoveryRate,
40 const QuantExt::CreditDefaultSwap::ProtectionPaymentTime& defaultPaymentTime,
41 const Currency& currency);
42
44 void validate() const override {}
45 std::vector<Leg> legs;
46 std::vector<bool> legPayers;
47 std::vector<LegType> legTypes;
49 Currency currency;
52 QuantExt::CreditDefaultSwap::ProtectionPaymentTime defaultPaymentTime;
53 };
54
56 using engine = QuantLib::GenericEngine<arguments, results>;
57
58 bool isExpired() const override;
60
61 Date maturity() const;
62
63private:
64 std::vector<Leg> legs_;
65 std::vector<bool> legPayers_;
66 std::vector<LegType> legTypes_;
69 QuantExt::CreditDefaultSwap::ProtectionPaymentTime defaultPaymentTime_;
70 Currency currency_;
71};
72
73} // namespace QuantExt
std::vector< LegType > legTypes_
std::vector< bool > legPayers_
bool isExpired() const override
QuantLib::GenericEngine< arguments, results > engine
QuantExt::CreditDefaultSwap::ProtectionPaymentTime defaultPaymentTime_
void setupArguments(QuantLib::PricingEngine::arguments *) const override
QuantExt::CreditDefaultSwap::ProtectionPaymentTime defaultPaymentTime