Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
accumulator.hpp
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
19/*! \file ored/portfolio/accumulator.hpp
20 \brief accumulator wrapper for scripted trade
21 \ingroup portfolio
22*/
23
24#pragma once
25
27
34
35namespace ore {
36namespace data {
37
38class Accumulator : public ScriptedTrade {
39public:
40 explicit Accumulator(const std::string& tradeType = "Accumulator") : ScriptedTrade(tradeType) {}
41 Accumulator(const std::string& currency, const std::string& fixingAmount, const TradeStrike& strike,
42 const QuantLib::ext::shared_ptr<Underlying>& underlying, const OptionData& optionData,
43 const std::string& startDate, const ScheduleData& observationDates, const ScheduleData& pricingDates,
44 const ScheduleData& settlementDates, const std::string& settlementLag,
45 const std::string& settlementCalendar, const std::string& settlementConvention,
46 const std::vector<RangeBound>& rangeBounds, const std::vector<BarrierData>& barriers)
47 : currency_(currency), fixingAmount_(fixingAmount), strike_(strike), underlying_(underlying),
48 optionData_(optionData), startDate_(startDate), observationDates_(observationDates),
49 pricingDates_(pricingDates), settlementDates_(settlementDates), settlementLag_(settlementLag),
50 settlementCalendar_(settlementCalendar), settlementConvention_(settlementConvention),
51 rangeBounds_(rangeBounds), barriers_(barriers) {
53 }
54 void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
55 void setIsdaTaxonomyFields() override;
56 void fromXML(XMLNode* node) override;
57 XMLNode* toXML(XMLDocument& doc) const override;
58
59 //! \name Inspectors
60 //@{
61 const std::string& name() const { return underlying_->name(); }
62 //@}
63
64private:
65 void initIndices();
68 QuantLib::ext::shared_ptr<Underlying> underlying_;
70 std::string startDate_;
73 bool nakedOption_ = false;
74 bool dailyFixingAmount_ = false;
75
76 std::vector<RangeBound> rangeBounds_;
77 std::vector<BarrierData> barriers_;
78};
79
81public:
82 EquityAccumulator() : Accumulator("EquityAccumulator") {}
83};
84
85class FxAccumulator : public Accumulator {
86public:
87 FxAccumulator() : Accumulator("FxAccumulator") {}
88};
89
91public:
92 CommodityAccumulator() : Accumulator("CommodityAccumulator") {}
93};
94
95} // namespace data
96} // namespace ore
Accumulator(const std::string &tradeType="Accumulator")
Definition: accumulator.hpp:40
Accumulator(const std::string &currency, const std::string &fixingAmount, const TradeStrike &strike, const QuantLib::ext::shared_ptr< Underlying > &underlying, const OptionData &optionData, const std::string &startDate, const ScheduleData &observationDates, const ScheduleData &pricingDates, const ScheduleData &settlementDates, const std::string &settlementLag, const std::string &settlementCalendar, const std::string &settlementConvention, const std::vector< RangeBound > &rangeBounds, const std::vector< BarrierData > &barriers)
Definition: accumulator.hpp:41
std::string settlementConvention_
Definition: accumulator.hpp:72
ScheduleData settlementDates_
Definition: accumulator.hpp:71
const std::string & name() const
Definition: accumulator.hpp:61
void setIsdaTaxonomyFields() override
void fromXML(XMLNode *node) override
QuantLib::ext::shared_ptr< Underlying > underlying_
Definition: accumulator.hpp:68
XMLNode * toXML(XMLDocument &doc) const override
std::string settlementLag_
Definition: accumulator.hpp:72
ScheduleData observationDates_
Definition: accumulator.hpp:71
ScheduleData pricingDates_
Definition: accumulator.hpp:71
std::vector< BarrierData > barriers_
Definition: accumulator.hpp:77
std::string fixingAmount_
Definition: accumulator.hpp:66
std::string settlementCalendar_
Definition: accumulator.hpp:72
std::vector< RangeBound > rangeBounds_
Definition: accumulator.hpp:76
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Serializable object holding option data.
Definition: optiondata.hpp:42
Serializable schedule data.
Definition: schedule.hpp:202
const string & tradeType() const
Definition: trade.hpp:133
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
@ data
Definition: log.hpp:77
set< Date > pricingDates(const Date &s, const Date &e, const Calendar &pricingCalendar, bool excludeStart, bool includeEnd, bool useBusinessDays)
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade option data model and serialization
rangebound data model
scripted trade data model
base trade data model and serialization
underlying data model