Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
lgmvectorised.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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 models/lgmvectorised.hpp
20 \brief vectorised lgm model calculations
21 \ingroup models
22*/
23
24#pragma once
25
28
29#include <ql/indexes/bmaindex.hpp>
30#include <ql/indexes/iborindex.hpp>
31#include <ql/option.hpp>
32
33namespace QuantExt {
34
35using namespace QuantLib;
36
38public:
39 LgmVectorised() = default;
40 LgmVectorised(const QuantLib::ext::shared_ptr<IrLgm1fParametrization>& p) : p_(p) {}
41
42 QuantLib::ext::shared_ptr<IrLgm1fParametrization> parametrization() const { return p_; }
43
44 RandomVariable numeraire(const Time t, const RandomVariable& x,
45 const Handle<YieldTermStructure>& discountCurve = Handle<YieldTermStructure>()) const;
46
47 RandomVariable discountBond(const Time t, const Time T, const RandomVariable& x,
48 const Handle<YieldTermStructure>& discountCurve = Handle<YieldTermStructure>()) const;
49
51 reducedDiscountBond(const Time t, const Time T, const RandomVariable& x,
52 const Handle<YieldTermStructure>& discountCurve = Handle<YieldTermStructure>()) const;
53
54 RandomVariable discountBondOption(Option::Type type, const Real K, const Time t, const Time S, const Time T,
55 const RandomVariable& x, const Handle<YieldTermStructure>& discountCurve) const;
56
57 /* Handles IborIndex and SwapIndex. Requires observation time t <= fixingDate */
58 RandomVariable fixing(const QuantLib::ext::shared_ptr<InterestRateIndex>& index, const Date& fixingDate, const Time t,
59 const RandomVariable& x) const;
60
61 /* Exact if no cap/floors are present and t <= first value date.
62 Approximations are applied for t > first value date or when cap / floors are present. */
63 RandomVariable compoundedOnRate(const QuantLib::ext::shared_ptr<OvernightIndex>& index,
64 const std::vector<Date>& fixingDates, const std::vector<Date>& valueDates,
65 const std::vector<Real>& dt, const Natural rateCutoff, const bool includeSpread,
66 const Real spread, const Real gearing, const Period lookback, Real cap, Real floor,
67 const bool localCapFloor, const bool nakedOption, const Time t,
68 const RandomVariable& x) const;
69
70 /* Exact if no cap/floors are present and t <= first value date.
71 Approximations are applied for t > first value date or when cap / floors are present. */
72 RandomVariable averagedOnRate(const QuantLib::ext::shared_ptr<OvernightIndex>& index, const std::vector<Date>& fixingDates,
73 const std::vector<Date>& valueDates, const std::vector<Real>& dt,
74 const Natural rateCutoff, const bool includeSpread, const Real spread,
75 const Real gearing, const Period lookback, Real cap, Real floor,
76 const bool localCapFloor, const bool nakedOption, const Time t,
77 const RandomVariable& x) const;
78
79 /* Exact if no cap/floors are present and t <= first value date.
80 Approximations are applied for t > first value date or when cap / floors are present. */
81 RandomVariable averagedBmaRate(const QuantLib::ext::shared_ptr<BMAIndex>& index, const std::vector<Date>& fixingDates,
82 const Date& accrualStartDate, const Date& accrualEndDate, const bool includeSpread,
83 const Real spread, const Real gearing, Real cap, Real floor, const bool nakedOption,
84 const Time t, const RandomVariable& x) const;
85
86 /* Approximation via plain Ibor coupon with fixing date = first fixing date and the fixing() method above. */
87 RandomVariable subPeriodsRate(const QuantLib::ext::shared_ptr<InterestRateIndex>& index,
88 const std::vector<Date>& fixingDates, const Time t, const RandomVariable& x) const;
89
90private:
91 QuantLib::ext::shared_ptr<IrLgm1fParametrization> p_;
92};
93
94} // namespace QuantExt
QuantLib::ext::shared_ptr< IrLgm1fParametrization > p_
RandomVariable discountBond(const Time t, const Time T, const RandomVariable &x, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >()) const
LgmVectorised(const QuantLib::ext::shared_ptr< IrLgm1fParametrization > &p)
QuantLib::ext::shared_ptr< IrLgm1fParametrization > parametrization() const
RandomVariable averagedOnRate(const QuantLib::ext::shared_ptr< OvernightIndex > &index, const std::vector< Date > &fixingDates, const std::vector< Date > &valueDates, const std::vector< Real > &dt, const Natural rateCutoff, const bool includeSpread, const Real spread, const Real gearing, const Period lookback, Real cap, Real floor, const bool localCapFloor, const bool nakedOption, const Time t, const RandomVariable &x) const
RandomVariable averagedBmaRate(const QuantLib::ext::shared_ptr< BMAIndex > &index, const std::vector< Date > &fixingDates, const Date &accrualStartDate, const Date &accrualEndDate, const bool includeSpread, const Real spread, const Real gearing, Real cap, Real floor, const bool nakedOption, const Time t, const RandomVariable &x) const
RandomVariable numeraire(const Time t, const RandomVariable &x, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >()) const
RandomVariable discountBondOption(Option::Type type, const Real K, const Time t, const Time S, const Time T, const RandomVariable &x, const Handle< YieldTermStructure > &discountCurve) const
RandomVariable fixing(const QuantLib::ext::shared_ptr< InterestRateIndex > &index, const Date &fixingDate, const Time t, const RandomVariable &x) const
RandomVariable reducedDiscountBond(const Time t, const Time T, const RandomVariable &x, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >()) const
RandomVariable compoundedOnRate(const QuantLib::ext::shared_ptr< OvernightIndex > &index, const std::vector< Date > &fixingDates, const std::vector< Date > &valueDates, const std::vector< Real > &dt, const Natural rateCutoff, const bool includeSpread, const Real spread, const Real gearing, const Period lookback, Real cap, Real floor, const bool localCapFloor, const bool nakedOption, const Time t, const RandomVariable &x) const
RandomVariable subPeriodsRate(const QuantLib::ext::shared_ptr< InterestRateIndex > &index, const std::vector< Date > &fixingDates, const Time t, const RandomVariable &x) const
Interest Rate Linear Gaussian Markov 1 factor parametrization.