21#include <ql/cashflows/fixedratecoupon.hpp>
22#include <ql/cashflows/simplecashflow.hpp>
24#include <boost/make_shared.hpp>
30Deposit::Deposit(
const Real nominal,
const Rate rate,
const Period& tenor,
const Natural fixingDays,
31 const Calendar& calendar,
const BusinessDayConvention convention,
const bool endOfMonth,
32 const DayCounter& dayCounter,
const Date& tradeDate,
const bool isLong,
const Period forwardStart) {
35 index_ = QuantLib::ext::make_shared<IborIndex>(
"deposit-helper-index", tenor, fixingDays, Currency(), calendar, convention,
36 endOfMonth, dayCounter);
38 Date referenceDate = calendar.adjust(tradeDate);
42 Real w = isLong ? 1.0 : -1.0;
43 leg_[0] = QuantLib::ext::make_shared<Redemption>(-w * nominal,
startDate_);
52 Instrument::setupExpired();
59 QL_REQUIRE(
arguments,
"wrong argument type in deposit");
67 Instrument::fetchResults(r);
69 QL_REQUIRE(
results,
"wrong result type");
74 QL_REQUIRE(
leg.size() == 3,
75 "deposit arguments: unexpected number of cash flows (" <<
leg.size() <<
"), should be 3");
80 Instrument::results::reset();
QuantLib::ext::shared_ptr< IborIndex > index
void validate() const override
void setupArguments(PricingEngine::arguments *) const override
bool isExpired() const override
QuantLib::ext::shared_ptr< IborIndex > index_
Deposit(const Real nominal, const Rate rate, const Period &tenor, const Natural fixingDays, const Calendar &calendar, const BusinessDayConvention convention, const bool endOfMonth, const DayCounter &dayCounter, const Date &tradeDate, const bool isLong=true, const Period forwardStart=0 *Days)
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override