Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
equitycouponpricer.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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
21namespace QuantExt {
22
24 initialPrice = Null<Real>();
25 startFixingTotal = Null<Real>();
26 startFixing = Null<Real>();
27 startFxFixing = Null<Real>();
28 endFixingTotal = Null<Real>();
29 endFixing = Null<Real>();
30 endFxFixing = Null<Real>();
31 pastDividends = Null<Real>();
32 forecastDividends = Null<Real>();
33}
34
37
38 // Start fixing shouldn't include dividends as the assumption of continuous dividends means they will have been paid
39 // as they accrued in the previous period (or at least at the end when performance is measured).
42
43 // fx rates at start and end, at start we only convert if the initial price is not already in target ccy
47
48 Real dividends = 0.0;
49
50 // Dividends that are already fixed dividends + yield accrued over remaining period.
51 // yield accrued = Forward without dividend yield - Forward with dividend yield
53 // projected dividends from today until the fixing end date
56 // subtract projected dividends from today until the fixing start date
57 if (coupon_->fixingStartDate() > Settings::instance().evaluationDate()) {
61 }
63 // add historical dividends
65 equityCurve_->dividendsBetweenDates(coupon_->fixingStartDate(), coupon_->fixingEndDate());
67 }
68
70 return dividends;
76 else
80}
81
83
84 coupon_ = &coupon;
85
86 equityCurve_ = QuantLib::ext::dynamic_pointer_cast<QuantExt::EquityIndex2>(coupon.equityCurve());
87 fxIndex_ = QuantLib::ext::dynamic_pointer_cast<FxIndex>(coupon.fxIndex());
88 returnType_ = coupon.returnType();
90}
91
92} // namespace QuantExt
EquityReturnType returnType() const
the return type of the coupon
const QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > & equityCurve() const
equity reference rate curve
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex() const
fx index curve
Real dividendFactor() const
are dividends scaled (e.g. to account for tax)
bool initialPriceIsInTargetCcy() const
initial price is in target ccy (if applicable, i.e. if fxIndex != null, otherwise ignored)
Date fixingEndDate() const
The date at which performance is measured.
Date fixingStartDate() const
The date at which the starting equity price is fixed.
Real initialPrice() const
initial price
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > equityCurve_
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
virtual void initialize(const EquityCoupon &coupon)
AdditionalResultCache additionalResultCache_
Pricer for equity coupons.