Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
compoequityindex.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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 qle/indexes/compoequityindex.hpp
20 \brief equity index converting the original equity currency to another currency
21 \ingroup indexes
22*/
23
24#pragma once
25
28
29#include <ql/patterns/lazyobject.hpp>
30
31namespace QuantExt {
32using namespace QuantLib;
33
34class CompoEquityIndex : public QuantExt::EquityIndex2, public LazyObject {
35public:
36 /*! - fxIndex source ccy must be the equity ccy, fxIndex target ccy is the new equity ccy
37 - dividends before the divCutoffDate are ignored, this is useful since there have to be
38 fixings for the fx index on all dividend dates which might not be available */
39 CompoEquityIndex(const QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>& source, const QuantLib::ext::shared_ptr<FxIndex>& fxIndex,
40 const Date& dividendCutoffDate = Date());
41
42 QuantLib::ext::shared_ptr<QuantExt::EquityIndex2> source() const;
43
44 void addDividend(const Dividend& dividend, bool forceOverwrite = false) override;
45 const std::set<Dividend>& dividendFixings() const override;
46 Real pastFixing(const Date& fixingDate) const override;
47 QuantLib::ext::shared_ptr<QuantExt::EquityIndex2> clone(const Handle<Quote> spotQuote, const Handle<YieldTermStructure>& rate,
48 const Handle<YieldTermStructure>& dividend) const override;
49
50private:
51 void performCalculations() const override;
52
53 QuantLib::ext::shared_ptr<QuantExt::EquityIndex2> source_;
54 QuantLib::ext::shared_ptr<FxIndex> fxIndex_;
56
57 mutable std::set<Dividend> dividendFixings_;
58};
59
60} // namespace QuantExt
void performCalculations() const override
const std::set< Dividend > & dividendFixings() const override
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > clone(const Handle< Quote > spotQuote, const Handle< YieldTermStructure > &rate, const Handle< YieldTermStructure > &dividend) const override
std::set< Dividend > dividendFixings_
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > source() const
void addDividend(const Dividend &dividend, bool forceOverwrite=false) override
stores the historical dividend at the given date
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > source_
Real pastFixing(const Date &fixingDate) const override
returns a past fixing at the given date
equity index class for holding equity fixing histories and forwarding.
FX index class.