Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
payment.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 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
20
21#include <ql/cashflows/fixedratecoupon.hpp>
22#include <ql/cashflows/simplecashflow.hpp>
23
24#include <boost/make_shared.hpp>
25
26using namespace QuantLib;
27
28namespace QuantExt {
29
30Payment::Payment(const Real amount, const Currency& currency, const Date& date)
31 : currency_(currency) {
32 cashflow_ = QuantLib::ext::make_shared<SimpleCashFlow>(amount, date);
33}
34
35bool Payment::isExpired() const { return cashflow_->hasOccurred(); }
36
37void Payment::setupExpired() const { Instrument::setupExpired(); }
38
40 Payment::arguments* arguments = dynamic_cast<Payment::arguments*>(args);
41 QL_REQUIRE(arguments, "wrong argument type in deposit");
44}
45
46void Payment::fetchResults(const PricingEngine::results* r) const {
47 Instrument::fetchResults(r);
48 const Payment::results* results = dynamic_cast<const Payment::results*>(r);
49 QL_REQUIRE(results, "wrong result type");
50}
51
53 // always valid
54}
55
56void Payment::results::reset() { Instrument::results::reset(); }
57} // namespace QuantExt
QuantLib::ext::shared_ptr< SimpleCashFlow > cashflow
Definition: payment.hpp:75
void validate() const override
Definition: payment.cpp:52
void reset() override
Definition: payment.cpp:56
void setupArguments(PricingEngine::arguments *) const override
Definition: payment.cpp:39
bool isExpired() const override
Definition: payment.cpp:35
Currency currency_
Definition: payment.hpp:68
Payment(const Real amount, const Currency &currency, const Date &date)
Definition: payment.cpp:30
void setupExpired() const override
Definition: payment.cpp:37
void fetchResults(const PricingEngine::results *) const override
Definition: payment.cpp:46
QuantLib::ext::shared_ptr< SimpleCashFlow > cashflow_
Definition: payment.hpp:69
payment instrument