Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
makeaverageois.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 makeaverageois.hpp
20 \brief Helper class to instantiate standard average ON indexed swaps.
21
22 \ingroup instruments
23*/
24
25#ifndef quantext_make_average_ois_hpp
26#define quantext_make_average_ois_hpp
27
29
30namespace QuantExt {
31using namespace QuantLib;
32
33//! helper class
34/*! This class provides a more comfortable way to instantiate standard
35 average ON indexed swaps.
36
37 \ingroup instruments
38*/
40public:
41 MakeAverageOIS(const Period& swapTenor, const QuantLib::ext::shared_ptr<OvernightIndex>& overnightIndex,
42 const Period& onTenor, Rate fixedRate, const Period& fixedTenor, const DayCounter& fixedDayCounter,
43 const Period& spotLagTenor = 2 * Days, const Period& forwardStart = 0 * Days);
44
45 operator AverageOIS() const;
46 operator QuantLib::ext::shared_ptr<AverageOIS>() const;
47
48 // Swap.
51 MakeAverageOIS& withNominal(Real nominal);
52 MakeAverageOIS& withEffectiveDate(const Date& effectiveDate);
53 MakeAverageOIS& withTerminationDate(const Date& terminationDate);
54 MakeAverageOIS& withRule(DateGeneration::Rule rule);
55 MakeAverageOIS& withSpotLagCalendar(const Calendar& spotLagCalendar);
56
57 // Fixed Leg.
58 MakeAverageOIS& withFixedCalendar(const Calendar& fixedCalendar);
59 MakeAverageOIS& withFixedConvention(BusinessDayConvention fixedConvention);
60 MakeAverageOIS& withFixedTerminationDateConvention(BusinessDayConvention fixedTerminationDateConvention);
61 MakeAverageOIS& withFixedRule(DateGeneration::Rule fixedRule);
62 MakeAverageOIS& withFixedEndOfMonth(bool fixedEndOfMonth = false);
63 MakeAverageOIS& withFixedFirstDate(const Date& fixedFirstDate);
64 MakeAverageOIS& withFixedNextToLastDate(const Date& fixedNextToLastDate);
65 MakeAverageOIS& withFixedPaymentAdjustment(BusinessDayConvention fixedPaymentAdjustment);
66 MakeAverageOIS& withFixedPaymentCalendar(const Calendar& fixedPaymentCalendar);
67
68 // ON Leg.
69 MakeAverageOIS& withONCalendar(const Calendar& onCalendar);
70 MakeAverageOIS& withONConvention(BusinessDayConvention onConvention);
71 MakeAverageOIS& withONTerminationDateConvention(BusinessDayConvention onTerminationDateConvention);
72 MakeAverageOIS& withONRule(DateGeneration::Rule onRule);
73 MakeAverageOIS& withONEndOfMonth(bool onEndOfMonth = false);
74 MakeAverageOIS& withONFirstDate(const Date& onFirstDate);
75 MakeAverageOIS& withONNextToLastDate(const Date& onNextToLastDate);
76 MakeAverageOIS& withRateCutoff(Natural rateCutoff);
77 MakeAverageOIS& withONSpread(Spread onSpread);
78 MakeAverageOIS& withONGearing(Real onGearing);
79 MakeAverageOIS& withONDayCounter(const DayCounter& onDayCounter);
80 MakeAverageOIS& withONPaymentAdjustment(BusinessDayConvention onPaymentAdjustment);
81 MakeAverageOIS& withONPaymentCalendar(const Calendar& onPaymentCalendar);
82 MakeAverageOIS &withTelescopicValueDates(bool telescopicValueDates);
83
84 // Pricing.
85 MakeAverageOIS& withONCouponPricer(const QuantLib::ext::shared_ptr<AverageONIndexedCouponPricer>& onCouponPricer);
86 MakeAverageOIS& withDiscountingTermStructure(const Handle<YieldTermStructure>& discountCurve);
87 MakeAverageOIS& withPricingEngine(const QuantLib::ext::shared_ptr<PricingEngine>& engine);
88
89private:
90 Period swapTenor_;
91 QuantLib::ext::shared_ptr<OvernightIndex> overnightIndex_;
92 Period onTenor_;
95 DayCounter fixedDayCounter_;
98
104
106 BusinessDayConvention fixedConvention_;
107 BusinessDayConvention fixedTerminationDateConvention_;
108 DateGeneration::Rule fixedRule_;
112 BusinessDayConvention fixedPaymentAdjustment_;
114
115 Calendar onCalendar_;
116 BusinessDayConvention onConvention_;
117 BusinessDayConvention onTerminationDateConvention_;
118 DateGeneration::Rule onRule_;
122 Natural rateCutoff_;
123 Spread onSpread_;
125 DayCounter onDayCounter_;
126 BusinessDayConvention onPaymentAdjustment_;
129
130 QuantLib::ext::shared_ptr<PricingEngine> engine_;
131 QuantLib::ext::shared_ptr<AverageONIndexedCouponPricer> onCouponPricer_;
132};
133} // namespace QuantExt
134
135#endif
Swap of arithmetic average overnight index against fixed.
Average overnight index swap.
Definition: averageois.hpp:46
Type
Receiver (Payer) means receive (pay) fixed.
Definition: averageois.hpp:49
BusinessDayConvention fixedConvention_
MakeAverageOIS & withONCalendar(const Calendar &onCalendar)
QuantLib::ext::shared_ptr< OvernightIndex > overnightIndex_
MakeAverageOIS & withFixedConvention(BusinessDayConvention fixedConvention)
BusinessDayConvention fixedPaymentAdjustment_
MakeAverageOIS & withFixedPaymentCalendar(const Calendar &fixedPaymentCalendar)
MakeAverageOIS & withTelescopicValueDates(bool telescopicValueDates)
MakeAverageOIS & withONRule(DateGeneration::Rule onRule)
MakeAverageOIS & withONNextToLastDate(const Date &onNextToLastDate)
MakeAverageOIS & receiveFixed(bool receiveFixed=true)
MakeAverageOIS & withRateCutoff(Natural rateCutoff)
MakeAverageOIS & withRule(DateGeneration::Rule rule)
BusinessDayConvention onPaymentAdjustment_
MakeAverageOIS & withONGearing(Real onGearing)
MakeAverageOIS & withONSpread(Spread onSpread)
MakeAverageOIS & withONFirstDate(const Date &onFirstDate)
MakeAverageOIS & withType(AverageOIS::Type type)
QuantLib::ext::shared_ptr< AverageONIndexedCouponPricer > onCouponPricer_
MakeAverageOIS & withFixedRule(DateGeneration::Rule fixedRule)
QuantLib::ext::shared_ptr< PricingEngine > engine_
MakeAverageOIS & withFixedPaymentAdjustment(BusinessDayConvention fixedPaymentAdjustment)
BusinessDayConvention onTerminationDateConvention_
MakeAverageOIS & withONDayCounter(const DayCounter &onDayCounter)
MakeAverageOIS & withFixedFirstDate(const Date &fixedFirstDate)
MakeAverageOIS & withONEndOfMonth(bool onEndOfMonth=false)
DateGeneration::Rule fixedRule_
DateGeneration::Rule onRule_
BusinessDayConvention onConvention_
MakeAverageOIS & withEffectiveDate(const Date &effectiveDate)
MakeAverageOIS & withONConvention(BusinessDayConvention onConvention)
MakeAverageOIS & withONPaymentAdjustment(BusinessDayConvention onPaymentAdjustment)
MakeAverageOIS & withFixedNextToLastDate(const Date &fixedNextToLastDate)
MakeAverageOIS & withFixedEndOfMonth(bool fixedEndOfMonth=false)
BusinessDayConvention fixedTerminationDateConvention_
MakeAverageOIS & withPricingEngine(const QuantLib::ext::shared_ptr< PricingEngine > &engine)
MakeAverageOIS & withONCouponPricer(const QuantLib::ext::shared_ptr< AverageONIndexedCouponPricer > &onCouponPricer)
MakeAverageOIS & withNominal(Real nominal)
MakeAverageOIS & withTerminationDate(const Date &terminationDate)
MakeAverageOIS & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountCurve)
MakeAverageOIS & withFixedTerminationDateConvention(BusinessDayConvention fixedTerminationDateConvention)
MakeAverageOIS & withSpotLagCalendar(const Calendar &spotLagCalendar)
MakeAverageOIS & withONPaymentCalendar(const Calendar &onPaymentCalendar)
MakeAverageOIS & withONTerminationDateConvention(BusinessDayConvention onTerminationDateConvention)
MakeAverageOIS & withFixedCalendar(const Calendar &fixedCalendar)