Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
legdata.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 portfolio/legdata.hpp
20 \brief leg data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
26#include <boost/make_shared.hpp>
35
36#include <ql/cashflow.hpp>
37#include <ql/experimental/coupons/swapspreadindex.hpp>
38#include <ql/indexes/iborindex.hpp>
39#include <ql/position.hpp>
43
44#include <vector>
45
46namespace ore {
47namespace data {
48using namespace QuantLib;
50using std::string;
51
52class EngineFactory;
53class Market;
54class RequiredFixings;
55class ReferenceDataManager;
56
57//! Serializable Additional Leg Data
58/*!
59\ingroup tradedata
60*/
61
62// Really bad name....
64public:
65 LegAdditionalData(const string& legType, const string& legNodeName)
67 LegAdditionalData(const string& legType) : legType_(legType), legNodeName_(legType + "LegData") {}
68
69 const string& legType() const { return legType_; }
70 const string& legNodeName() const { return legNodeName_; }
71 const std::set<std::string>& indices() const { return indices_; }
72
73protected:
74 /*! Store the set of ORE index names that appear on this leg.
75 Should be populated by derived classes.
76 */
77 std::set<std::string> indices_;
78
79private:
80 string legType_;
81 string legNodeName_; // the XML node name
82};
83
84//! Serializable Cashflow Leg Data
85/*!
86 \ingroup tradedata
87*/
88
90public:
91 //! Default constructor
92 CashflowData() : LegAdditionalData("Cashflow", "CashflowData") {}
93 //! Constructor
94 CashflowData(const vector<double>& amounts, const vector<string>& dates)
95 : LegAdditionalData("Cashflow", "CashflowData"), amounts_(amounts), dates_(dates) {}
96
97 //! \name Inspectors
98 //@{
99 const vector<double>& amounts() const { return amounts_; }
100 const vector<string>& dates() const { return dates_; }
101 //@}
102
103 //! \name Serialisation
104 //@{
105 void fromXML(XMLNode* node) override;
106 XMLNode* toXML(XMLDocument& doc) const override;
107 //@}
108private:
109 vector<double> amounts_;
110 vector<string> dates_;
111};
112
113//! Serializable Fixed Leg Data
114/*!
115 \ingroup tradedata
116*/
118public:
119 //! Default constructor
121 //! Constructor
122 FixedLegData(const vector<double>& rates, const vector<string>& rateDates = vector<string>())
124
125 //! \name Inspectors
126 //@{
127 const vector<double>& rates() const { return rates_; }
128 const vector<string>& rateDates() const { return rateDates_; }
129 //@}
130
131 //! \name Serialisation
132 //@{
133 virtual void fromXML(XMLNode* node) override;
134 virtual XMLNode* toXML(XMLDocument& doc) const override;
135 //@}
136private:
137 vector<double> rates_;
138 vector<string> rateDates_;
139};
140
141//! Serializable Fixed Leg Data
142/*!
143 \ingroup tradedata
144*/
146public:
147 //! Default constructor
149 //! Constructor
150 ZeroCouponFixedLegData(const vector<double>& rates, const vector<string>& rateDates = vector<string>(),
151 const string& compounding = "Compounded", const bool subtractNotional = true)
154
155 //! \name Inspectors
156 //@{
157 const vector<double>& rates() const { return rates_; }
158 const vector<string>& rateDates() const { return rateDates_; }
159 const string& compounding() const { return compounding_; }
160 const bool& subtractNotional() const { return subtractNotional_; }
161 //@}
162
163 //! \name Serialisation
164 //@{
165 virtual void fromXML(XMLNode* node) override;
166 virtual XMLNode* toXML(XMLDocument& doc) const override;
167 //@}
168private:
169 vector<double> rates_;
170 vector<string> rateDates_;
173};
174
175//! Serializable Floating Leg Data
176/*!
177 \ingroup tradedata
178*/
180public:
181 //! Default constructor
183 //! Constructor
184 FloatingLegData(const string& index, QuantLib::Size fixingDays, bool isInArrears, const vector<double>& spreads,
185 const vector<string>& spreadDates = vector<string>(), const vector<double>& caps = vector<double>(),
186 const vector<string>& capDates = vector<string>(), const vector<double>& floors = vector<double>(),
187 const vector<string>& floorDates = vector<string>(),
188 const vector<double>& gearings = vector<double>(),
189 const vector<string>& gearingDates = vector<string>(), bool isAveraged = false,
190 bool nakedOption = false, bool hasSubPeriods = false, bool includeSpread = false,
191 QuantLib::Period lookback = 0 * Days, const Size rateCutoff = Null<Size>(),
192 bool localCapFloor = false, const boost::optional<Period>& lastRecentPeriod = boost::none,
193 const std::string& lastRecentPeriodCalendar = std::string(), bool telescopicValueDates = false,
194 const std::map<QuantLib::Date, double>& historicalFixings = {})
202 indices_.insert(index_);
203 }
204
205 //! \name Inspectors
206 //@{
207 const string& index() const { return index_; }
208 QuantLib::Size fixingDays() const { return fixingDays_; }
209 QuantLib::Period lookback() const { return lookback_; }
210 QuantLib::Size rateCutoff() const { return rateCutoff_; }
211 boost::optional<bool> isInArrears() const { return isInArrears_; }
212 bool isAveraged() const { return isAveraged_; }
213 bool hasSubPeriods() const { return hasSubPeriods_; }
214 bool includeSpread() const { return includeSpread_; }
215 const vector<double>& spreads() const { return spreads_; }
216 const vector<string>& spreadDates() const { return spreadDates_; }
217 const vector<double>& caps() const { return caps_; }
218 const vector<string>& capDates() const { return capDates_; }
219 const vector<double>& floors() const { return floors_; }
220 const vector<string>& floorDates() const { return floorDates_; }
221 const vector<double>& gearings() const { return gearings_; }
222 const vector<string>& gearingDates() const { return gearingDates_; }
223 bool nakedOption() const { return nakedOption_; }
224 bool localCapFloor() const { return localCapFloor_; }
225 const boost::optional<Period>& lastRecentPeriod() const { return lastRecentPeriod_; }
226 const std::string& lastRecentPeriodCalendar() const { return lastRecentPeriodCalendar_; }
230 const std::map<QuantLib::Date, double>& historicalFixings() const { return historicalFixings_; }
231 //@}
232
233 //! \name Modifiers
234 //@{
235 vector<double>& caps() { return caps_; }
236 vector<string>& capDates() { return capDates_; }
237 vector<double>& floors() { return floors_; }
238 vector<string>& floorDates() { return floorDates_; }
239 bool& nakedOption() { return nakedOption_; }
240 bool& localCapFloor() { return localCapFloor_; }
242 //@}
243
244 //! \name Serialisation
245 //@{
246 virtual void fromXML(XMLNode* node) override;
247 virtual XMLNode* toXML(XMLDocument& doc) const override;
248 //@}
249private:
250 string index_;
251 QuantLib::Size fixingDays_ = Null<Size>();
252 QuantLib::Period lookback_ = 0 * Days;
253 QuantLib::Size rateCutoff_ = Null<Size>();
254 boost::optional<bool> isInArrears_;
255 bool isAveraged_ = false;
256 bool hasSubPeriods_ = false;
257 bool includeSpread_ = false;
258 vector<double> spreads_;
259 vector<string> spreadDates_;
260 vector<double> caps_;
261 vector<string> capDates_;
262 vector<double> floors_;
263 vector<string> floorDates_;
264 vector<double> gearings_;
265 vector<string> gearingDates_;
266 bool nakedOption_ = false;
267 bool localCapFloor_ = false;
268 boost::optional<Period> lastRecentPeriod_;
273 std::map<QuantLib::Date, double> historicalFixings_;
274};
275
276//! Serializable CPI Leg Data
277/*!
278\ingroup tradedata
279*/
280
282public:
283 //! Default constructor
285 //! Constructor
286 CPILegData(string index, string startDate, double baseCPI, string observationLag, string interpolation,
287 const vector<double>& rates, const vector<string>& rateDates = std::vector<string>(),
288 bool subtractInflationNominal = true, const vector<double>& caps = vector<double>(),
289 const vector<string>& capDates = vector<string>(), const vector<double>& floors = vector<double>(),
290 const vector<string>& floorDates = vector<string>(), double finalFlowCap = Null<Real>(),
291 double finalFlowFloor = Null<Real>(), bool nakedOption = false,
298 indices_.insert(index_);
299 }
300
301 //! \name Inspectors
302 //@{
303 const string& index() const { return index_; }
304 const string& startDate() const { return startDate_; }
305 double baseCPI() const { return baseCPI_; }
306 const string& observationLag() const { return observationLag_; }
307 const string& interpolation() const { return interpolation_; }
308 const std::vector<double>& rates() const { return rates_; }
309 const std::vector<string>& rateDates() const { return rateDates_; }
311 const vector<double>& caps() const { return caps_; }
312 const vector<string>& capDates() const { return capDates_; }
313 const vector<double>& floors() const { return floors_; }
314 const vector<string>& floorDates() const { return floorDates_; }
315 double finalFlowCap() const { return finalFlowCap_; }
316 double finalFlowFloor() const { return finalFlowFloor_; }
317 bool nakedOption() const { return nakedOption_; }
319 //@}
320
321 //! \name Serialisation
322 //@{
323 virtual void fromXML(XMLNode* node) override;
324 virtual XMLNode* toXML(XMLDocument& doc) const override;
325 //@}
326private:
327 string index_;
329 double baseCPI_;
332 vector<double> rates_;
333 vector<string> rateDates_;
335 vector<double> caps_;
336 vector<string> capDates_;
337 vector<double> floors_;
338 vector<string> floorDates_;
343};
344
345//! Serializable YoY Leg Data
346/*!
347\ingroup tradedata
348*/
350public:
351 //! Default constructor
353 //! Constructor
355 const vector<double>& gearings = std::vector<double>(),
356 const vector<string>& gearingDates = std::vector<string>(),
357 const vector<double>& spreads = std::vector<double>(),
358 const vector<string>& spreadDates = std::vector<string>(), const vector<double>& caps = vector<double>(),
359 const vector<string>& capDates = vector<string>(), const vector<double>& floors = vector<double>(),
360 const vector<string>& floorDates = vector<string>(), bool nakedOption = false,
361 bool addInflationNotional = false, bool irregularYoY = false)
366 indices_.insert(index_);
367 }
368
369 //! \name Inspectors
370 //@{
371 const string index() const { return index_; }
372 const string observationLag() const { return observationLag_; }
373 Size fixingDays() const { return fixingDays_; }
374 const std::vector<double>& gearings() const { return gearings_; }
375 const std::vector<string>& gearingDates() const { return gearingDates_; }
376 const std::vector<double>& spreads() const { return spreads_; }
377 const std::vector<string>& spreadDates() const { return spreadDates_; }
378 const vector<double>& caps() const { return caps_; }
379 const vector<string>& capDates() const { return capDates_; }
380 const vector<double>& floors() const { return floors_; }
381 const vector<string>& floorDates() const { return floorDates_; }
382 bool nakedOption() const { return nakedOption_; }
384 bool irregularYoY() const { return irregularYoY_; };
385 //@}
386
387 //! \name Serialisation
388 //@{
389 virtual void fromXML(XMLNode* node) override;
390 virtual XMLNode* toXML(XMLDocument& doc) const override;
391 //@}
392
393private:
394 string index_;
397 vector<double> gearings_;
398 vector<string> gearingDates_;
399 vector<double> spreads_;
400 vector<string> spreadDates_;
401 vector<double> caps_;
402 vector<string> capDates_;
403 vector<double> floors_;
404 vector<string> floorDates_;
408};
409
410//! Serializable CMS Leg Data
411/*!
412\ingroup tradedata
413*/
415public:
416 //! Default constructor
417 CMSLegData() : LegAdditionalData("CMS"), fixingDays_(Null<Size>()), isInArrears_(true), nakedOption_(false) {}
418 //! Constructor
419 CMSLegData(const string& swapIndex, Size fixingDays, bool isInArrears, const vector<double>& spreads,
420 const vector<string>& spreadDates = vector<string>(), const vector<double>& caps = vector<double>(),
421 const vector<string>& capDates = vector<string>(), const vector<double>& floors = vector<double>(),
422 const vector<string>& floorDates = vector<string>(), const vector<double>& gearings = vector<double>(),
423 const vector<string>& gearingDates = vector<string>(), bool nakedOption = false)
427 indices_.insert(swapIndex_);
428 }
429
430 //! \name Inspectors
431 //@{
432 const string& swapIndex() const { return swapIndex_; }
433 Size fixingDays() const { return fixingDays_; }
434 bool isInArrears() const { return isInArrears_; }
435 const vector<double>& spreads() const { return spreads_; }
436 const vector<string>& spreadDates() const { return spreadDates_; }
437 const vector<double>& caps() const { return caps_; }
438 const vector<string>& capDates() const { return capDates_; }
439 const vector<double>& floors() const { return floors_; }
440 const vector<string>& floorDates() const { return floorDates_; }
441 const vector<double>& gearings() const { return gearings_; }
442 const vector<string>& gearingDates() const { return gearingDates_; }
443 bool nakedOption() const { return nakedOption_; }
444 //@}
445
446 //! \name Modifiers
447 //@{
448 vector<double>& caps() { return caps_; }
449 vector<string>& capDates() { return capDates_; }
450 vector<double>& floors() { return floors_; }
451 vector<string>& floorDates() { return floorDates_; }
452 bool& nakedOption() { return nakedOption_; }
453 //@}
454
455 //! \name Serialisation
456 //@{
457 virtual void fromXML(XMLNode* node) override;
458 virtual XMLNode* toXML(XMLDocument& doc) const override;
459 //@}
460private:
464 vector<double> spreads_;
465 vector<string> spreadDates_;
466 vector<double> caps_;
467 vector<string> capDates_;
468 vector<double> floors_;
469 vector<string> floorDates_;
470 vector<double> gearings_;
471 vector<string> gearingDates_;
473};
474
475//! Serializable Digital CMS Leg Data
476/*!
477\ingroup tradedata
478*/
480public:
481 //! Default constructor
483 //! Constructor
484 DigitalCMSLegData(const QuantLib::ext::shared_ptr<CMSLegData>& underlying, Position::Type callPosition = Position::Long,
485 bool isCallATMIncluded = false, const vector<double> callStrikes = vector<double>(),
486 const vector<string> callStrikeDates = vector<string>(),
487 const vector<double> callPayoffs = vector<double>(),
488 const vector<string> callPayoffDates = vector<string>(),
489 Position::Type putPosition = Position::Long, bool isPutATMIncluded = false,
490 const vector<double> putStrikes = vector<double>(),
491 const vector<string> putStrikeDates = vector<string>(),
492 const vector<double> putPayoffs = vector<double>(),
493 const vector<string> putPayoffDates = vector<string>())
499 indices_ = underlying_->indices();
500 }
501
502 //! \name Inspectors
503 //@{
504 const QuantLib::ext::shared_ptr<CMSLegData>& underlying() const { return underlying_; }
505
506 const Position::Type callPosition() const { return callPosition_; }
507 const bool isCallATMIncluded() const { return isCallATMIncluded_; }
508 const vector<double> callStrikes() const { return callStrikes_; }
509 const vector<double> callPayoffs() const { return callPayoffs_; }
510 const vector<string> callStrikeDates() const { return callStrikeDates_; }
511 const vector<string> callPayoffDates() const { return callPayoffDates_; }
512
513 const Position::Type putPosition() const { return putPosition_; }
514 const bool isPutATMIncluded() const { return isPutATMIncluded_; }
515 const vector<double> putStrikes() const { return putStrikes_; }
516 const vector<double> putPayoffs() const { return putPayoffs_; }
517 const vector<string> putStrikeDates() const { return putStrikeDates_; }
518 const vector<string> putPayoffDates() const { return putPayoffDates_; }
519 //@}
520
521 //! \name Serialisation
522 //@{
523 virtual void fromXML(XMLNode* node) override;
524 virtual XMLNode* toXML(XMLDocument& doc) const override;
525 //@}
526private:
527 QuantLib::ext::shared_ptr<CMSLegData> underlying_;
528
529 Position::Type callPosition_;
531 vector<double> callStrikes_;
532 vector<string> callStrikeDates_;
533 vector<double> callPayoffs_;
534 vector<string> callPayoffDates_;
535
536 Position::Type putPosition_;
538 vector<double> putStrikes_;
539 vector<string> putStrikeDates_;
540 vector<double> putPayoffs_;
541 vector<string> putPayoffDates_;
542};
543
544//! Serializable CMS Spread Leg Data
545/*!
546\ingroup tradedata
547*/
549public:
550 //! Default constructor
552 : LegAdditionalData("CMSSpread"), fixingDays_(Null<Size>()), isInArrears_(false), nakedOption_(false) {}
553 //! Constructor
554 CMSSpreadLegData(const string& swapIndex1, const string& swapIndex2, Size fixingDays, bool isInArrears,
555 const vector<double>& spreads, const vector<string>& spreadDates = vector<string>(),
556 const vector<double>& caps = vector<double>(), const vector<string>& capDates = vector<string>(),
557 const vector<double>& floors = vector<double>(),
558 const vector<string>& floorDates = vector<string>(),
559 const vector<double>& gearings = vector<double>(),
560 const vector<string>& gearingDates = vector<string>(), bool nakedOption = false)
565 indices_.insert(swapIndex1_);
566 indices_.insert(swapIndex2_);
567 }
568
569 //! \name Inspectors
570 //@{
571 const string& swapIndex1() const { return swapIndex1_; }
572 const string& swapIndex2() const { return swapIndex2_; }
573 Size fixingDays() const { return fixingDays_; }
574 bool isInArrears() const { return isInArrears_; }
575 const vector<double>& spreads() const { return spreads_; }
576 const vector<string>& spreadDates() const { return spreadDates_; }
577 const vector<double>& caps() const { return caps_; }
578 const vector<string>& capDates() const { return capDates_; }
579 const vector<double>& floors() const { return floors_; }
580 const vector<string>& floorDates() const { return floorDates_; }
581 const vector<double>& gearings() const { return gearings_; }
582 const vector<string>& gearingDates() const { return gearingDates_; }
583 bool nakedOption() const { return nakedOption_; }
584 //@}
585
586 //! \name Modifiers
587 //@{
588 vector<double>& caps() { return caps_; }
589 vector<string>& capDates() { return capDates_; }
590 vector<double>& floors() { return floors_; }
591 vector<string>& floorDates() { return floorDates_; }
592 bool& nakedOption() { return nakedOption_; }
593 //@}
594
595 //! \name Serialisation
596 //@{
597 virtual void fromXML(XMLNode* node) override;
598 virtual XMLNode* toXML(XMLDocument& doc) const override;
599 //@}
600private:
605 vector<double> spreads_;
606 vector<string> spreadDates_;
607 vector<double> caps_;
608 vector<string> capDates_;
609 vector<double> floors_;
610 vector<string> floorDates_;
611 vector<double> gearings_;
612 vector<string> gearingDates_;
614};
615
616//! Serializable Digital CMS Spread Leg Data
617/*!
618\ingroup tradedata
619*/
621public:
622 //! Default constructor
624 //! Constructor
626 const QuantLib::ext::shared_ptr<CMSSpreadLegData>& underlying, Position::Type callPosition = Position::Long,
627 bool isCallATMIncluded = false, const vector<double> callStrikes = vector<double>(),
628 const vector<string> callStrikeDates = vector<string>(), const vector<double> callPayoffs = vector<double>(),
629 const vector<string> callPayoffDates = vector<string>(), Position::Type putPosition = Position::Long,
630 bool isPutATMIncluded = false, const vector<double> putStrikes = vector<double>(),
631 const vector<string> putStrikeDates = vector<string>(), const vector<double> putPayoffs = vector<double>(),
632 const vector<string> putPayoffDates = vector<string>())
638 indices_ = underlying_->indices();
639 }
640
641 //! \name Inspectors
642 //@{
643 const QuantLib::ext::shared_ptr<CMSSpreadLegData>& underlying() const { return underlying_; }
644
645 const Position::Type callPosition() const { return callPosition_; }
646 const bool isCallATMIncluded() const { return isCallATMIncluded_; }
647 const vector<double> callStrikes() const { return callStrikes_; }
648 const vector<double> callPayoffs() const { return callPayoffs_; }
649 const vector<string> callStrikeDates() const { return callStrikeDates_; }
650 const vector<string> callPayoffDates() const { return callPayoffDates_; }
651
652 const Position::Type putPosition() const { return putPosition_; }
653 const bool isPutATMIncluded() const { return isPutATMIncluded_; }
654 const vector<double> putStrikes() const { return putStrikes_; }
655 const vector<double> putPayoffs() const { return putPayoffs_; }
656 const vector<string> putStrikeDates() const { return putStrikeDates_; }
657 const vector<string> putPayoffDates() const { return putPayoffDates_; }
658 //@}
659
660 //! \name Serialisation
661 //@{
662 virtual void fromXML(XMLNode* node) override;
663 virtual XMLNode* toXML(XMLDocument& doc) const override;
664 //@}
665private:
666 QuantLib::ext::shared_ptr<CMSSpreadLegData> underlying_;
667
668 Position::Type callPosition_ = Position::Long;
669 bool isCallATMIncluded_ = false;
670 vector<double> callStrikes_;
671 vector<string> callStrikeDates_;
672 vector<double> callPayoffs_;
673 vector<string> callPayoffDates_;
674
675 Position::Type putPosition_ = Position::Long;
676 bool isPutATMIncluded_ = false;
677 vector<double> putStrikes_;
678 vector<string> putStrikeDates_;
679 vector<double> putPayoffs_;
680 vector<string> putPayoffDates_;
681};
682
683//! Serializable Constant Maturity Bond Yield Leg Data
684/*!
685\ingroup tradedata
686*/
688public:
689 //! Default constructor
690 CMBLegData() : LegAdditionalData("CMB"), fixingDays_(Null<Size>()), isInArrears_(true), nakedOption_(false) {}
691 //! Constructor
692 CMBLegData(const string& genericBond, bool hasCreditRisk, Size fixingDays, bool isInArrears, const vector<double>& spreads,
693 const vector<string>& spreadDates = vector<string>(), const vector<double>& caps = vector<double>(),
694 const vector<string>& capDates = vector<string>(), const vector<double>& floors = vector<double>(),
695 const vector<string>& floorDates = vector<string>(), const vector<double>& gearings = vector<double>(),
696 const vector<string>& gearingDates = vector<string>(), bool nakedOption = false)
700 //indices_.insert(swapIndex_);
701 }
702
703 //! \name Inspectors
704 //@{
705 const string& genericBond() const { return genericBond_; }
706 bool hasCreditRisk() const { return hasCreditRisk_; }
707 Size fixingDays() const { return fixingDays_; }
708 bool isInArrears() const { return isInArrears_; }
709 const vector<double>& spreads() const { return spreads_; }
710 const vector<string>& spreadDates() const { return spreadDates_; }
711 const vector<double>& caps() const { return caps_; }
712 const vector<string>& capDates() const { return capDates_; }
713 const vector<double>& floors() const { return floors_; }
714 const vector<string>& floorDates() const { return floorDates_; }
715 const vector<double>& gearings() const { return gearings_; }
716 const vector<string>& gearingDates() const { return gearingDates_; }
717 bool nakedOption() const { return nakedOption_; }
718 //@}
719
720 //! \name Modifiers
721 //@{
722 vector<double>& caps() { return caps_; }
723 vector<string>& capDates() { return capDates_; }
724 vector<double>& floors() { return floors_; }
725 vector<string>& floorDates() { return floorDates_; }
726 bool& nakedOption() { return nakedOption_; }
727 //@}
728
729 //! \name Serialisation
730 //@{
731 virtual void fromXML(XMLNode* node) override;
732 virtual XMLNode* toXML(XMLDocument& doc) const override;
733 //@}
734private:
739 vector<double> spreads_;
740 vector<string> spreadDates_;
741 vector<double> caps_;
742 vector<string> capDates_;
743 vector<double> floors_;
744 vector<string> floorDates_;
745 vector<double> gearings_;
746 vector<string> gearingDates_;
748};
749
750//! Serializable Fixed Leg Data
751/*!
752\ingroup tradedata
753*/
755public:
756 //! Default constructor
757 EquityLegData() : LegAdditionalData("Equity"), initialPrice_(Null<Real>()), quantity_(Null<Real>()) {}
758 //! Constructor
761 string eqCurrency = "", string fxIndex = "", Real quantity = Null<Real>(), string initialPriceCurrency = "")
766 indices_.insert("EQ-" + eqName());
767 }
768
769 //! \name Inspectors
770 //@{
772 string eqName() { return equityUnderlying_.name(); }
773 Real dividendFactor() const { return dividendFactor_; }
775 Real initialPrice() const { return initialPrice_; }
776 Natural fixingDays() const { return fixingDays_; }
778 const string& eqCurrency() const { return eqCurrency_; }
779 const string& fxIndex() const { return fxIndex_; }
780 bool notionalReset() const { return notionalReset_; }
781 Real quantity() const { return quantity_; } // might be null
782 const string& initialPriceCurrency() const { return initialPriceCurrency_; } // might be empty
783 //@}
784
785 //! \name Serialisation
786 //@{
787 virtual void fromXML(XMLNode* node) override;
788 virtual XMLNode* toXML(XMLDocument& doc) const override;
789 //@}
790private:
792 Real dividendFactor_ = 1.0;
795 bool notionalReset_ = false;
796 Natural fixingDays_ = 0;
798 string eqCurrency_ = "";
799 string fxIndex_ = "";
802};
803
804//! Serializable object holding amortization rules
806public:
807 AmortizationData() : value_(0.0), underflow_(false), initialized_(false) {}
808
809 AmortizationData(string type, double value, string startDate, string endDate, string frequency, bool underflow)
812 validate();
813 }
814
815 virtual void fromXML(XMLNode* node) override;
816 virtual XMLNode* toXML(XMLDocument& doc) const override;
817
818 //! FixedAmount, RelativeToInitialNotional, RelativeToPreviousNotional, Annuity
819 const string& type() const { return type_; }
820 //! Interpretation depending on type()
821 double value() const { return value_; }
822 //! Amortization start date
823 const string& startDate() const { return startDate_; }
824 //! Amortization end date
825 const string& endDate() const { return endDate_; }
826 //! Amortization frequency
827 const string& frequency() const { return frequency_; }
828 //! Allow amortization below zero notional if true
829 bool underflow() const { return underflow_; }
830 bool initialized() const { return initialized_; }
831
832private:
833 void validate() const;
834 string type_;
835 double value_;
837 string endDate_;
841};
842
843//! Serializable object holding leg data
844class LegData : public XMLSerializable {
845public:
846 //! Default constructor
848
849 //! Constructor with concrete leg data
850 LegData(const QuantLib::ext::shared_ptr<LegAdditionalData>& innerLegData, bool isPayer, const string& currency,
851 const ScheduleData& scheduleData = ScheduleData(), const string& dayCounter = "",
852 const std::vector<double>& notionals = std::vector<double>(),
853 const std::vector<string>& notionalDates = std::vector<string>(), const string& paymentConvention = "F",
854 const bool notionalInitialExchange = false, const bool notionalFinalExchange = false,
855 const bool notionalAmortizingExchange = false, const bool isNotResetXCCY = true,
856 const string& foreignCurrency = "", const double foreignAmount = 0, const string& fxIndex = "",
857 const std::vector<AmortizationData>& amortizationData = std::vector<AmortizationData>(),
858 const string& paymentLag = "", const string& notionalPaymentLag = "",
859 const std::string& paymentCalendar = "",
860 const std::vector<std::string>& paymentDates = std::vector<std::string>(),
861 const std::vector<Indexing>& indexing = {}, const bool indexingFromAssetLeg = false,
862 const string& lastPeriodDayCounter = "");
863
864 //! \name Serialisation
865 //@{
866 virtual void fromXML(XMLNode* node) override;
867 virtual XMLNode* toXML(XMLDocument& doc) const override;
868 //@}
869
870 //! \name Inspectors
871 //@{
872 bool isPayer() const { return isPayer_; }
873 const string& currency() const { return currency_; }
874 const ScheduleData& schedule() const { return schedule_; }
875 const vector<double>& notionals() const { return notionals_; }
876 const vector<string>& notionalDates() const { return notionalDates_; }
877 const string& dayCounter() const { return dayCounter_; }
878 const string& paymentConvention() const { return paymentConvention_; }
882 bool isNotResetXCCY() const { return isNotResetXCCY_; }
883 const string& foreignCurrency() const { return foreignCurrency_; }
884 double foreignAmount() const { return foreignAmount_; }
885 const string& fxIndex() const { return fxIndex_; }
886 const string& paymentLag() const { return paymentLag_; }
887 const string& notionalPaymentLag() const { return notionalPaymentLag_; }
888 const std::vector<AmortizationData>& amortizationData() const { return amortizationData_; }
889 const std::string& paymentCalendar() const { return paymentCalendar_; }
890 const string& legType() const { return concreteLegData_->legType(); }
891 QuantLib::ext::shared_ptr<LegAdditionalData> concreteLegData() const { return concreteLegData_; }
892 const std::set<std::string>& indices() const { return indices_; }
893 const std::vector<std::string>& paymentDates() const { return paymentDates_; }
894 const std::vector<Indexing>& indexing() const { return indexing_; }
895 const bool indexingFromAssetLeg() const { return indexingFromAssetLeg_; }
896 const string& lastPeriodDayCounter() const { return lastPeriodDayCounter_; }
899 //@}
900
901 //! \name modifiers
902 //@{
903 vector<double>& notionals() { return notionals_; }
905 vector<string>& notionalDates() { return notionalDates_; }
906 string& dayCounter() { return dayCounter_; }
907 bool& isPayer() { return isPayer_; }
908 QuantLib::ext::shared_ptr<LegAdditionalData>& concreteLegData() { return concreteLegData_; }
909 std::vector<Indexing>& indexing() { return indexing_; }
912 std::vector<std::string>& paymentDates() { return paymentDates_; }
915 //@}
916
917 virtual QuantLib::ext::shared_ptr<LegAdditionalData> initialiseConcreteLegData(const string&);
918
919protected:
920
921 /*! Store the set of ORE index names that appear on this leg.
922
923 Take the set appearing in LegAdditionalData::indices() and add on any appearing here. Currently, the only
924 possible extra index appearing at LegData level is \c fxIndex.
925 */
926 std::set<std::string> indices_;
927
928private:
929 QuantLib::ext::shared_ptr<LegAdditionalData> concreteLegData_;
930 bool isPayer_ = true;
931 string currency_;
932 string legType_;
935 vector<double> notionals_;
936 vector<string> notionalDates_;
941 bool isNotResetXCCY_ = true;
943 double foreignAmount_ = 0.0;
944 string fxIndex_;
945 std::vector<AmortizationData> amortizationData_;
947 std::string paymentCalendar_;
948 std::vector<std::string> paymentDates_;
949 std::vector<Indexing> indexing_;
954};
955
956//! \name Utilities for building QuantLib Legs
957//@{
958Leg makeFixedLeg(const LegData& data, const QuantLib::Date& openEndDateReplacement = Null<Date>());
959Leg makeZCFixedLeg(const LegData& data, const QuantLib::Date& openEndDateReplacement = Null<Date>());
960Leg makeIborLeg(const LegData& data, const QuantLib::ext::shared_ptr<IborIndex>& index,
961 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory, const bool attachPricer = true,
962 const QuantLib::Date& openEndDateReplacement = Null<Date>());
963Leg makeOISLeg(const LegData& data, const QuantLib::ext::shared_ptr<OvernightIndex>& index,
964 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory, const bool attachPricer = true,
965 const QuantLib::Date& openEndDateReplacement = Null<Date>());
966Leg makeBMALeg(const LegData& data, const QuantLib::ext::shared_ptr<QuantExt::BMAIndexWrapper>& indexWrapper,
967 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
968 const QuantLib::Date& openEndDateReplacement = Null<Date>());
969Leg makeSimpleLeg(const LegData& data);
970Leg makeNotionalLeg(const Leg& refLeg, const bool initNomFlow, const bool finalNomFlow, const bool amortNomFlow,
971 const QuantLib::Natural notionalPaymentLag, const BusinessDayConvention paymentConvention,
972 const Calendar paymentCalendar, const bool excludeIndexing = true);
973Leg makeCPILeg(const LegData& data, const QuantLib::ext::shared_ptr<ZeroInflationIndex>& index,
974 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
975 const QuantLib::Date& openEndDateReplacement = Null<Date>());
976Leg makeYoYLeg(const LegData& data, const QuantLib::ext::shared_ptr<InflationIndex>& index,
977 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
978 const QuantLib::Date& openEndDateReplacement = Null<Date>());
979Leg makeCMSLeg(const LegData& data, const QuantLib::ext::shared_ptr<QuantLib::SwapIndex>& swapindex,
980 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory, const bool attachPricer = true,
981 const QuantLib::Date& openEndDateReplacement = Null<Date>());
982Leg makeCMBLeg(const LegData& data,
983 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory, const bool attachPricer = true,
984 const QuantLib::Date& openEndDateReplacement = Null<Date>());
985Leg makeDigitalCMSLeg(const LegData& data, const QuantLib::ext::shared_ptr<QuantLib::SwapIndex>& swapIndex,
986 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory, const bool attachPricer = true,
987 const QuantLib::Date& openEndDateReplacement = Null<Date>());
988Leg makeCMSSpreadLeg(const LegData& data, const QuantLib::ext::shared_ptr<QuantLib::SwapSpreadIndex>& swapSpreadIndex,
989 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory, const bool attachPricer = true,
990 const QuantLib::Date& openEndDateReplacement = Null<Date>());
991Leg makeDigitalCMSSpreadLeg(const LegData& data, const QuantLib::ext::shared_ptr<QuantLib::SwapSpreadIndex>& swapSpreadIndex,
992 const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
993 const QuantLib::Date& openEndDateReplacement = Null<Date>());
994Leg makeEquityLeg(const LegData& data, const QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>& equityCurve,
995 const QuantLib::ext::shared_ptr<QuantExt::FxIndex>& fxIndex = nullptr,
996 const QuantLib::Date& openEndDateReplacement = Null<Date>());
997Real currentNotional(const Leg& leg);
998Real originalNotional(const Leg& leg);
999
1000std::string getCmbLegCreditRiskCurrency(const CMBLegData& ld, const QuantLib::ext::shared_ptr<ReferenceDataManager>& refData);
1001
1002std::pair<std::string, SimmCreditQualifierMapping>
1003getCmbLegCreditQualifierMapping(const CMBLegData& ld, const QuantLib::ext::shared_ptr<ReferenceDataManager>& refData,
1004 const std::string& tradeId, const std::string& tradeType);
1005//@}
1006
1007// Build a full vector of values from the given node.
1008// For use with Notionals, Rates, Spreads, Gearing, Caps and Floor rates.
1009// In all cases we can expand the vector to take the given schedule into account
1010// If checkAllValuesAppearInResult is true, we require that all input values are appearing in the result (in order)
1011template <typename T>
1012vector<T> buildScheduledVector(const vector<T>& values, const vector<string>& dates, const Schedule& schedule,
1013 const bool checkAllValuesAppearInResult = false);
1014
1015// extend values to schedule size (if values is empty, the default value is used)
1016template <typename T>
1017vector<T> normaliseToSchedule(const vector<T>& values, const Schedule& schedule, const T& defaultValue);
1018
1019// normaliseToSchedule concat buildScheduledVector
1020template <typename T>
1021vector<T> buildScheduledVectorNormalised(const vector<T>& values, const vector<string>& dates, const Schedule& schedule,
1022 const T& defaultValue, const bool checkAllValuesAppearInResult = false);
1023
1024/* returns an iterator to the first input value that is not appearing (in order) in the scheduled vector, or an iterator
1025 pointing to the end of the input value vector if no such element exists */
1026template <typename T>
1027typename vector<T>::const_iterator checkAllValuesAppearInScheduledVector(const vector<T>& scheduledVecotr,
1028 const vector<T>& inputValues);
1029
1030// notional vector derived from a fixed amortisation amount
1031vector<double> buildAmortizationScheduleFixedAmount(const vector<double>& notionals, const Schedule& schedule,
1032 const AmortizationData& data);
1033
1034// notional vector with amortizations expressed as a percentage of initial notional
1035vector<double> buildAmortizationScheduleRelativeToInitialNotional(const vector<double>& notionals,
1036 const Schedule& schedule,
1037 const AmortizationData& data);
1038
1039// notional vector with amortizations expressed as a percentage of the respective previous notional
1040vector<double> buildAmortizationScheduleRelativeToPreviousNotional(const vector<double>& notionals,
1041 const Schedule& schedule,
1042 const AmortizationData& data);
1043
1044// notional vector derived from a fixed annuity amount
1045vector<double> buildAmortizationScheduleFixedAnnuity(const vector<double>& notionals, const vector<double>& rates,
1046 const Schedule& schedule, const AmortizationData& data,
1047 const DayCounter& dc);
1048
1049// apply amortisation to given notionals
1050void applyAmortization(std::vector<Real>& notionals, const LegData& data, const Schedule& schedule,
1051 const bool annuityAllowed = false, const std::vector<Real>& rates = std::vector<Real>());
1052
1053// apply indexing (if given in LegData) to existing leg
1054void applyIndexing(Leg& leg, const LegData& data, const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
1055 RequiredFixings& requiredFixings, const QuantLib::Date& openEndDateReplacement = Null<Date>(),
1056 const bool useXbsCurves = false);
1057
1058// template implementations
1059
1060template <typename T>
1061vector<T> buildScheduledVector(const vector<T>& values, const vector<string>& dates, const Schedule& schedule,
1062 const bool checkAllValuesAppearInResult) {
1063 if (values.size() < 2 || dates.size() == 0)
1064 return values;
1065
1066 QL_REQUIRE(values.size() == dates.size(), "Value / Date size mismatch in buildScheduledVector."
1067 << "Value:" << values.size() << ", Dates:" << dates.size());
1068
1069 // parse the dates
1070 std::vector<QuantLib::Date> parsedDates;
1071 std::transform(dates.begin(), dates.end(), std::back_inserter(parsedDates), &parseDate);
1072
1073 // adjust the dates using the schedule calendar and roll convention
1074 if (!schedule.calendar().empty()) {
1075 for (auto& d : parsedDates)
1076 if(d != Date())
1077 d = schedule.calendar().adjust(d, schedule.businessDayConvention());
1078 }
1079
1080 // Need to use schedule logic
1081 // Length of data will be 1 less than schedule
1082 //
1083 // Notional 100
1084 // Notional {startDate 2015-01-01} 200
1085 // Notional {startDate 2016-01-01} 300
1086 //
1087 // Given schedule June, Dec from 2014 to 2016 (6 dates, 5 coupons)
1088 // we return 100, 100, 200, 200, 300
1089
1090 // The first node must not have a date.
1091 // If the second one has a date, all the rest must have, and we process
1092 // If the second one does not have a date, none of them must have one
1093 // and we return the vector unaffected.
1094 QL_REQUIRE(parsedDates.front() == Date(), "Invalid date " << dates.front() << " for first node");
1095 if (parsedDates[1] == Date()) {
1096 // They must all be empty and then we return values
1097 for (Size i = 2; i < dates.size(); i++) {
1098 QL_REQUIRE(parsedDates[i] == Date(), "Invalid date " << dates[i] << " for node " << i
1099 << ". Cannot mix dates and non-dates attributes");
1100 }
1101 return values;
1102 }
1103
1104 // We have nodes with date attributes now
1105 Size len = schedule.size() - 1;
1106 vector<T> data(len);
1107 Size j = 0, max_j = parsedDates.size() - 1; // j is the index of date/value vector. 0 to max_j
1108 Date d = parsedDates[j + 1]; // The first start date
1109 for (Size i = 0; i < len; i++) { // loop over data vector and populate it.
1110 // If j == max_j we just fall through and take the final value
1111 while (schedule[i] >= d && j < max_j) {
1112 j++;
1113 if (j < max_j) {
1114 QL_REQUIRE(parsedDates[j + 1] != Date(), "Cannot have empty date attribute for node " << j + 1);
1115 d = parsedDates[j + 1];
1116 }
1117 }
1118 data[i] = values[j];
1119 }
1120
1121 if (checkAllValuesAppearInResult) {
1122 auto it = checkAllValuesAppearInScheduledVector<T>(data, values);
1123 QL_REQUIRE(it == values.end(),
1124 "buildScheduledVector: input value '" << *it << " does not appear in the result vector");
1125 }
1126
1127 return data;
1128}
1129
1130template <typename T>
1131vector<T> normaliseToSchedule(const vector<T>& values, const Schedule& schedule, const T& defaultValue) {
1132 vector<T> res = values;
1133 if (res.size() < schedule.size() - 1)
1134 res.resize(schedule.size() - 1, res.size() == 0 ? defaultValue : res.back());
1135 return res;
1136}
1137
1138template <typename T>
1139vector<T> buildScheduledVectorNormalised(const vector<T>& values, const vector<string>& dates, const Schedule& schedule,
1140 const T& defaultValue, const bool checkAllValuesAppearInResult) {
1141 return normaliseToSchedule(buildScheduledVector(values, dates, schedule, checkAllValuesAppearInResult), schedule,
1142 defaultValue);
1143}
1144
1145template <typename T>
1146typename vector<T>::const_iterator checkAllValuesAppearInScheduledVector(const vector<T>& scheduledVector,
1147 const vector<T>& inputValues) {
1148 auto s = scheduledVector.begin();
1149 auto i = inputValues.begin();
1150 while (i != inputValues.end()) {
1151 if (s == scheduledVector.end())
1152 return i;
1153 if (*i == *s) {
1154 ++i;
1155 } else {
1156 ++s;
1157 }
1158 }
1159 return i;
1160}
1161
1162// join a vector of legs to a single leg, check if the legs have adjacent periods
1163Leg joinLegs(const std::vector<Leg>& legs);
1164
1165// build a notional leg for a given coupon leg, returns an empty Leg if not applicable
1166Leg buildNotionalLeg(const LegData& data, const Leg& leg, RequiredFixings& requiredFixings,
1167 const QuantLib::ext::shared_ptr<Market>& market, const std::string& configuration);
1168
1169} // namespace data
1170} // namespace ore
Serializable object holding amortization rules.
Definition: legdata.hpp:805
const string & endDate() const
Amortization end date.
Definition: legdata.hpp:825
double value() const
Interpretation depending on type()
Definition: legdata.hpp:821
const string & startDate() const
Amortization start date.
Definition: legdata.hpp:823
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:698
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:710
const string & type() const
FixedAmount, RelativeToInitialNotional, RelativeToPreviousNotional, Annuity.
Definition: legdata.hpp:819
AmortizationData(string type, double value, string startDate, string endDate, string frequency, bool underflow)
Definition: legdata.hpp:809
bool underflow() const
Allow amortization below zero notional if true.
Definition: legdata.hpp:829
const string & frequency() const
Amortization frequency.
Definition: legdata.hpp:827
Serializable Constant Maturity Bond Yield Leg Data.
Definition: legdata.hpp:687
const vector< double > & floors() const
Definition: legdata.hpp:713
bool hasCreditRisk() const
Definition: legdata.hpp:706
vector< string > gearingDates_
Definition: legdata.hpp:746
bool nakedOption() const
Definition: legdata.hpp:717
const vector< double > & spreads() const
Definition: legdata.hpp:709
vector< double > & floors()
Definition: legdata.hpp:724
vector< double > gearings_
Definition: legdata.hpp:745
vector< string > & floorDates()
Definition: legdata.hpp:725
const vector< string > & gearingDates() const
Definition: legdata.hpp:716
const string & genericBond() const
Definition: legdata.hpp:705
vector< double > floors_
Definition: legdata.hpp:743
vector< string > floorDates_
Definition: legdata.hpp:744
Size fixingDays() const
Definition: legdata.hpp:707
vector< double > & caps()
Definition: legdata.hpp:722
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:444
vector< double > spreads_
Definition: legdata.hpp:739
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:429
const vector< double > & caps() const
Definition: legdata.hpp:711
const vector< string > & spreadDates() const
Definition: legdata.hpp:710
const vector< string > & floorDates() const
Definition: legdata.hpp:714
CMBLegData()
Default constructor.
Definition: legdata.hpp:690
const vector< double > & gearings() const
Definition: legdata.hpp:715
vector< string > & capDates()
Definition: legdata.hpp:723
const vector< string > & capDates() const
Definition: legdata.hpp:712
vector< string > capDates_
Definition: legdata.hpp:742
vector< double > caps_
Definition: legdata.hpp:741
CMBLegData(const string &genericBond, bool hasCreditRisk, Size fixingDays, bool isInArrears, const vector< double > &spreads, const vector< string > &spreadDates=vector< string >(), const vector< double > &caps=vector< double >(), const vector< string > &capDates=vector< string >(), const vector< double > &floors=vector< double >(), const vector< string > &floorDates=vector< string >(), const vector< double > &gearings=vector< double >(), const vector< string > &gearingDates=vector< string >(), bool nakedOption=false)
Constructor.
Definition: legdata.hpp:692
vector< string > spreadDates_
Definition: legdata.hpp:740
bool isInArrears() const
Definition: legdata.hpp:708
Serializable CMS Leg Data.
Definition: legdata.hpp:414
const vector< double > & floors() const
Definition: legdata.hpp:439
vector< string > gearingDates_
Definition: legdata.hpp:471
bool nakedOption() const
Definition: legdata.hpp:443
const vector< double > & spreads() const
Definition: legdata.hpp:435
vector< double > & floors()
Definition: legdata.hpp:450
vector< double > gearings_
Definition: legdata.hpp:470
vector< string > & floorDates()
Definition: legdata.hpp:451
const vector< string > & gearingDates() const
Definition: legdata.hpp:442
vector< double > floors_
Definition: legdata.hpp:468
vector< string > floorDates_
Definition: legdata.hpp:469
Size fixingDays() const
Definition: legdata.hpp:433
CMSLegData(const string &swapIndex, Size fixingDays, bool isInArrears, const vector< double > &spreads, const vector< string > &spreadDates=vector< string >(), const vector< double > &caps=vector< double >(), const vector< string > &capDates=vector< string >(), const vector< double > &floors=vector< double >(), const vector< string > &floorDates=vector< string >(), const vector< double > &gearings=vector< double >(), const vector< string > &gearingDates=vector< string >(), bool nakedOption=false)
Constructor.
Definition: legdata.hpp:419
vector< double > & caps()
Definition: legdata.hpp:448
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:402
vector< double > spreads_
Definition: legdata.hpp:464
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:387
CMSLegData()
Default constructor.
Definition: legdata.hpp:417
const vector< double > & caps() const
Definition: legdata.hpp:437
const vector< string > & spreadDates() const
Definition: legdata.hpp:436
const vector< string > & floorDates() const
Definition: legdata.hpp:440
const vector< double > & gearings() const
Definition: legdata.hpp:441
vector< string > & capDates()
Definition: legdata.hpp:449
const vector< string > & capDates() const
Definition: legdata.hpp:438
vector< string > capDates_
Definition: legdata.hpp:467
vector< double > caps_
Definition: legdata.hpp:466
const string & swapIndex() const
Definition: legdata.hpp:432
vector< string > spreadDates_
Definition: legdata.hpp:465
bool isInArrears() const
Definition: legdata.hpp:434
Serializable CMS Spread Leg Data.
Definition: legdata.hpp:548
const vector< double > & floors() const
Definition: legdata.hpp:579
vector< string > gearingDates_
Definition: legdata.hpp:612
const vector< double > & spreads() const
Definition: legdata.hpp:575
vector< double > & floors()
Definition: legdata.hpp:590
vector< double > gearings_
Definition: legdata.hpp:611
CMSSpreadLegData()
Default constructor.
Definition: legdata.hpp:551
vector< string > & floorDates()
Definition: legdata.hpp:591
const vector< string > & gearingDates() const
Definition: legdata.hpp:582
vector< double > floors_
Definition: legdata.hpp:609
vector< string > floorDates_
Definition: legdata.hpp:610
vector< double > & caps()
Definition: legdata.hpp:588
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:539
vector< double > spreads_
Definition: legdata.hpp:605
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:523
const string & swapIndex1() const
Definition: legdata.hpp:571
const vector< double > & caps() const
Definition: legdata.hpp:577
const vector< string > & spreadDates() const
Definition: legdata.hpp:576
const vector< string > & floorDates() const
Definition: legdata.hpp:580
const vector< double > & gearings() const
Definition: legdata.hpp:581
vector< string > & capDates()
Definition: legdata.hpp:589
const vector< string > & capDates() const
Definition: legdata.hpp:578
vector< string > capDates_
Definition: legdata.hpp:608
vector< double > caps_
Definition: legdata.hpp:607
const string & swapIndex2() const
Definition: legdata.hpp:572
CMSSpreadLegData(const string &swapIndex1, const string &swapIndex2, Size fixingDays, bool isInArrears, const vector< double > &spreads, const vector< string > &spreadDates=vector< string >(), const vector< double > &caps=vector< double >(), const vector< string > &capDates=vector< string >(), const vector< double > &floors=vector< double >(), const vector< string > &floorDates=vector< string >(), const vector< double > &gearings=vector< double >(), const vector< string > &gearingDates=vector< string >(), bool nakedOption=false)
Constructor.
Definition: legdata.hpp:554
vector< string > spreadDates_
Definition: legdata.hpp:606
Serializable CPI Leg Data.
Definition: legdata.hpp:281
const vector< double > & floors() const
Definition: legdata.hpp:313
CPILegData()
Default constructor.
Definition: legdata.hpp:284
const string & observationLag() const
Definition: legdata.hpp:306
bool nakedOption() const
Definition: legdata.hpp:317
double finalFlowCap() const
Definition: legdata.hpp:315
const string & interpolation() const
Definition: legdata.hpp:307
const string & startDate() const
Definition: legdata.hpp:304
const std::vector< double > & rates() const
Definition: legdata.hpp:308
const string & index() const
Definition: legdata.hpp:303
CPILegData(string index, string startDate, double baseCPI, string observationLag, string interpolation, const vector< double > &rates, const vector< string > &rateDates=std::vector< string >(), bool subtractInflationNominal=true, const vector< double > &caps=vector< double >(), const vector< string > &capDates=vector< string >(), const vector< double > &floors=vector< double >(), const vector< string > &floorDates=vector< string >(), double finalFlowCap=Null< Real >(), double finalFlowFloor=Null< Real >(), bool nakedOption=false, bool subtractInflationNominalCoupons=false)
Constructor.
Definition: legdata.hpp:286
vector< double > floors_
Definition: legdata.hpp:337
vector< string > floorDates_
Definition: legdata.hpp:338
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:262
const std::vector< string > & rateDates() const
Definition: legdata.hpp:309
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:316
vector< string > rateDates_
Definition: legdata.hpp:333
const vector< double > & caps() const
Definition: legdata.hpp:311
bool subtractInflationNominalCoupons_
Definition: legdata.hpp:342
const vector< string > & floorDates() const
Definition: legdata.hpp:314
double baseCPI() const
Definition: legdata.hpp:305
const vector< string > & capDates() const
Definition: legdata.hpp:312
vector< string > capDates_
Definition: legdata.hpp:336
bool subtractInflationNominal() const
Definition: legdata.hpp:310
vector< double > caps_
Definition: legdata.hpp:335
vector< double > rates_
Definition: legdata.hpp:332
bool subtractInflationNominal_
Definition: legdata.hpp:334
double finalFlowFloor() const
Definition: legdata.hpp:316
bool subtractInflationNominalCoupons() const
Definition: legdata.hpp:318
Serializable Cashflow Leg Data.
Definition: legdata.hpp:89
vector< string > dates_
Definition: legdata.hpp:110
CashflowData(const vector< double > &amounts, const vector< string > &dates)
Constructor.
Definition: legdata.hpp:94
void fromXML(XMLNode *node) override
Definition: legdata.cpp:94
XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:107
vector< double > amounts_
Definition: legdata.hpp:109
const vector< string > & dates() const
Definition: legdata.hpp:100
const vector< double > & amounts() const
Definition: legdata.hpp:99
CashflowData()
Default constructor.
Definition: legdata.hpp:92
Serializable Digital CMS Leg Data.
Definition: legdata.hpp:479
Position::Type callPosition_
Definition: legdata.hpp:529
vector< double > callPayoffs_
Definition: legdata.hpp:533
const QuantLib::ext::shared_ptr< CMSLegData > & underlying() const
Definition: legdata.hpp:504
vector< double > callStrikes_
Definition: legdata.hpp:531
DigitalCMSLegData(const QuantLib::ext::shared_ptr< CMSLegData > &underlying, Position::Type callPosition=Position::Long, bool isCallATMIncluded=false, const vector< double > callStrikes=vector< double >(), const vector< string > callStrikeDates=vector< string >(), const vector< double > callPayoffs=vector< double >(), const vector< string > callPayoffDates=vector< string >(), Position::Type putPosition=Position::Long, bool isPutATMIncluded=false, const vector< double > putStrikes=vector< double >(), const vector< string > putStrikeDates=vector< string >(), const vector< double > putPayoffs=vector< double >(), const vector< string > putPayoffDates=vector< string >())
Constructor.
Definition: legdata.hpp:484
const Position::Type putPosition() const
Definition: legdata.hpp:513
Position::Type putPosition_
Definition: legdata.hpp:536
const vector< string > callStrikeDates() const
Definition: legdata.hpp:510
const bool isCallATMIncluded() const
Definition: legdata.hpp:507
vector< string > callStrikeDates_
Definition: legdata.hpp:532
const bool isPutATMIncluded() const
Definition: legdata.hpp:514
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:494
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:473
const vector< double > callPayoffs() const
Definition: legdata.hpp:509
vector< string > putPayoffDates_
Definition: legdata.hpp:541
QuantLib::ext::shared_ptr< CMSLegData > underlying_
Definition: legdata.hpp:527
const vector< string > callPayoffDates() const
Definition: legdata.hpp:511
const vector< double > putStrikes() const
Definition: legdata.hpp:515
vector< double > putPayoffs_
Definition: legdata.hpp:540
const vector< double > callStrikes() const
Definition: legdata.hpp:508
const vector< string > putPayoffDates() const
Definition: legdata.hpp:518
vector< string > putStrikeDates_
Definition: legdata.hpp:539
vector< string > callPayoffDates_
Definition: legdata.hpp:534
DigitalCMSLegData()
Default constructor.
Definition: legdata.hpp:482
const vector< string > putStrikeDates() const
Definition: legdata.hpp:517
vector< double > putStrikes_
Definition: legdata.hpp:538
const Position::Type callPosition() const
Definition: legdata.hpp:506
const vector< double > putPayoffs() const
Definition: legdata.hpp:516
Serializable Digital CMS Spread Leg Data.
Definition: legdata.hpp:620
const QuantLib::ext::shared_ptr< CMSSpreadLegData > & underlying() const
Definition: legdata.hpp:643
const Position::Type putPosition() const
Definition: legdata.hpp:652
const vector< string > callStrikeDates() const
Definition: legdata.hpp:649
const bool isCallATMIncluded() const
Definition: legdata.hpp:646
vector< string > callStrikeDates_
Definition: legdata.hpp:671
const bool isPutATMIncluded() const
Definition: legdata.hpp:653
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:589
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:568
const vector< double > callPayoffs() const
Definition: legdata.hpp:648
vector< string > putPayoffDates_
Definition: legdata.hpp:680
const vector< string > callPayoffDates() const
Definition: legdata.hpp:650
const vector< double > putStrikes() const
Definition: legdata.hpp:654
const vector< double > callStrikes() const
Definition: legdata.hpp:647
const vector< string > putPayoffDates() const
Definition: legdata.hpp:657
vector< string > putStrikeDates_
Definition: legdata.hpp:678
vector< string > callPayoffDates_
Definition: legdata.hpp:673
const vector< string > putStrikeDates() const
Definition: legdata.hpp:656
QuantLib::ext::shared_ptr< CMSSpreadLegData > underlying_
Definition: legdata.hpp:666
DigitalCMSSpreadLegData(const QuantLib::ext::shared_ptr< CMSSpreadLegData > &underlying, Position::Type callPosition=Position::Long, bool isCallATMIncluded=false, const vector< double > callStrikes=vector< double >(), const vector< string > callStrikeDates=vector< string >(), const vector< double > callPayoffs=vector< double >(), const vector< string > callPayoffDates=vector< string >(), Position::Type putPosition=Position::Long, bool isPutATMIncluded=false, const vector< double > putStrikes=vector< double >(), const vector< string > putStrikeDates=vector< string >(), const vector< double > putPayoffs=vector< double >(), const vector< string > putPayoffDates=vector< string >())
Constructor.
Definition: legdata.hpp:625
const Position::Type callPosition() const
Definition: legdata.hpp:645
const vector< double > putPayoffs() const
Definition: legdata.hpp:655
DigitalCMSSpreadLegData()
Default constructor.
Definition: legdata.hpp:623
Serializable Fixed Leg Data.
Definition: legdata.hpp:754
EquityReturnType returnType() const
Definition: legdata.hpp:771
ScheduleData valuationSchedule_
Definition: legdata.hpp:797
Natural fixingDays() const
Definition: legdata.hpp:776
EquityLegData()
Default constructor.
Definition: legdata.hpp:757
Real dividendFactor() const
Definition: legdata.hpp:773
EquityUnderlying equityIdentifier() const
Definition: legdata.hpp:774
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:618
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:665
EquityReturnType returnType_
Definition: legdata.hpp:791
const string & initialPriceCurrency() const
Definition: legdata.hpp:782
bool notionalReset() const
Definition: legdata.hpp:780
const string & eqCurrency() const
Definition: legdata.hpp:778
const string & fxIndex() const
Definition: legdata.hpp:779
EquityLegData(EquityReturnType returnType, Real dividendFactor, EquityUnderlying equityUnderlying, Real initialPrice, bool notionalReset, Natural fixingDays=0, const ScheduleData &valuationSchedule=ScheduleData(), string eqCurrency="", string fxIndex="", Real quantity=Null< Real >(), string initialPriceCurrency="")
Constructor.
Definition: legdata.hpp:759
Real quantity() const
Definition: legdata.hpp:781
EquityUnderlying equityUnderlying_
Definition: legdata.hpp:793
ScheduleData valuationSchedule() const
Definition: legdata.hpp:777
Real initialPrice() const
Definition: legdata.hpp:775
const std::string & name() const override
Definition: underlying.hpp:109
Serializable Fixed Leg Data.
Definition: legdata.hpp:117
FixedLegData(const vector< double > &rates, const vector< string > &rateDates=vector< string >())
Constructor.
Definition: legdata.hpp:122
FixedLegData()
Default constructor.
Definition: legdata.hpp:120
const vector< double > & rates() const
Definition: legdata.hpp:127
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:113
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:119
vector< string > rateDates_
Definition: legdata.hpp:138
const vector< string > & rateDates() const
Definition: legdata.hpp:128
vector< double > rates_
Definition: legdata.hpp:137
Serializable Floating Leg Data.
Definition: legdata.hpp:179
const vector< double > & floors() const
Definition: legdata.hpp:219
QuantLib::Period lookback() const
Definition: legdata.hpp:209
QuantLib::Size rateCutoff() const
Definition: legdata.hpp:210
FloatingLegData()
Default constructor.
Definition: legdata.hpp:182
const std::map< QuantLib::Date, double > & historicalFixings() const
Definition: legdata.hpp:230
vector< string > gearingDates_
Definition: legdata.hpp:265
std::map< QuantLib::Date, double > historicalFixings_
Definition: legdata.hpp:273
bool nakedOption() const
Definition: legdata.hpp:223
const vector< double > & spreads() const
Definition: legdata.hpp:215
QuantLib::Size fixingDays() const
Definition: legdata.hpp:208
bool includeSpread() const
Definition: legdata.hpp:214
vector< double > & floors()
Definition: legdata.hpp:237
vector< double > gearings_
Definition: legdata.hpp:264
vector< string > & floorDates()
Definition: legdata.hpp:238
ScheduleData resetSchedule_
Definition: legdata.hpp:272
ScheduleData fixingSchedule() const
Definition: legdata.hpp:228
const vector< string > & gearingDates() const
Definition: legdata.hpp:222
QuantLib::Size rateCutoff_
Definition: legdata.hpp:253
const string & index() const
Definition: legdata.hpp:207
ScheduleData resetSchedule() const
Definition: legdata.hpp:229
vector< double > floors_
Definition: legdata.hpp:262
vector< string > floorDates_
Definition: legdata.hpp:263
boost::optional< Period > lastRecentPeriod_
Definition: legdata.hpp:268
boost::optional< bool > isInArrears_
Definition: legdata.hpp:254
vector< double > & caps()
Definition: legdata.hpp:235
boost::optional< bool > isInArrears() const
Definition: legdata.hpp:211
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:151
vector< double > spreads_
Definition: legdata.hpp:258
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:217
std::string lastRecentPeriodCalendar_
Definition: legdata.hpp:269
ScheduleData fixingSchedule_
Definition: legdata.hpp:271
const vector< double > & caps() const
Definition: legdata.hpp:217
QuantLib::Size fixingDays_
Definition: legdata.hpp:251
bool localCapFloor() const
Definition: legdata.hpp:224
const vector< string > & spreadDates() const
Definition: legdata.hpp:216
const vector< string > & floorDates() const
Definition: legdata.hpp:220
const boost::optional< Period > & lastRecentPeriod() const
Definition: legdata.hpp:225
const vector< double > & gearings() const
Definition: legdata.hpp:221
const std::string & lastRecentPeriodCalendar() const
Definition: legdata.hpp:226
vector< string > & capDates()
Definition: legdata.hpp:236
bool hasSubPeriods() const
Definition: legdata.hpp:213
const vector< string > & capDates() const
Definition: legdata.hpp:218
vector< string > capDates_
Definition: legdata.hpp:261
vector< double > caps_
Definition: legdata.hpp:260
FloatingLegData(const string &index, QuantLib::Size fixingDays, bool isInArrears, const vector< double > &spreads, const vector< string > &spreadDates=vector< string >(), const vector< double > &caps=vector< double >(), const vector< string > &capDates=vector< string >(), const vector< double > &floors=vector< double >(), const vector< string > &floorDates=vector< string >(), const vector< double > &gearings=vector< double >(), const vector< string > &gearingDates=vector< string >(), bool isAveraged=false, bool nakedOption=false, bool hasSubPeriods=false, bool includeSpread=false, QuantLib::Period lookback=0 *Days, const Size rateCutoff=Null< Size >(), bool localCapFloor=false, const boost::optional< Period > &lastRecentPeriod=boost::none, const std::string &lastRecentPeriodCalendar=std::string(), bool telescopicValueDates=false, const std::map< QuantLib::Date, double > &historicalFixings={})
Constructor.
Definition: legdata.hpp:184
QuantLib::Period lookback_
Definition: legdata.hpp:252
bool telescopicValueDates() const
Definition: legdata.hpp:227
vector< string > spreadDates_
Definition: legdata.hpp:259
Serializable Additional Leg Data.
Definition: legdata.hpp:63
std::set< std::string > indices_
Definition: legdata.hpp:77
const string & legNodeName() const
Definition: legdata.hpp:70
const string & legType() const
Definition: legdata.hpp:69
const std::set< std::string > & indices() const
Definition: legdata.hpp:71
LegAdditionalData(const string &legType, const string &legNodeName)
Definition: legdata.hpp:65
LegAdditionalData(const string &legType)
Definition: legdata.hpp:67
Serializable object holding leg data.
Definition: legdata.hpp:844
bool & strictNotionalDates()
Definition: legdata.hpp:914
QuantLib::ext::shared_ptr< LegAdditionalData > & concreteLegData()
Definition: legdata.hpp:908
std::vector< std::string > & paymentDates()
Definition: legdata.hpp:912
const std::vector< AmortizationData > & amortizationData() const
Definition: legdata.hpp:888
const string & paymentConvention() const
Definition: legdata.hpp:878
std::set< std::string > indices_
Definition: legdata.hpp:926
const string & currency() const
Definition: legdata.hpp:873
bool notionalFinalExchange() const
Definition: legdata.hpp:880
const std::vector< std::string > & paymentDates() const
Definition: legdata.hpp:893
double foreignAmount() const
Definition: legdata.hpp:884
const ScheduleData & paymentSchedule() const
Definition: legdata.hpp:897
string notionalPaymentLag_
Definition: legdata.hpp:946
ScheduleData & schedule()
Definition: legdata.hpp:904
const ScheduleData & schedule() const
Definition: legdata.hpp:874
bool notionalFinalExchange_
Definition: legdata.hpp:939
vector< double > notionals_
Definition: legdata.hpp:935
LegData()
Default constructor.
Definition: legdata.hpp:847
const string & foreignCurrency() const
Definition: legdata.hpp:883
bool & indexingFromAssetLeg()
Definition: legdata.hpp:910
bool indexingFromAssetLeg_
Definition: legdata.hpp:950
vector< double > & notionals()
Definition: legdata.hpp:903
bool notionalInitialExchange_
Definition: legdata.hpp:938
bool isPayer() const
Definition: legdata.hpp:872
bool notionalAmortizingExchange() const
Definition: legdata.hpp:881
const std::vector< Indexing > & indexing() const
Definition: legdata.hpp:894
std::vector< std::string > paymentDates_
Definition: legdata.hpp:948
string & dayCounter()
Definition: legdata.hpp:906
virtual QuantLib::ext::shared_ptr< LegAdditionalData > initialiseConcreteLegData(const string &)
Definition: legdata.cpp:850
ScheduleData schedule_
Definition: legdata.hpp:933
string & lastPeriodDayCounter()
Definition: legdata.hpp:913
QuantLib::ext::shared_ptr< LegAdditionalData > concreteLegData_
Definition: legdata.hpp:929
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:759
ScheduleData paymentSchedule_
Definition: legdata.hpp:952
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:856
double foreignAmount_
Definition: legdata.hpp:943
const string & legType() const
Definition: legdata.hpp:890
const std::string & paymentCalendar() const
Definition: legdata.hpp:889
std::vector< Indexing > indexing_
Definition: legdata.hpp:949
bool strictNotionalDates_
Definition: legdata.hpp:953
const bool indexingFromAssetLeg() const
Definition: legdata.hpp:895
std::string paymentCalendar_
Definition: legdata.hpp:947
vector< string > notionalDates_
Definition: legdata.hpp:936
const string & fxIndex() const
Definition: legdata.hpp:885
const std::set< std::string > & indices() const
Definition: legdata.hpp:892
bool strictNotionalDates() const
Definition: legdata.hpp:898
const string & dayCounter() const
Definition: legdata.hpp:877
bool isNotResetXCCY() const
Definition: legdata.hpp:882
const vector< string > & notionalDates() const
Definition: legdata.hpp:876
const string & paymentLag() const
Definition: legdata.hpp:886
vector< string > & notionalDates()
Definition: legdata.hpp:905
string lastPeriodDayCounter_
Definition: legdata.hpp:951
string & paymentConvention()
Definition: legdata.hpp:911
const string & lastPeriodDayCounter() const
Definition: legdata.hpp:896
bool notionalInitialExchange() const
Definition: legdata.hpp:879
string paymentConvention_
Definition: legdata.hpp:937
std::vector< AmortizationData > amortizationData_
Definition: legdata.hpp:945
std::vector< Indexing > & indexing()
Definition: legdata.hpp:909
QuantLib::ext::shared_ptr< LegAdditionalData > concreteLegData() const
Definition: legdata.hpp:891
const vector< double > & notionals() const
Definition: legdata.hpp:875
bool notionalAmortizingExchange_
Definition: legdata.hpp:940
const string & notionalPaymentLag() const
Definition: legdata.hpp:887
string foreignCurrency_
Definition: legdata.hpp:942
bool & isPayer()
Definition: legdata.hpp:907
Serializable schedule data.
Definition: schedule.hpp:202
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
Serializable YoY Leg Data.
Definition: legdata.hpp:349
const vector< double > & floors() const
Definition: legdata.hpp:380
const std::vector< double > & gearings() const
Definition: legdata.hpp:374
vector< string > gearingDates_
Definition: legdata.hpp:398
const std::vector< string > & spreadDates() const
Definition: legdata.hpp:377
bool nakedOption() const
Definition: legdata.hpp:382
const std::vector< double > & spreads() const
Definition: legdata.hpp:376
vector< double > gearings_
Definition: legdata.hpp:397
YoYLegData()
Default constructor.
Definition: legdata.hpp:352
const string index() const
Definition: legdata.hpp:371
vector< double > floors_
Definition: legdata.hpp:403
vector< string > floorDates_
Definition: legdata.hpp:404
Size fixingDays() const
Definition: legdata.hpp:373
const std::vector< string > & gearingDates() const
Definition: legdata.hpp:375
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:342
vector< double > spreads_
Definition: legdata.hpp:399
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:369
const vector< double > & caps() const
Definition: legdata.hpp:378
const vector< string > & floorDates() const
Definition: legdata.hpp:381
bool irregularYoY() const
Definition: legdata.hpp:384
const string observationLag() const
Definition: legdata.hpp:372
const vector< string > & capDates() const
Definition: legdata.hpp:379
vector< string > capDates_
Definition: legdata.hpp:402
vector< double > caps_
Definition: legdata.hpp:401
bool addInflationNotional() const
Definition: legdata.hpp:383
YoYLegData(string index, string observationLag, Size fixingDays, const vector< double > &gearings=std::vector< double >(), const vector< string > &gearingDates=std::vector< string >(), const vector< double > &spreads=std::vector< double >(), const vector< string > &spreadDates=std::vector< string >(), const vector< double > &caps=vector< double >(), const vector< string > &capDates=vector< string >(), const vector< double > &floors=vector< double >(), const vector< string > &floorDates=vector< string >(), bool nakedOption=false, bool addInflationNotional=false, bool irregularYoY=false)
Constructor.
Definition: legdata.hpp:354
vector< string > spreadDates_
Definition: legdata.hpp:400
Serializable Fixed Leg Data.
Definition: legdata.hpp:145
const vector< double > & rates() const
Definition: legdata.hpp:157
ZeroCouponFixedLegData()
Default constructor.
Definition: legdata.hpp:148
ZeroCouponFixedLegData(const vector< double > &rates, const vector< string > &rateDates=vector< string >(), const string &compounding="Compounded", const bool subtractNotional=true)
Constructor.
Definition: legdata.hpp:150
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:125
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: legdata.cpp:143
const bool & subtractNotional() const
Definition: legdata.hpp:160
const vector< string > & rateDates() const
Definition: legdata.hpp:158
const string & compounding() const
Definition: legdata.hpp:159
Logic for calculating required fixing dates on legs.
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
string internalIndexName(const string &indexName)
leg indexing data model and serialization
Map text representations to QuantLib/QuantExt types.
Leg data factory that can be used to build instances of leg data.
@ data
Definition: log.hpp:77
Leg makeOISLeg(const LegData &data, const QuantLib::ext::shared_ptr< OvernightIndex > &index, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const bool attachPricer, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:1336
vector< T > normaliseToSchedule(const vector< T > &values, const Schedule &schedule, const T &defaultValue)
Definition: legdata.hpp:1131
vector< T > buildScheduledVectorNormalised(const vector< T > &values, const vector< string > &dates, const Schedule &schedule, const T &defaultValue, const bool checkAllValuesAppearInResult=false)
Definition: legdata.hpp:1139
Leg makeDigitalCMSLeg(const LegData &data, const QuantLib::ext::shared_ptr< QuantLib::SwapIndex > &swapIndex, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const bool attachPricer, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:2105
Leg makeSimpleLeg(const LegData &data)
Definition: legdata.cpp:934
vector< double > buildAmortizationScheduleFixedAmount(const vector< double > &notionals, const Schedule &schedule, const AmortizationData &data)
Definition: legdata.cpp:2460
vector< double > buildAmortizationScheduleRelativeToInitialNotional(const vector< double > &notionals, const Schedule &schedule, const AmortizationData &data)
Definition: legdata.cpp:2485
Real currentNotional(const Leg &leg)
Definition: legdata.cpp:2435
std::pair< std::string, SimmCreditQualifierMapping > getCmbLegCreditQualifierMapping(const CMBLegData &ld, const QuantLib::ext::shared_ptr< ReferenceDataManager > &refData, const std::string &tradeId, const std::string &tradeType)
Definition: legdata.cpp:2862
void applyAmortization(std::vector< Real > &notionals, const LegData &data, const Schedule &schedule, const bool annuityAllowed, const std::vector< Real > &rates)
Definition: legdata.cpp:2593
vector< double > buildAmortizationScheduleRelativeToPreviousNotional(const vector< double > &notionals, const Schedule &schedule, const AmortizationData &data)
Definition: legdata.cpp:2511
void applyIndexing(Leg &leg, const LegData &data, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, RequiredFixings &requiredFixings, const QuantLib::Date &openEndDateReplacement, const bool useXbsCurves)
Definition: legdata.cpp:2633
Leg makeBMALeg(const LegData &data, const QuantLib::ext::shared_ptr< QuantExt::BMAIndexWrapper > &indexWrapper, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:1493
vector< double > buildAmortizationScheduleFixedAnnuity(const vector< double > &notionals, const vector< double > &rates, const Schedule &schedule, const AmortizationData &data, const DayCounter &dc)
Definition: legdata.cpp:2535
Leg buildNotionalLeg(const LegData &data, const Leg &leg, RequiredFixings &requiredFixings, const QuantLib::ext::shared_ptr< Market > &market, const std::string &configuration)
Definition: legdata.cpp:2729
Real originalNotional(const Leg &leg)
Definition: legdata.cpp:2449
Leg makeCMBLeg(const LegData &data, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const bool attachPricer, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:1984
Leg makeYoYLeg(const LegData &data, const QuantLib::ext::shared_ptr< InflationIndex > &index, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:1766
vector< T > buildScheduledVector(const vector< T > &values, const vector< string > &dates, const Schedule &schedule, const bool checkAllValuesAppearInResult=false)
Definition: legdata.hpp:1061
Leg makeCMSSpreadLeg(const LegData &data, const QuantLib::ext::shared_ptr< QuantLib::SwapSpreadIndex > &swapSpreadIndex, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const bool attachPricer, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:2187
Leg makeDigitalCMSSpreadLeg(const LegData &data, const QuantLib::ext::shared_ptr< QuantLib::SwapSpreadIndex > &swapSpreadIndex, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:2260
Leg makeCPILeg(const LegData &data, const QuantLib::ext::shared_ptr< ZeroInflationIndex > &index, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:1616
vector< T >::const_iterator checkAllValuesAppearInScheduledVector(const vector< T > &scheduledVecotr, const vector< T > &inputValues)
Definition: legdata.hpp:1146
Leg makeCMSLeg(const LegData &data, const QuantLib::ext::shared_ptr< QuantLib::SwapIndex > &swapIndex, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const bool attachPricer, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:1919
Leg makeEquityLeg(const LegData &data, const QuantLib::ext::shared_ptr< EquityIndex2 > &equityCurve, const QuantLib::ext::shared_ptr< QuantExt::FxIndex > &fxIndex, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:2352
std::string getCmbLegCreditRiskCurrency(const CMBLegData &ld, const QuantLib::ext::shared_ptr< ReferenceDataManager > &refData)
Definition: legdata.cpp:2851
Leg makeZCFixedLeg(const LegData &data, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:1049
Leg makeIborLeg(const LegData &data, const QuantLib::ext::shared_ptr< IborIndex > &index, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const bool attachPricer, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:1102
Leg makeFixedLeg(const LegData &data, const QuantLib::Date &openEndDateReplacement)
Definition: legdata.cpp:950
Leg makeNotionalLeg(const Leg &refLeg, const bool initNomFlow, const bool finalNomFlow, const bool amortNomFlow, const Natural notionalPaymentLag, const BusinessDayConvention paymentConvention, const Calendar paymentCalendar, const bool excludeIndexing)
Definition: legdata.cpp:1566
Leg joinLegs(const std::vector< Leg > &legs)
Definition: legdata.cpp:2703
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Map text representations to QuantLib/QuantExt types.
trade schedule data model and serialization
mapping of SIMM credit qualifiers
underlying data model