Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
swaption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 portfolio/swaption.hpp
20 \brief Swaption data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
29
30#include <ql/instruments/nonstandardswap.hpp>
31
32namespace ore {
33namespace data {
34
35//! Serializable Swaption
36/*!
37 \ingroup tradedata
38*/
39class Swaption : public Trade {
40public:
41 Swaption() : Trade("Swaption") {}
42 Swaption(const Envelope& env, const OptionData& optionData, const vector<LegData>& legData)
43 : Trade("Swaption", env), optionData_(optionData), legData_(legData) {}
44
45 void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
46
47 //! \name Inspectors
48 //@{
49 const OptionData& optionData() const { return optionData_; }
50 const vector<LegData>& legData() { return legData_; }
51 //@}
52
53 //! \name Serialisation
54 //@{
55 virtual void fromXML(XMLNode* node) override;
56 virtual XMLNode* toXML(XMLDocument& doc) const override;
57 //@}
58
59 QuantLib::Real notional() const override;
60 const std::map<std::string, boost::any>& additionalData() const override;
61 bool hasCashflows() const override { return false; }
62
63 bool isExercised() const;
64
65 std::map<AssetClass, std::set<std::string>>
66 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr) const override;
67
68private:
70 vector<LegData> legData_;
71
72 //! build underlying swaps for exposure simulation
73 std::vector<QuantLib::ext::shared_ptr<Instrument>> buildUnderlyingSwaps(const QuantLib::ext::shared_ptr<PricingEngine>&,
74 const std::vector<Date>&);
75
76 QuantLib::ext::shared_ptr<ore::data::Swap> underlying_;
77 QuantLib::ext::shared_ptr<ExerciseBuilder> exerciseBuilder_;
78 Position::Type positionType_;
79 Exercise::Type exerciseType_;
80 Settlement::Type settlementType_;
81 Settlement::Method settlementMethod_;
82};
83
84} // namespace data
85} // namespace ore
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable object holding option data.
Definition: optiondata.hpp:42
Serializable Swaption.
Definition: swaption.hpp:39
OptionData optionData_
Definition: swaption.hpp:69
std::vector< QuantLib::ext::shared_ptr< Instrument > > buildUnderlyingSwaps(const QuantLib::ext::shared_ptr< PricingEngine > &, const std::vector< Date > &)
build underlying swaps for exposure simulation
Definition: swaption.cpp:393
QuantLib::ext::shared_ptr< ExerciseBuilder > exerciseBuilder_
Definition: swaption.hpp:77
vector< LegData > legData_
Definition: swaption.hpp:70
QuantLib::Real notional() const override
Return the current notional in npvCurrency. See individual sub-classes for the precise definition.
Definition: swaption.cpp:437
virtual void fromXML(XMLNode *node) override
Definition: swaption.cpp:483
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: swaption.cpp:496
std::map< AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const override
Definition: swaption.cpp:509
QuantLib::ext::shared_ptr< ore::data::Swap > underlying_
Definition: swaption.hpp:76
bool isExercised() const
Definition: swaption.cpp:445
Exercise::Type exerciseType_
Definition: swaption.hpp:79
const vector< LegData > & legData()
Definition: swaption.hpp:50
Swaption(const Envelope &env, const OptionData &optionData, const vector< LegData > &legData)
Definition: swaption.hpp:42
Settlement::Method settlementMethod_
Definition: swaption.hpp:81
bool hasCashflows() const override
Definition: swaption.hpp:61
Settlement::Type settlementType_
Definition: swaption.hpp:80
const OptionData & optionData() const
Definition: swaption.hpp:49
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Definition: swaption.cpp:62
Position::Type positionType_
Definition: swaption.hpp:78
const std::map< std::string, boost::any > & additionalData() const override
returns all additional data returned by the trade once built
Definition: swaption.cpp:447
Trade base class.
Definition: trade.hpp:55
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade option data model and serialization
Swap trade data model and serialization.
base trade data model and serialization