Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
asianoption.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source librar
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7 ORE is free software: you can redistribute it and/or modify it
8 under the terms of the Modified BSD License. You should have received a
9 copy of the license along with this program.
10 The license is also available online at <http://opensourcerisk.org>
11 This program is distributed on the basis that it will form a useful
12 contribution to risk analytics and model standardisation, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
15*/
16
19
20namespace ore {
21namespace data {
22
23QuantLib::ext::shared_ptr<ore::data::Trade>
24AsianOptionScriptedEngineBuilder::build(const Trade* trade, const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory) {
25
26 auto asianOption = dynamic_cast<const ore::data::AsianOption*>(trade);
27
28 QL_REQUIRE(
29 asianOption != nullptr,
30 "AsianOptionScriptedEngineBuilder: internal error, could not cast to ore::data::AsianOption. Contact dev.");
31
32 auto basketOption = QuantLib::ext::make_shared<BasketOption>(
33 asianOption->payCurrency(), std::to_string(asianOption->quantity()), asianOption->strike(),
34 std::vector<QuantLib::ext::shared_ptr<ore::data::Underlying>>(1, asianOption->underlying()), asianOption->option(),
35 asianOption->settlementDate() == QuantLib::Null<QuantLib::Date>()
36 ? ""
37 : ore::data::to_string(asianOption->settlementDate()),
38 asianOption->observationDates());
39
40 basketOption->build(engineFactory);
41
42 return basketOption;
43}
44
45} // namespace data
46} // namespace ore
Asian option representation.
Abstract engine builders for European Asian Options.
Serializable Asian Option.
Definition: asianoption.hpp:40
QuantLib::ext::shared_ptr< ore::data::Trade > build(const Trade *trade, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory) override
Definition: asianoption.cpp:24
Trade base class.
Definition: trade.hpp:55
@ data
Definition: log.hpp:77
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
Serializable Credit Default Swap.
Definition: namespaces.docs:23