26 const Size legNo,
const std::string& cashflowType,
const Size slot) {
31 for (Size i = 0; i <
slots_.size(); ++i) {
41 Size idx = Null<Size>();
42 for (Size i = 0; i <
slots_.size(); ++i) {
50 if (idx == Null<Size>()) {
70 std::set<std::tuple<Size, Date, std::string, std::string, Size>>
dates;
71 for (Size i = 0; i <
slots_.size(); ++i) {
77 std::vector<Date> resultDates;
78 std::vector<std::string> resultCurrencies;
79 std::vector<Size> resultLegNos;
80 std::vector<std::string> resultCashflowTypes;
81 std::vector<RandomVariable> resultAmounts;
82 Date lastDate = Null<Date>();
83 std::string lastCurrency;
84 Size lastLegNo = Null<Size>();
85 std::string lastCashflowType;
86 for (
auto const& d :
dates) {
87 if (std::get<1>(d) == lastDate && std::get<2>(d) == lastCurrency && std::get<0>(d) == lastLegNo &&
88 std::get<3>(d) == lastCashflowType)
89 resultAmounts.back() +=
amounts_[std::get<4>(d)];
91 resultAmounts.push_back(
amounts_[std::get<4>(d)]);
92 resultDates.push_back(std::get<1>(d));
93 resultCurrencies.push_back(std::get<2>(d));
94 resultLegNos.push_back(std::get<0>(d));
95 resultCashflowTypes.push_back(std::get<3>(d));
97 lastDate = std::get<1>(d);
98 lastCurrency = std::get<2>(d);
99 lastLegNo = std::get<0>(d);
100 lastCashflowType = std::get<3>(d);
105 amounts_ = std::move(resultAmounts);
106 dates_ = std::move(resultDates);
108 legNos_ = std::move(resultLegNos);
std::vector< std::string > cashflowTypes_
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)
std::vector< Size > slots_
std::vector< Date > dates_
const std::vector< Date > & dates() const
void consolidateAndSort()
std::vector< RandomVariable > amounts_
std::vector< Size > legNos_
std::vector< std::string > currencies_
SafeStack< ValueType > value
SafeStack< Filter > filter
RandomVariable applyInverseFilter(RandomVariable x, const Filter &f)
RandomVariable applyFilter(RandomVariable x, const Filter &f)
Serializable Credit Default Swap.
repository for cashflows generated by the PAYLOG() function