Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cliquetoption.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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
12 The license is also available online at <http://opensourcerisk.org>
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
21
22using namespace ore::data;
23using namespace QuantLib;
24using namespace std;
25
26namespace ore {
27namespace data {
28
29QuantLib::ext::shared_ptr<PricingEngine> EquityCliquetOptionMcScriptEngineBuilder::engineImpl(const string& assetName,
30 const Currency& ccy,
31 const AssetClass& assetClass) {
32
33 Size nPaths = parseInteger(engineParameter("Samples"));
34 Size regressionOrder = parseInteger(engineParameter("RegressionOrder"));
35 bool interactive = parseBool(engineParameter("Interactive"));
36 bool scriptedLibraryOverride = parseBool(engineParameter("ScriptedLibraryOverride", {}, false));
37
38 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> gbsp = getBlackScholesProcess(assetName, ccy, assetClass);
39 Handle<YieldTermStructure> discountCurve =
40 market_->discountCurve(ccy.code(), configuration(MarketContext::pricing));
41 return QuantLib::ext::make_shared<CliquetOptionMcScriptEngine>("EQ-" + assetName, ccy.code(), ccy.code(), gbsp, tradeTypes_,
42 nPaths, regressionOrder, interactive,
43 scriptedLibraryOverride);
44}
45
46} // namespace data
47} // namespace ore
Engine builder for cliquet options.
QuantLib::ext::shared_ptr< QuantLib::GeneralizedBlackScholesProcess > getBlackScholesProcess(const string &assetName, const Currency &ccy, const AssetClass &assetClassUnderlying, const std::vector< Time > &timePoints={}, const bool useFxSpot=true)
QuantLib::ext::shared_ptr< Market > market_
std::string engineParameter(const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
const string & configuration(const MarketContext &key)
Return a configuration (or the default one if key not found)
QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const std::string &assetName, const QuantLib::Currency &ccy, const ore::data::AssetClass &assetClass) override
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Definition: parsers.cpp:136
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23