Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
paylog.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 ored/scripting/paylog.hpp
20 \brief repository for cashflows generated by the PAYLOG() function
21 \ingroup scripting
22*/
23
24#pragma once
25
27
28#include <ql/time/date.hpp>
29
30namespace ore {
31namespace data {
32
33using namespace QuantLib;
34using namespace QuantExt;
35
36class PayLog {
37public:
38 // write to log, if slot > 0 overwrite existing entry with same slot, otherwise add to existing results
39 void write(RandomVariable value, const Filter& filter, const Date& obs, const Date& pay, const std::string& ccy,
40 const Size legNo, const std::string& cashflowType, const Size slot = 0);
41
42 // group amounts and sort in ascending order using the key (legNo, pay date, pay ccy, cfType)
43 void consolidateAndSort();
44
45 // read from log, the vectors are guaranteed to have all the same length size()
46 Size size() const { return slots_.size(); }
47 const std::vector<RandomVariable>& amounts() const { return amounts_; }
48 const std::vector<Date>& dates() const { return dates_; }
49 const std::vector<std::string>& currencies() const { return currencies_; }
50 const std::vector<Size>& legNos() const { return legNos_; }
51 const std::vector<std::string>& cashflowTypes() const { return cashflowTypes_; }
52
53private:
54 std::vector<Size> slots_;
55 std::vector<RandomVariable> amounts_;
56 std::vector<Date> dates_;
57 std::vector<std::string> currencies_;
58 std::vector<Size> legNos_;
59 std::vector<std::string> cashflowTypes_;
60};
61
62} // namespace data
63} // namespace ore
std::vector< std::string > cashflowTypes_
Definition: paylog.hpp:59
void write(RandomVariable value, const Filter &filter, const Date &obs, const Date &pay, const std::string &ccy, const Size legNo, const std::string &cashflowType, const Size slot=0)
Definition: paylog.cpp:25
const std::vector< std::string > & currencies() const
Definition: paylog.hpp:49
std::vector< Size > slots_
Definition: paylog.hpp:54
std::vector< Date > dates_
Definition: paylog.hpp:56
const std::vector< Date > & dates() const
Definition: paylog.hpp:48
const std::vector< RandomVariable > & amounts() const
Definition: paylog.hpp:47
Size size() const
Definition: paylog.hpp:46
void consolidateAndSort()
Definition: paylog.cpp:65
std::vector< RandomVariable > amounts_
Definition: paylog.hpp:55
std::vector< Size > legNos_
Definition: paylog.hpp:58
std::vector< std::string > currencies_
Definition: paylog.hpp:57
const std::vector< std::string > & cashflowTypes() const
Definition: paylog.hpp:51
const std::vector< Size > & legNos() const
Definition: paylog.hpp:50
SafeStack< ValueType > value
SafeStack< Filter > filter
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23