Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
discountingcurrencyswapengine.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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/pricingengines/discountingcurrencyswapengine.hpp
20 \brief discounting currency swap engine
21
22 \ingroup engines
23*/
24
25#ifndef quantext_discounting_currencyswap_engine_hpp
26#define quantext_discounting_currencyswap_engine_hpp
27
28#include <ql/currency.hpp>
29#include <ql/handle.hpp>
30#include <ql/termstructures/yieldtermstructure.hpp>
31
33
34namespace QuantExt {
35
36//! %Discounting %CurrencySwap Engine
37
38/*! This class generalizes QuantLib's DiscountingSwapEngine. It takes
39 leg currencies into account and converts into the provided "npv
40 currency", which must be one of the leg currencies. The evaluation
41 date is the reference date of either of the discounting curves (which
42 must be equal).
43
44 \ingroup engines
45*/
47public:
48 /*! The FX spots must be given as units of npvCurrency per respective
49 currency. The spots must be given w.r.t. a settlement date equal
50 to the npv date. */
51 DiscountingCurrencySwapEngine(const std::vector<Handle<YieldTermStructure> >& discountCurves,
52 const std::vector<Handle<Quote> >& fxQuotes, const std::vector<Currency>& currencies,
53 const Currency& npvCurrency,
54 boost::optional<bool> includeSettlementDateFlows = boost::none,
55 Date settlementDate = Date(), Date npvDate = Date(),
56 const std::vector<Date>& spotFXSettleDateVec = std::vector<Date>());
57 void calculate() const override;
58 std::vector<Handle<YieldTermStructure> > discountCurves() { return discountCurves_; }
59 std::vector<Currency> currencies() { return currencies_; }
60 Currency npvCurrency() { return npvCurrency_; }
61
62private:
63 Handle<YieldTermStructure> fetchTS(Currency ccy) const;
64 Handle<Quote> fetchFX(Currency ccy) const;
65
66 std::vector<Handle<YieldTermStructure> > discountCurves_;
67 std::vector<Handle<Quote> > fxQuotes_;
68 std::vector<Currency> currencies_;
69 Currency npvCurrency_;
70 boost::optional<bool> includeSettlementDateFlows_;
73 std::vector<Date> spotFXSettleDateVec_;
74};
75} // namespace QuantExt
76
77#endif
Handle< YieldTermStructure > fetchTS(Currency ccy) const
std::vector< Handle< YieldTermStructure > > discountCurves_
std::vector< Handle< YieldTermStructure > > discountCurves()
Interest rate swap with extended interface.