1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
Copyright (C) 2003, 2004, 2005, 2006, 2007 StatPro Italia srl
Copyright (C) 2006, 2008 Ferdinando Ametrano
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<https://www.quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
/*! \file vanillaswap.hpp
\brief Simple fixed-rate vs Libor swap
*/
#ifndef quantlib_vanilla_swap_hpp
#define quantlib_vanilla_swap_hpp
#include <ql/instruments/fixedvsfloatingswap.hpp>
#include <ql/time/daycounter.hpp>
#include <ql/time/schedule.hpp>
#include <ql/optional.hpp>
namespace QuantLib {
class IborIndex;
//! Plain-vanilla swap: fix vs ibor leg
/*! \ingroup instruments
If no payment convention is passed, the convention of the
floating-rate schedule is used.
\warning if <tt>Settings::includeReferenceDateCashFlows()</tt>
is set to <tt>true</tt>, payments occurring at the
settlement date of the swap might be included in the
NPV and therefore affect the fair-rate and
fair-spread calculation. This might not be what you
want.
\test
- the correctness of the returned value is tested by checking
that the price of a swap paying the fair fixed rate is null.
- the correctness of the returned value is tested by checking
that the price of a swap receiving the fair floating-rate
spread is null.
- the correctness of the returned value is tested by checking
that the price of a swap decreases with the paid fixed rate.
- the correctness of the returned value is tested by checking
that the price of a swap increases with the received
floating-rate spread.
- the correctness of the returned value is tested by checking
it against a known good value.
*/
class VanillaSwap : public FixedVsFloatingSwap {
public:
VanillaSwap(Type type,
Real nominal,
Schedule fixedSchedule,
Rate fixedRate,
DayCounter fixedDayCount,
Schedule floatSchedule,
ext::shared_ptr<IborIndex> iborIndex,
Spread spread,
DayCounter floatingDayCount,
ext::optional<BusinessDayConvention> paymentConvention = ext::nullopt,
ext::optional<bool> useIndexedCoupons = ext::nullopt);
private:
void setupFloatingArguments(arguments* args) const override;
};
}
#endif
|