QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
discretizedasset.cpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2001, 2002, 2003 Sadruddin Rejeb
5 Copyright (C) 2004 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
22
23namespace QuantLib {
24
26 /* In the real world, with time flowing forward, first
27 any payment is settled and only after options can be
28 exercised. Here, with time flowing backward, options
29 must be exercised before performing the adjustment.
30 */
31 underlying_->partialRollback(time());
32 underlying_->preAdjustValues();
33 Size i;
34 switch (exerciseType_) {
36 if (time_ >= exerciseTimes_[0] && time_ <= exerciseTimes_[1])
38 break;
41 for (i=0; i<exerciseTimes_.size(); i++) {
43 if (t >= 0.0 && isOnTime(t))
45 }
46 break;
47 default:
48 QL_FAIL("invalid exercise type");
49 }
50 underlying_->postAdjustValues();
51 }
52
53}
54
void postAdjustValuesImpl() override
std::vector< Time > exerciseTimes_
ext::shared_ptr< DiscretizedAsset > underlying_
const DefaultType & t
Discretized asset classes.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Definition: errors.hpp:92
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35