Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
optionexercisedata.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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
20
22
23using namespace QuantLib;
24using std::ostream;
25using std::string;
26using std::vector;
27
28namespace ore {
29namespace data {
30
31OptionExerciseData::OptionExerciseData() : price_(Null<Real>()) {}
32
33OptionExerciseData::OptionExerciseData(const string& date, const string& price) : strDate_(date), strPrice_(price) {
34 init();
35}
36
38 XMLUtils::checkNode(node, "ExerciseData");
39 strDate_ = XMLUtils::getChildValue(node, "Date", true);
40 strPrice_ = XMLUtils::getChildValue(node, "Price", false);
41 init();
42}
43
45 XMLNode* node = doc.allocNode("ExerciseData");
46 XMLUtils::addChild(doc, node, "Date", strDate_);
47 if (!strPrice_.empty())
48 XMLUtils::addChild(doc, node, "Price", strPrice_);
49 return node;
50}
51
54 if (!strPrice_.empty())
56}
57
58} // namespace data
59} // namespace ore
OptionExerciseData()
Default constructor.
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
option exercise data model and serialization
Map text representations to QuantLib/QuantExt types.