Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
multilegoption.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 multilegoption.hpp
20 \brief multi leg option engine builder
21*/
22
23#pragma once
24
25#include <ql/indexes/interestrateindex.hpp>
26
28
30
31namespace ore {
32namespace data {
33
34//! MultiLeg option engine builder base class
36 : public CachingPricingEngineBuilder<string, const string&, const std::vector<Date>&, const Date&,
37 const std::vector<Currency>&, const std::vector<Date>&,
38 const std::vector<QuantLib::ext::shared_ptr<QuantLib::InterestRateIndex>>&> {
39public:
40 MultiLegOptionEngineBuilderBase(const std::string& model, const std::string& engine)
41 : CachingEngineBuilder(model, engine, {"MultiLegOption"}) {}
42
43protected:
44 string keyImpl(const string& id, const std::vector<Date>& exDates, const Date& maturityDate,
45 const std::vector<Currency>& currencies, const std::vector<Date>& fixingDates,
46 const std::vector<QuantLib::ext::shared_ptr<QuantLib::InterestRateIndex>>& indexes) override {
47 return id;
48 }
49};
50
51//! MultiLeg option engine builder for MC pricer
53public:
55
56protected:
57 QuantLib::ext::shared_ptr<PricingEngine>
58 engineImpl(const string& id, const std::vector<Date>& exDates, const Date& maturityDate,
59 const std::vector<Currency>& currencies, const std::vector<Date>& fixingDates,
60 const std::vector<QuantLib::ext::shared_ptr<QuantLib::InterestRateIndex>>& indexes) override;
61
62private:
63 std::string getCcyValue(const std::string& s, const std::string& c, const bool mandatory);
64};
65
66//! Multileg option engine builder for external cam, with additional simulation dates (AMC)
68public:
69 // for external cam, with additional simulation dates (AMC)
70 CamAmcMultiLegOptionEngineBuilder(const QuantLib::ext::shared_ptr<QuantExt::CrossAssetModel>& cam,
71 const std::vector<Date>& simulationDates)
72 : MultiLegOptionEngineBuilderBase("CrossAssetModel", "AMC"), cam_(cam), simulationDates_(simulationDates) {}
73
74protected:
75 // the pricing engine depends on the ccys only
76 string keyImpl(const string& id, const std::vector<Date>& exDates, const Date& maturityDate,
77 const std::vector<Currency>& currencies, const std::vector<Date>& fixingDates,
78 const std::vector<QuantLib::ext::shared_ptr<QuantLib::InterestRateIndex>>& indexes) override {
79 std::string res;
80 for (auto const& c : currencies) {
81 res += c.code() + "_";
82 }
83 return res;
84 }
85
86 QuantLib::ext::shared_ptr<PricingEngine>
87 engineImpl(const string& id, const std::vector<Date>& exDates, const Date& maturityDate,
88 const std::vector<Currency>& currencies, const std::vector<Date>& fixingDates,
89 const std::vector<QuantLib::ext::shared_ptr<QuantLib::InterestRateIndex>>& indexes) override;
90
91private:
92 const QuantLib::ext::shared_ptr<QuantExt::CrossAssetModel> cam_;
93 const std::vector<Date> simulationDates_;
94};
95
96} // namespace data
97} // namespace ore
Abstract template engine builder class.
Abstract template EngineBuilder class that can cache engines and coupon pricers.
Multileg option engine builder for external cam, with additional simulation dates (AMC)
const QuantLib::ext::shared_ptr< QuantExt::CrossAssetModel > cam_
QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &id, const std::vector< Date > &exDates, const Date &maturityDate, const std::vector< Currency > &currencies, const std::vector< Date > &fixingDates, const std::vector< QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > > &indexes) override
CamAmcMultiLegOptionEngineBuilder(const QuantLib::ext::shared_ptr< QuantExt::CrossAssetModel > &cam, const std::vector< Date > &simulationDates)
string keyImpl(const string &id, const std::vector< Date > &exDates, const Date &maturityDate, const std::vector< Currency > &currencies, const std::vector< Date > &fixingDates, const std::vector< QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > > &indexes) override
MultiLeg option engine builder for MC pricer.
std::string getCcyValue(const std::string &s, const std::string &c, const bool mandatory)
QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const string &id, const std::vector< Date > &exDates, const Date &maturityDate, const std::vector< Currency > &currencies, const std::vector< Date > &fixingDates, const std::vector< QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > > &indexes) override
const string & engine() const
Return the engine name.
const string & model() const
Return the model name.
MultiLeg option engine builder base class.
MultiLegOptionEngineBuilderBase(const std::string &model, const std::string &engine)
string keyImpl(const string &id, const std::vector< Date > &exDates, const Date &maturityDate, const std::vector< Currency > &currencies, const std::vector< Date > &fixingDates, const std::vector< QuantLib::ext::shared_ptr< QuantLib::InterestRateIndex > > &indexes) override
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23