23#include <boost/archive/binary_iarchive.hpp>
24#include <boost/archive/binary_oarchive.hpp>
56 ar& boost::serialization::base_object<Expiry>(*
this);
79 ar& boost::serialization::base_object<Expiry>(*
this);
88 QL_REQUIRE(strIndex.size() > 1,
"Future continuation expiry must have at least 2 characters");
89 QL_REQUIRE(strIndex.at(0) ==
'c',
"Future continuation expiry string must start with a 'c'");
104 ar& boost::serialization::base_object<Expiry>(*
this);
110QuantLib::ext::shared_ptr<Expiry>
parseExpiry(
const string& strExpiry) {
112 QL_REQUIRE(strExpiry.size() > 1,
"Expiry string must have at least 2 characters");
114 if (strExpiry.at(0) ==
'c') {
115 auto expiry = QuantLib::ext::make_shared<FutureContinuationExpiry>();
116 expiry->fromString(strExpiry);
124 return QuantLib::ext::make_shared<ExpiryDate>(date);
126 return QuantLib::ext::make_shared<ExpiryPeriod>(period);
131template void Expiry::serialize(boost::archive::binary_oarchive& ar,
const unsigned int version);
132template void Expiry::serialize(boost::archive::binary_iarchive& ar,
const unsigned int version);
QuantLib::Date expiryDate_
const QuantLib::Date & expiryDate() const
Return the expiry date.
ExpiryDate()
Default constructor.
std::string toString() const override
bool equal_to(const Expiry &other) const override
Override in derived classes to compare specific expiries.
void fromString(const std::string &strExpiryDate) override
void serialize(Archive &ar, const unsigned int version)
virtual std::string toString() const =0
Write the Expiry object to string.
virtual bool equal_to(const Expiry &other) const =0
Override in derived classes to compare specific expiries.
void serialize(Archive &ar, const unsigned int version)
const QuantLib::Period & expiryPeriod() const
Return the expiry period.
QuantLib::Period expiryPeriod_
std::string toString() const override
bool equal_to(const Expiry &other) const override
Override in derived classes to compare specific expiries.
void fromString(const std::string &strExpiryPeriod) override
void serialize(Archive &ar, const unsigned int version)
ExpiryPeriod()
Default constructor.
void fromString(const std::string &strIndex) override
QuantLib::Natural expiryIndex() const
Return the future continuation expiry index.
QuantLib::Natural expiryIndex_
std::string toString() const override
bool equal_to(const Expiry &other) const override
Override in derived classes to compare specific expiries.
FutureContinuationExpiry(QuantLib::Natural expiryIndex=1)
Constructor with optional explicit future continuation index.
void serialize(Archive &ar, const unsigned int version)
Classes for representing an expiry for use in market quotes.
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
boost::variant< QuantLib::Date, QuantLib::Period > parseDateOrPeriod(const string &s)
Convert text to QuantLib::Period or QuantLib::Date.
Period parsePeriod(const string &s)
Convert text to QuantLib::Period.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
bool operator==(const Dividend &d1, const Dividend &d)
std::string to_string(const LocationInfo &l)
QuantLib::ext::shared_ptr< Expiry > parseExpiry(const string &strExpiry)
Parse an Expiry from its string representation, strExpiry.
Serializable Credit Default Swap.
BOOST_CLASS_EXPORT_IMPLEMENT(ore::data::ExpiryDate)
Map text representations to QuantLib/QuantExt types.
string conversion utilities