Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
marketdatum.cpp
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
21
22#include <boost/archive/binary_iarchive.hpp>
23#include <boost/archive/binary_oarchive.hpp>
24#include <boost/lexical_cast.hpp>
25
26using boost::bad_lexical_cast;
27using boost::lexical_cast;
28
29namespace ore {
30namespace data {
31
32bool operator<(const MarketDatum& a, const MarketDatum& b) {
33 if (a.asofDate() != b.asofDate())
34 return a.asofDate() < b.asofDate();
35 // the name determines the instrument and quote type uniquely by construction
36 return a.name() < b.name();
37}
38
39std::ostream& operator<<(std::ostream& out, const MarketDatum::QuoteType& type) {
40 switch (type) {
42 return out << "BASIS_SPREAD";
44 return out << "CREDIT_SPREAD";
46 return out << "CONV_CREDIT_SPREAD";
48 return out << "YIELD_SPREAD";
50 return out << "RATE";
52 return out << "RATIO";
54 return out << "PRICE";
56 return out << "RATE_LNVOL";
58 return out << "RATE_NVOL";
60 return out << "RATE_SLNVOL";
62 return out << "BASE_CORRELATION";
64 return out << "SHIFT";
66 return out << "TRANSITION_PROBABILITY";
68 return out << "NULL";
69 default:
70 return out << "?";
71 }
72}
73
74std::ostream& operator<<(std::ostream& out, const MarketDatum::InstrumentType& type) {
75 switch (type) {
77 return out << "ZERO";
79 return out << "DISCOUNT";
81 return out << "MM";
83 return out << "MM_FUTURE";
85 return out << "OI_FUTURE";
87 return out << "FRA";
89 return out << "IMM_FRA";
91 return out << "IR_SWAP";
93 return out << "BASIS_SWAP";
95 return out << "BMA_SWAP";
97 return out << "CC_BASIS_SWAP";
99 return out << "CC_FIX_FLOAT_SWAP";
101 return out << "CDS";
103 return out << "CDS_INDEX";
105 return out << "FX_SPOT";
107 return out << "FX_FWD";
109 return out << "HAZARD_RATE";
111 return out << "RECOVERY_RATE";
113 return out << "SWAPTION";
115 return out << "CAPFLOOR";
117 return out << "FX_OPTION";
119 return out << "ZC_INFLATIONSWAP";
121 return out << "ZC_INFLATIONCAPFLOOR";
123 return out << "YY_INFLATIONSWAP";
125 return out << "YY_INFLATIONCAPFLOOR";
127 return out << "SEASONALITY";
129 return out << "EQUITY_SPOT";
131 return out << "EQUITY_FWD";
133 return out << "EQUITY_DIVIDEND";
135 return out << "EQUITY_OPTION";
137 return out << "BOND";
139 return out << "BOND_OPTION";
141 return out << "INDEX_CDS_OPTION";
143 return out << "COMMODITY_SPOT";
145 return out << "COMMODITY_FWD";
147 return out << "CORRELATION";
149 return out << "COMMODITY_OPTION";
151 return out << "CPR";
153 return out << "RATING";
155 return out << "NONE";
156 default:
157 return out << "?";
158 }
159}
160
161EquityOptionQuote::EquityOptionQuote(Real value, Date asofDate, const string& name, QuoteType quoteType,
162 string equityName, string ccy, string expiry,
163 const QuantLib::ext::shared_ptr<BaseStrike>& strike, bool isCall)
164 : MarketDatum(value, asofDate, name, quoteType, InstrumentType::EQUITY_OPTION), eqName_(equityName), ccy_(ccy),
165 expiry_(expiry), strike_(strike), isCall_(isCall) {
166
167 // we will call a parser on the expiry string, to ensure it is a correctly-formatted date or tenor
168 Date tmpDate;
169 Period tmpPeriod;
170 bool isDate;
171 parseDateOrPeriod(expiry, tmpDate, tmpPeriod, isDate);
172
173 if (isDate)
174 QL_REQUIRE(asofDate <= tmpDate, "EquityOptionQuote: Invalid EquityOptionQuote, expiry date "
175 << tmpDate << " must be after asof date " << asofDate);
176}
177
178EquityForwardQuote::EquityForwardQuote(Real value, Date asofDate, const string& name, QuoteType quoteType,
179 string equityName, string ccy, const Date& expiryDate)
180 : MarketDatum(value, asofDate, name, quoteType, InstrumentType::EQUITY_FWD), eqName_(equityName), ccy_(ccy),
181 expiry_(expiryDate) {
182 if (expiry_ != Date())
183 QL_REQUIRE(asofDate <= expiry_, "EquityForwardQuote: Invalid EquityForwardQuote, expiry date "
184 << expiry_ << " must be after asof date " << asofDate);
185}
186
187EquityDividendYieldQuote::EquityDividendYieldQuote(Real value, Date asofDate, const string& name, QuoteType quoteType,
188 string equityName, string ccy, const Date& tenorDate)
189 : MarketDatum(value, asofDate, name, quoteType, InstrumentType::EQUITY_DIVIDEND), eqName_(equityName), ccy_(ccy),
190 tenor_(tenorDate) {
191 if (tenor_ != Date())
192 QL_REQUIRE(asofDate <= tenor_, "EquityDividendYieldQuote: Invalid EquityForwardQuote, expiry date "
193 << tenor_ << " must be after asof date " << asofDate);
194}
195
196IndexCDSOptionQuote::IndexCDSOptionQuote(QuantLib::Real value, const Date& asof, const string& name,
197 const string& indexName, const QuantLib::ext::shared_ptr<Expiry>& expiry,
198 const string& indexTerm, const QuantLib::ext::shared_ptr<BaseStrike>& strike)
199 : MarketDatum(value, asof, name, QuoteType::RATE_LNVOL, InstrumentType::INDEX_CDS_OPTION), indexName_(indexName),
200 expiry_(expiry), indexTerm_(indexTerm), strike_(strike) {
201
202 if (auto date = QuantLib::ext::dynamic_pointer_cast<ExpiryDate>(expiry))
203 QL_REQUIRE(asof <= date->expiryDate(), "IndexCDSOptionQuote: Invalid INDEX_CDS_OPTION quote, expiry date "
204 << date->expiryDate() << " must be after asof date " << asof);
205}
206
207CommodityForwardQuote::CommodityForwardQuote(QuantLib::Real value, const QuantLib::Date& asofDate, const std::string& name,
208 QuoteType quoteType, const std::string& commodityName, const std::string& quoteCurrency,
209 const QuantLib::Date& expiryDate)
210 : MarketDatum(value, asofDate, name, quoteType, InstrumentType::COMMODITY_FWD), commodityName_(commodityName),
211 quoteCurrency_(quoteCurrency), expiryDate_(expiryDate), tenorBased_(false) {
212 QL_REQUIRE(quoteType == QuoteType::PRICE, "Commodity forward quote must be of type 'PRICE'");
213 QL_REQUIRE(asofDate <= expiryDate, "MarketDatumParser: Invalid COMMODITY_FWD quote, expiry date "
214 << expiryDate << " must be after asof date " << asofDate);
215}
216
217//! Tenor based commodity forward constructor
218CommodityForwardQuote::CommodityForwardQuote(QuantLib::Real value, const QuantLib::Date& asofDate, const std::string& name,
219 QuoteType quoteType, const std::string& commodityName, const std::string& quoteCurrency,
220 const QuantLib::Period& tenor, boost::optional<QuantLib::Period> startTenor)
221 : MarketDatum(value, asofDate, name, quoteType, InstrumentType::COMMODITY_FWD), commodityName_(commodityName),
222 quoteCurrency_(quoteCurrency), tenor_(tenor), startTenor_(startTenor), tenorBased_(true) {
223 QL_REQUIRE(quoteType == QuoteType::PRICE, "Commodity forward quote must be of type 'PRICE'");
224}
225
226namespace {
227Natural yearFromExpiryString(const std::string& expiry) {
228 QL_REQUIRE(expiry.length() == 7, "The expiry string must be of "
229 "the form YYYY-MM");
230 string strExpiryYear = expiry.substr(0, 4);
231 Natural expiryYear;
232 try {
233 expiryYear = lexical_cast<Natural>(strExpiryYear);
234 } catch (const bad_lexical_cast&) {
235 QL_FAIL("Could not convert year string, " << strExpiryYear << ", to number.");
236 }
237 return expiryYear;
238}
239
240Month monthFromExpiryString(const std::string& expiry) {
241 QL_REQUIRE(expiry.length() == 7, "The expiry string must be of "
242 "the form YYYY-MM");
243 string strExpiryMonth = expiry.substr(5);
244 Natural expiryMonth;
245 try {
246 expiryMonth = lexical_cast<Natural>(strExpiryMonth);
247 } catch (const bad_lexical_cast&) {
248 QL_FAIL("Could not convert month string, " << strExpiryMonth << ", to number.");
249 }
250 return static_cast<Month>(expiryMonth);
251}
252} // namespace
253
254Natural MMFutureQuote::expiryYear() const { return yearFromExpiryString(expiry_); }
255
256Month MMFutureQuote::expiryMonth() const { return monthFromExpiryString(expiry_); }
257
258Natural OIFutureQuote::expiryYear() const { return yearFromExpiryString(expiry_); }
259
260Month OIFutureQuote::expiryMonth() const { return monthFromExpiryString(expiry_); }
261
262QuantLib::Size SeasonalityQuote::applyMonth() const {
263 QL_REQUIRE(month_.length() == 3, "The month string must be of "
264 "the form MMM");
265 std::vector<std::string> allMonths = {"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
266 "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"};
267 QuantLib::Size applyMonth;
268 auto it = std::find(allMonths.begin(), allMonths.end(), month_);
269 if (it != allMonths.end()) {
270 applyMonth = std::distance(allMonths.begin(), it) + 1;
271 } else {
272 QL_FAIL("Unknown month string: " << month_);
273 }
274 return applyMonth;
275}
276
277CommodityOptionQuote::CommodityOptionQuote(Real value, const Date& asof, const string& name, QuoteType quoteType,
278 const string& commodityName, const string& quoteCurrency,
279 const QuantLib::ext::shared_ptr<Expiry>& expiry,
280 const QuantLib::ext::shared_ptr<BaseStrike>& strike,
281 Option::Type optionType)
282 : MarketDatum(value, asof, name, quoteType, InstrumentType::COMMODITY_OPTION), commodityName_(commodityName),
283 quoteCurrency_(quoteCurrency), expiry_(expiry), strike_(strike), optionType_(optionType) {
284
285 if (auto date = QuantLib::ext::dynamic_pointer_cast<ExpiryDate>(expiry))
286 QL_REQUIRE(asof <= date->expiryDate(), "CommodityOptionQuote: Invalid CommodityOptionQuote, expiry date "
287 << date->expiryDate() << " must be after asof date " << asof);
288}
289
290CorrelationQuote::CorrelationQuote(Real value, const Date& asof, const string& name, QuoteType quoteType,
291 const string& index1, const string& index2, const string& expiry,
292 const string& strike)
293 : MarketDatum(value, asof, name, quoteType, InstrumentType::CORRELATION), index1_(index1), index2_(index2),
294 expiry_(expiry), strike_(strike) {
295
296 // If strike is not ATM, it must parse to Real
297 if (strike != "ATM") {
298 Real result;
299 QL_REQUIRE(tryParseReal(strike_, result),
300 "Commodity option quote strike (" << strike_ << ") must be either ATM or an actual strike price");
301 }
302
303 // Call parser to check that the expiry_ resolves to a period or a date
304 Date outDate;
305 Period outPeriod;
306 bool outBool;
307 parseDateOrPeriod(expiry_, outDate, outPeriod, outBool);
308
309 if (outBool)
310 QL_REQUIRE(asof <= outDate, "CorrelationQuote: Invalid CorrelationQuote, expiry date "
311 << outDate << " must be after asof date " << asof);
312}
313
314template <class Archive> void MarketDatum::serialize(Archive& ar, const unsigned int version) {
315 Real value;
316 // save / load the value of the quote, do not try to serialize the quote as such
317 if (Archive::is_saving::value) {
318 value = quote_->value();
319 ar& value;
320 } else {
321 ar& value;
322 quote_ = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(value));
323 }
324 ar& asofDate_;
325 ar& name_;
326 ar& instrumentType_;
327 ar& quoteType_;
328}
329
330template <class Archive> void MoneyMarketQuote::serialize(Archive& ar, const unsigned int version) {
331 ar& boost::serialization::base_object<MarketDatum>(*this);
332 ar& ccy_;
333 ar& fwdStart_;
334 ar& term_;
335}
336
337template <class Archive> void FRAQuote::serialize(Archive& ar, const unsigned int version) {
338 ar& boost::serialization::base_object<MarketDatum>(*this);
339 ar& ccy_;
340 ar& fwdStart_;
341 ar& term_;
342}
343
344template <class Archive> void ImmFraQuote::serialize(Archive& ar, const unsigned int version) {
345 ar& boost::serialization::base_object<MarketDatum>(*this);
346 ar& ccy_;
347 ar& imm1_;
348 ar& imm2_;
349}
350
351template <class Archive> void SwapQuote::serialize(Archive& ar, const unsigned int version) {
352 ar& boost::serialization::base_object<MarketDatum>(*this);
353 ar& ccy_;
354 ar& fwdStart_;
355 ar& term_;
356 ar& tenor_;
357 ar& indexName_;
358 ar& startDate_;
359 ar& maturityDate_;
360}
361
362template <class Archive> void ZeroQuote::serialize(Archive& ar, const unsigned int version) {
363 ar& boost::serialization::base_object<MarketDatum>(*this);
364 ar& ccy_;
365 ar& date_;
366 ar& dayCounter_;
367 ar& tenor_;
368 ar& tenorBased_;
369}
370
371template <class Archive> void DiscountQuote::serialize(Archive& ar, const unsigned int version) {
372 ar& boost::serialization::base_object<MarketDatum>(*this);
373 ar& ccy_;
374 ar& date_;
375 ar& tenor_;
376}
377
378template <class Archive> void MMFutureQuote::serialize(Archive& ar, const unsigned int version) {
379 ar& boost::serialization::base_object<MarketDatum>(*this);
380 ar& ccy_;
381 ar& expiry_;
382 ar& contract_;
383 ar& tenor_;
384}
385
386template <class Archive> void OIFutureQuote::serialize(Archive& ar, const unsigned int version) {
387 ar& boost::serialization::base_object<MarketDatum>(*this);
388 ar& ccy_;
389 ar& expiry_;
390 ar& contract_;
391 ar& tenor_;
392}
393
394template <class Archive> void BasisSwapQuote::serialize(Archive& ar, const unsigned int version) {
395 ar& boost::serialization::base_object<MarketDatum>(*this);
396 ar& flatTerm_;
397 ar& term_;
398 ar& ccy_;
399 ar& maturity_;
400}
401
402template <class Archive> void BMASwapQuote::serialize(Archive& ar, const unsigned int version) {
403 ar& boost::serialization::base_object<MarketDatum>(*this);
404 ar& term_;
405 ar& ccy_;
406 ar& maturity_;
407}
408
409template <class Archive> void CrossCcyBasisSwapQuote::serialize(Archive& ar, const unsigned int version) {
410 ar& boost::serialization::base_object<MarketDatum>(*this);
411 ar& flatCcy_;
412 ar& flatTerm_;
413 ar& ccy_;
414 ar& term_;
415 ar& maturity_;
416}
417
418template <class Archive> void CrossCcyFixFloatSwapQuote::serialize(Archive& ar, const unsigned int version) {
419 ar& boost::serialization::base_object<MarketDatum>(*this);
420 ar& floatCurrency_;
421 ar& floatTenor_;
422 ar& fixedCurrency_;
423 ar& fixedTenor_;
424 ar& maturity_;
425}
426
427template <class Archive> void CdsQuote::serialize(Archive& ar, const unsigned int version) {
428 ar& boost::serialization::base_object<MarketDatum>(*this);
429 ar& underlyingName_;
430 ar& seniority_;
431 ar& ccy_;
432 ar& term_;
433}
434
435template <class Archive> void HazardRateQuote::serialize(Archive& ar, const unsigned int version) {
436 ar& boost::serialization::base_object<MarketDatum>(*this);
437 ar& underlyingName_;
438 ar& seniority_;
439 ar& ccy_;
440 ar& term_;
441 ar& docClause_;
442}
443
444template <class Archive> void RecoveryRateQuote::serialize(Archive& ar, const unsigned int version) {
445 ar& boost::serialization::base_object<MarketDatum>(*this);
446 ar& underlyingName_;
447 ar& seniority_;
448 ar& ccy_;
449 ar& docClause_;
450}
451
452template <class Archive> void SwaptionQuote::serialize(Archive& ar, const unsigned int version) {
453 ar& boost::serialization::base_object<MarketDatum>(*this);
454 ar& ccy_;
455 ar& expiry_;
456 ar& term_;
457 ar& dimension_;
458 ar& strike_;
459 ar& quoteTag_;
460 ar& isPayer_;
461}
462
463template <class Archive> void SwaptionShiftQuote::serialize(Archive& ar, const unsigned int version) {
464 ar& boost::serialization::base_object<MarketDatum>(*this);
465 ar& ccy_;
466 ar& term_;
467 ar& quoteTag_;
468}
469
470template <class Archive> void BondOptionQuote::serialize(Archive& ar, const unsigned int version) {
471 ar& boost::serialization::base_object<MarketDatum>(*this);
472 ar& qualifier_;
473 ar& expiry_;
474 ar& term_;
475}
476
477template <class Archive> void BondOptionShiftQuote::serialize(Archive& ar, const unsigned int version) {
478 ar& boost::serialization::base_object<MarketDatum>(*this);
479 ar& qualifier_;
480 ar& term_;
481}
482
483template <class Archive> void CapFloorQuote::serialize(Archive& ar, const unsigned int version) {
484 ar& boost::serialization::base_object<MarketDatum>(*this);
485 ar& ccy_;
486 ar& term_;
487 ar& underlying_;
488 ar& atm_;
489 ar& relative_;
490 ar& strike_;
491 ar& indexName_;
492 ar& isCap_;
493}
494
495template <class Archive> void CapFloorShiftQuote::serialize(Archive& ar, const unsigned int version) {
496 ar& boost::serialization::base_object<MarketDatum>(*this);
497 ar& ccy_;
498 ar& indexTenor_;
499 ar& indexName_;
500}
501
502template <class Archive> void FXSpotQuote::serialize(Archive& ar, const unsigned int version) {
503 ar& boost::serialization::base_object<MarketDatum>(*this);
504 ar& unitCcy_;
505 ar& ccy_;
506}
507
508template <class Archive> void FXForwardQuote::serialize(Archive& ar, const unsigned int version) {
509 ar& boost::serialization::base_object<MarketDatum>(*this);
510 ar& unitCcy_;
511 ar& ccy_;
512 ar& term_;
514}
515
516template <class Archive> void FXOptionQuote::serialize(Archive& ar, const unsigned int version) {
517 ar& boost::serialization::base_object<MarketDatum>(*this);
518 ar& unitCcy_;
519 ar& ccy_;
520 ar& expiry_;
521 ar& strike_;
522}
523
524template <class Archive> void ZcInflationSwapQuote::serialize(Archive& ar, const unsigned int version) {
525 ar& boost::serialization::base_object<MarketDatum>(*this);
526 ar& index_;
527 ar& term_;
528}
529
530template <class Archive> void InflationCapFloorQuote::serialize(Archive& ar, const unsigned int version) {
531 ar& boost::serialization::base_object<MarketDatum>(*this);
532 ar& index_;
533 ar& term_;
534 ar& isCap_;
535 ar& strike_;
536}
537
538template <class Archive> void ZcInflationCapFloorQuote::serialize(Archive& ar, const unsigned int version) {
539 ar& boost::serialization::base_object<InflationCapFloorQuote>(*this);
540}
541
542template <class Archive> void YoYInflationSwapQuote::serialize(Archive& ar, const unsigned int version) {
543 ar& boost::serialization::base_object<MarketDatum>(*this);
544 ar& index_;
545 ar& term_;
546}
547
548template <class Archive> void YyInflationCapFloorQuote::serialize(Archive& ar, const unsigned int version) {
549 ar& boost::serialization::base_object<InflationCapFloorQuote>(*this);
550}
551
552template <class Archive> void SeasonalityQuote::serialize(Archive& ar, const unsigned int version) {
553 ar& boost::serialization::base_object<MarketDatum>(*this);
554 ar& index_;
555 ar& type_;
556 ar& month_;
557}
558
559template <class Archive> void EquitySpotQuote::serialize(Archive& ar, const unsigned int version) {
560 ar& boost::serialization::base_object<MarketDatum>(*this);
561 ar& eqName_;
562 ar& ccy_;
563}
564
565template <class Archive> void EquityForwardQuote::serialize(Archive& ar, const unsigned int version) {
566 ar& boost::serialization::base_object<MarketDatum>(*this);
567 ar& eqName_;
568 ar& ccy_;
569 ar& expiry_;
570}
571
572template <class Archive> void EquityDividendYieldQuote::serialize(Archive& ar, const unsigned int version) {
573 ar& boost::serialization::base_object<MarketDatum>(*this);
574 ar& eqName_;
575 ar& ccy_;
576 ar& tenor_;
577}
578
579template <class Archive> void EquityOptionQuote::serialize(Archive& ar, const unsigned int version) {
580 ar& boost::serialization::base_object<MarketDatum>(*this);
581 ar& eqName_;
582 ar& ccy_;
583 ar& expiry_;
584 ar& strike_;
585 ar& isCall_;
586}
587
588template <class Archive> void SecuritySpreadQuote::serialize(Archive& ar, const unsigned int version) {
589 ar& boost::serialization::base_object<MarketDatum>(*this);
590 ar& securityID_;
591}
592
593template <class Archive> void BaseCorrelationQuote::serialize(Archive& ar, const unsigned int version) {
594 ar& boost::serialization::base_object<MarketDatum>(*this);
595 ar& cdsIndexName_;
596 ar& term_;
597 ar& detachmentPoint_;
598}
599
600template <class Archive> void IndexCDSOptionQuote::serialize(Archive& ar, const unsigned int version) {
601 ar& boost::serialization::base_object<MarketDatum>(*this);
602 ar& indexName_;
603 ar& expiry_;
604 ar& indexTerm_;
605 ar& strike_;
606}
607
608template <class Archive> void CommoditySpotQuote::serialize(Archive& ar, const unsigned int version) {
609 ar& boost::serialization::base_object<MarketDatum>(*this);
610 ar& commodityName_;
611 ar& quoteCurrency_;
612}
613
614template <class Archive> void CommodityForwardQuote::serialize(Archive& ar, const unsigned int version) {
615 ar& boost::serialization::base_object<MarketDatum>(*this);
616 ar& commodityName_;
617 ar& quoteCurrency_;
618 ar& expiryDate_;
619 ar& tenor_;
620 ar& startTenor_;
621 ar& tenorBased_;
622}
623
624template <class Archive> void CommodityOptionQuote::serialize(Archive& ar, const unsigned int version) {
625 ar& boost::serialization::base_object<MarketDatum>(*this);
626 ar& commodityName_;
627 ar& quoteCurrency_;
628 ar& expiry_;
629 ar& strike_;
630}
631
632template <class Archive> void CorrelationQuote::serialize(Archive& ar, const unsigned int version) {
633 ar& boost::serialization::base_object<MarketDatum>(*this);
634 ar& index1_;
635 ar& index2_;
636 ar& expiry_;
637 ar& strike_;
638}
639
640template <class Archive> void CPRQuote::serialize(Archive& ar, const unsigned int version) {
641 ar& boost::serialization::base_object<MarketDatum>(*this);
642 ar& securityID_;
643}
644
645template <class Archive> void BondPriceQuote::serialize(Archive& ar, const unsigned int version) {
646 ar& boost::serialization::base_object<MarketDatum>(*this);
647 ar& securityID_;
648}
649
650template <class Archive> void TransitionProbabilityQuote::serialize(Archive& ar, const unsigned int version) {
651 ar& boost::serialization::base_object<MarketDatum>(*this);
652 ar& id_;
653 ar& fromRating_;
654 ar& toRating_;
655}
656
657template void MarketDatum::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
658template void MarketDatum::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
659template void MoneyMarketQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
660template void MoneyMarketQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
661template void FRAQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
662template void FRAQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
663template void ImmFraQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
664template void ImmFraQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
665template void SwapQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
666template void SwapQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
667template void ZeroQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
668template void ZeroQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
669template void DiscountQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
670template void DiscountQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
671template void MMFutureQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
672template void MMFutureQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
673template void OIFutureQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
674template void OIFutureQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
675template void BasisSwapQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
676template void BasisSwapQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
677template void BMASwapQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
678template void BMASwapQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
679template void CrossCcyBasisSwapQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
680template void CrossCcyBasisSwapQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
681template void CrossCcyFixFloatSwapQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
682template void CrossCcyFixFloatSwapQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
683template void CdsQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
684template void CdsQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
685template void HazardRateQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
686template void HazardRateQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
687template void RecoveryRateQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
688template void RecoveryRateQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
689template void SwaptionQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
690template void SwaptionQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
691template void SwaptionShiftQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
692template void SwaptionShiftQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
693template void BondOptionQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
694template void BondOptionQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
695template void BondOptionShiftQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
696template void BondOptionShiftQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
697template void CapFloorQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
698template void CapFloorQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
699template void CapFloorShiftQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
700template void CapFloorShiftQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
701template void FXSpotQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
702template void FXSpotQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
703template void FXForwardQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
704template void FXForwardQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
705template void FXOptionQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
706template void FXOptionQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
707template void ZcInflationSwapQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
708template void ZcInflationSwapQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
709template void InflationCapFloorQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
710template void InflationCapFloorQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
711template void ZcInflationCapFloorQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
712template void ZcInflationCapFloorQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
713template void YoYInflationSwapQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
714template void YoYInflationSwapQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
715template void YyInflationCapFloorQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
716template void YyInflationCapFloorQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
717template void SeasonalityQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
718template void SeasonalityQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
719template void EquitySpotQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
720template void EquitySpotQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
721template void EquityForwardQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
722template void EquityForwardQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
723template void EquityDividendYieldQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
724template void EquityDividendYieldQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
725template void EquityOptionQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
726template void EquityOptionQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
727template void SecuritySpreadQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
728template void SecuritySpreadQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
729template void BaseCorrelationQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
730template void BaseCorrelationQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
731template void IndexCDSOptionQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
732template void IndexCDSOptionQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
733template void CommoditySpotQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
734template void CommoditySpotQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
735template void CommodityForwardQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
736template void CommodityForwardQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
737template void CommodityOptionQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
738template void CommodityOptionQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
739template void CorrelationQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
740template void CorrelationQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
741template void CPRQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
742template void CPRQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
743template void BondPriceQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
744template void BondPriceQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
745template void TransitionProbabilityQuote::serialize(boost::archive::binary_oarchive& ar, const unsigned int version);
746template void TransitionProbabilityQuote::serialize(boost::archive::binary_iarchive& ar, const unsigned int version);
747
748} // namespace data
749} // namespace ore
750
BMA Swap data class.
void serialize(Archive &ar, const unsigned int version)
void serialize(Archive &ar, const unsigned int version)
Basis Swap data class.
void serialize(Archive &ar, const unsigned int version)
Bond option data class.
void serialize(Archive &ar, const unsigned int version)
Shift data class (for SLN bond option volatilities)
void serialize(Archive &ar, const unsigned int version)
CPR data class.
Cap/Floor data class.
void serialize(Archive &ar, const unsigned int version)
Shift data class (for SLN cap/floor volatilities)
void serialize(Archive &ar, const unsigned int version)
void serialize(Archive &ar, const unsigned int version)
Commodity forward quote class.
const QuantLib::Date & expiryDate() const
The commodity forward's expiry if the quote is date based.
Commodity option data class.
Commodity spot quote class.
Cross Currency Basis Swap data class.
void serialize(Archive &ar, const unsigned int version)
Cross Currency Fix Float Swap quote holder.
void serialize(Archive &ar, const unsigned int version)
Discount market data class.
void serialize(Archive &ar, const unsigned int version)
Equity/Index Dividend yield data class.
void serialize(Archive &ar, const unsigned int version)
Equity forward data class.
void serialize(Archive &ar, const unsigned int version)
Equity/Index Option data class.
QuantLib::ext::shared_ptr< BaseStrike > strike_
const string & expiry() const
void serialize(Archive &ar, const unsigned int version)
Equity/Index spot price data class.
void serialize(Archive &ar, const unsigned int version)
FRA market data class.
void serialize(Archive &ar, const unsigned int version)
Foreign exchange rate data class.
boost::variant< QuantLib::Period, FxFwdString > term_
void serialize(Archive &ar, const unsigned int version)
FX Option data class.
void serialize(Archive &ar, const unsigned int version)
Foreign exchange rate data class.
void serialize(Archive &ar, const unsigned int version)
Hazard rate data class.
void serialize(Archive &ar, const unsigned int version)
IMM FRA market data class.
void serialize(Archive &ar, const unsigned int version)
CDS Index Option data class.
IndexCDSOptionQuote()
Default constructor.
Inflation Cap Floor data class.
void serialize(Archive &ar, const unsigned int version)
Money Market Future data class.
Natural expiryYear() const
void serialize(Archive &ar, const unsigned int version)
Base market data class.
Definition: marketdatum.hpp:78
InstrumentType instrumentType_
Handle< Quote > quote_
InstrumentType
Supported market instrument types.
Definition: marketdatum.hpp:82
QuoteType
Supported market quote types.
const string & name() const
QuoteType quoteType() const
void serialize(Archive &ar, const unsigned int version)
Money market data class.
void serialize(Archive &ar, const unsigned int version)
Overnight index future data class.
Natural expiryYear() const
void serialize(Archive &ar, const unsigned int version)
Recovery rate data class.
void serialize(Archive &ar, const unsigned int version)
Inflation seasonality data class.
QuantLib::Size applyMonth() const
void serialize(Archive &ar, const unsigned int version)
Bond spread data class.
void serialize(Archive &ar, const unsigned int version)
Swap market data class.
std::string indexName_
void serialize(Archive &ar, const unsigned int version)
Swaption data class.
void serialize(Archive &ar, const unsigned int version)
Shift data class (for SLN swaption volatilities)
void serialize(Archive &ar, const unsigned int version)
Transition Probability data class.
YoY Inflation swap data class.
void serialize(Archive &ar, const unsigned int version)
void serialize(Archive &ar, const unsigned int version)
void serialize(Archive &ar, const unsigned int version)
ZC Inflation swap data class.
void serialize(Archive &ar, const unsigned int version)
void serialize(Archive &ar, const unsigned int version)
SafeStack< ValueType > value
bool tryParseReal(const string &s, QuantLib::Real &result)
Attempt to convert text to Real.
Definition: parsers.cpp:126
boost::variant< QuantLib::Date, QuantLib::Period > parseDateOrPeriod(const string &s)
Convert text to QuantLib::Period or QuantLib::Date.
Definition: parsers.cpp:493
@ data
Definition: log.hpp:77
BOOST_CLASS_EXPORT_IMPLEMENT(ore::data::MoneyMarketQuote)
Market data representation.
bool operator<(const Dividend &d1, const Dividend &d2)
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Map text representations to QuantLib/QuantExt types.
string name