Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fixedratefxlinkednotionalcoupon.cpp
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
20
21using namespace QuantLib;
22
23namespace QuantExt {
24
26 const QuantLib::Date& fxFixingDate, QuantLib::Real foreignAmount,
27 QuantLib::ext::shared_ptr<FxIndex> fxIndex,
28 const QuantLib::ext::shared_ptr<FixedRateCoupon>& underlying)
29 : FixedRateCoupon(underlying->date(), foreignAmount, underlying->rate(),
30 underlying->dayCounter(), underlying->accrualStartDate(),
31 underlying->accrualEndDate(), underlying->referencePeriodStart(),
32 underlying->referencePeriodEnd()),
33 FXLinked(fxFixingDate, foreignAmount, fxIndex), underlying_(underlying) {
34 registerWith(FXLinked::fxIndex());
35 registerWith(underlying_);
36}
37
39 return foreignAmount() * fxRate();
40}
41
43 return underlying_->rate();
44}
45
46QuantLib::ext::shared_ptr<FixedRateCoupon> FixedRateFXLinkedNotionalCoupon::underlying() const {
47 return underlying_;
48}
49
51 notifyObservers();
52}
53
55 Visitor<FixedRateFXLinkedNotionalCoupon>* v1 = dynamic_cast<Visitor<FixedRateFXLinkedNotionalCoupon>*>(&v);
56 if (v1 != 0)
57 v1->visit(*this);
58 else
59 FixedRateCoupon::accept(v);
60}
61
62QuantLib::ext::shared_ptr<FXLinked> FixedRateFXLinkedNotionalCoupon::clone(QuantLib::ext::shared_ptr<FxIndex> fxIndex) {
63 return QuantLib::ext::make_shared<FixedRateFXLinkedNotionalCoupon>(fxFixingDate(), foreignAmount(), fxIndex,
64 underlying());
65}
66
67} //QuantExt
Base class for FX Linked cashflows.
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex() const
Real foreignAmount() const
Date fxFixingDate() const
QuantLib::ext::shared_ptr< FXLinked > clone(QuantLib::ext::shared_ptr< FxIndex > fxIndex) override
void accept(QuantLib::AcyclicVisitor &) override
QuantLib::ext::shared_ptr< FixedRateCoupon > underlying() const
more inspectors
const QuantLib::ext::shared_ptr< FixedRateCoupon > underlying_
FixedRateFXLinkedNotionalCoupon(const QuantLib::Date &fxFixingDate, QuantLib::Real foreignAmount, QuantLib::ext::shared_ptr< FxIndex > fxIndex, const QuantLib::ext::shared_ptr< FixedRateCoupon > &underlying)
FloatingRateFXLinkedNotionalCoupon.
Coupon paying a fixed rate but with an FX linked notional.