QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
varianceoption.cpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 StatPro Italia srl
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20#include <ql/event.hpp>
21#include <ql/experimental/varianceoption/varianceoption.hpp>
22#include <utility>
23
24namespace QuantLib {
25
26 VarianceOption::VarianceOption(ext::shared_ptr<Payoff> payoff,
27 Real notional,
28 const Date& startDate,
29 const Date& maturityDate)
30 : payoff_(std::move(payoff)), notional_(notional), startDate_(startDate),
31 maturityDate_(maturityDate) {}
32
34 auto* arguments = dynamic_cast<VarianceOption::arguments*>(args);
35 QL_REQUIRE(arguments != nullptr, "wrong argument type");
36
41 }
42
44 QL_REQUIRE(payoff, "no strike given");
45 QL_REQUIRE(notional != Null<Real>(), "no notional given");
46 QL_REQUIRE(notional > 0.0, "negative or null notional given");
47 QL_REQUIRE(startDate != Date(), "null start date given");
48 QL_REQUIRE(maturityDate != Date(), "null maturity date given");
49 }
50
53 }
54
55}
Concrete date class.
Definition: date.hpp:125
virtual bool hasOccurred(const Date &refDate=Date(), ext::optional< bool > includeRefDate=ext::nullopt) const
returns true if an event has already occurred before a date
Definition: event.cpp:28
template class providing a null value for a given type.
Definition: null.hpp:76
Arguments for forward fair-variance calculation
ext::shared_ptr< Payoff > payoff
bool isExpired() const override
returns whether the instrument might have value greater than zero.
VarianceOption(ext::shared_ptr< Payoff > payoff, Real notional, const Date &startDate, const Date &maturityDate)
ext::shared_ptr< Payoff > payoff_
void setupArguments(PricingEngine::arguments *args) const override
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
STL namespace.