31 Real runningAccumulator,
33 std::vector<Date> fixingDates,
34 const ext::shared_ptr<StrikedTypePayoff>&
payoff,
35 const ext::shared_ptr<Exercise>& exercise)
37 runningAccumulator_(runningAccumulator), pastFixings_(pastFixings),
38 fixingDates_(
std::move(fixingDates)), allPastFixingsProvided_(false) {
49 QL_FAIL(
"Unrecognised average type, must be Average::Arithmetic or Average::Geometric");
56 std::vector<Date> fixingDates,
57 const ext::shared_ptr<StrikedTypePayoff>&
payoff,
58 const ext::shared_ptr<Exercise>& exercise,
59 std::vector<Real> allPastFixings)
61 pastFixings_(0), fixingDates_(
std::move(fixingDates)),
62 allPastFixingsProvided_(true), allPastFixings_(
std::move(allPastFixings)) {}
75 std::vector<Date> futureFixingDates = std::vector<Date>();
80 if (fixingDate < today) {
83 futureFixingDates.push_back(fixingDate);
86 fixingDates = futureFixingDates;
89 QL_FAIL(
"Not enough past fixings have been provided for the required historical fixing dates");
92 runningAccumulator = 1.0;
93 for (
Size i=0; i<pastFixings; i++)
97 runningAccumulator = 0.0;
98 for (
Size i=0; i<pastFixings; i++)
102 QL_FAIL(
"Unrecognised average type, must be Average::Arithmetic or Average::Geometric");
110 QL_REQUIRE(moreArgs !=
nullptr,
"wrong argument type");
112 moreArgs->runningAccumulator = runningAccumulator;
113 moreArgs->pastFixings = pastFixings;
114 moreArgs->fixingDates = fixingDates;
119 OneAssetOption::arguments::validate();
127 "non negative running sum required: "
132 "positive running product required: "
136 QL_FAIL(
"invalid average type");
147 const ext::shared_ptr<StrikedTypePayoff>&
payoff,
148 const ext::shared_ptr<Exercise>&
exercise)
158 QL_REQUIRE(moreArgs !=
nullptr,
"wrong argument type");
164 OneAssetOption::arguments::validate();
Asian option on a single asset.
Extra arguments for single-asset continuous-average Asian option.
Average::Type averageType
void validate() const override
void setupArguments(PricingEngine::arguments *) const override
ContinuousAveragingAsianOption(Average::Type averageType, const ext::shared_ptr< StrikedTypePayoff > &payoff, const ext::shared_ptr< Exercise > &exercise)
Average::Type averageType_
Extra arguments for single-asset discrete-average Asian option.
Average::Type averageType
void validate() const override
void setupArguments(PricingEngine::arguments *) const override
std::vector< Date > fixingDates_
Average::Type averageType_
std::vector< Real > allPastFixings_
bool allPastFixingsProvided_
DiscreteAveragingAsianOption(Average::Type averageType, Real runningAccumulator, Size pastFixings, std::vector< Date > fixingDates, const ext::shared_ptr< StrikedTypePayoff > &payoff, const ext::shared_ptr< Exercise > &exercise)
virtual void setupArguments(PricingEngine::arguments *) const
template class providing a null value for a given type.
Base class for options on a single asset.
ext::shared_ptr< Payoff > payoff() const
ext::shared_ptr< Exercise > exercise() const
DateProxy & evaluationDate()
the date at which pricing is to be performed.
static Settings & instance()
access to the unique instance
date- and time-related classes, typedefs and enumerations
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
QL_INTEGER Integer
integer number
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
global repository for run-time library settings