Euribor365::Euribor365(const shared_ptr<ValueObject>& properties, const std::string& p_inp, const QuantLib::Handle<QuantLib::YieldTermStructure>& h, bool permanent) : IborIndex(properties, permanent) { std::string p = boost::algorithm::to_upper_copy(p_inp); if (p=="SW") libraryObject_ = boost::shared_ptr<QuantLib::IborIndex>(new QuantLib::Euribor365(1*QuantLib::Weeks, h)); else { QuantLib::Period pp = QuantLib::PeriodParser::parse(p); pp.normalize(); libraryObject_ = boost::shared_ptr<QuantLib::IborIndex>(new QuantLib::Euribor365(pp, h)); } }
void cppToLibrary(const std::string &in, QuantLib::Period &ret) { ret = QuantLib::PeriodParser::parse(in); ret.normalize(); }
Libor::Libor(const shared_ptr<ValueObject>& properties, const QuantLib::Currency& currency, const std::string& p, const QuantLib::Handle<QuantLib::YieldTermStructure>& h, bool permanent) : IborIndex(properties, permanent) { switch (currency.numericCode()) { case 978: // EUR if (to_upper_copy(p)=="ON") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorEURLibor(0, h)); else if (to_upper_copy(p)=="1D") QL_FAIL("1D is ambigous: please specify ON, TN, or SN"); else if (to_upper_copy(p)=="TN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorEURLibor(1, h)); else if (to_upper_copy(p)=="SN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorEURLibor(2, h)); else if (to_upper_copy(p)=="SW") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::EURLibor(1*QuantLib::Weeks, h)); else { QuantLib::Period pp = QuantLib::PeriodParser::parse(p); pp.normalize(); libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::EURLibor(pp, h)); } break; case 840: // USD if (to_upper_copy(p)=="ON") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorUSDLibor(0, h)); else if (to_upper_copy(p)=="1D") QL_FAIL("1D is ambigous: please specify ON, TN, or SN"); else if (to_upper_copy(p)=="TN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorUSDLibor(1, h)); else if (to_upper_copy(p)=="SN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorUSDLibor(2, h)); else if (to_upper_copy(p)=="SW") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::USDLibor(1*QuantLib::Weeks, h)); else { QuantLib::Period pp = QuantLib::PeriodParser::parse(p); pp.normalize(); libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::USDLibor(pp, h)); } break; case 826: // GBP if (to_upper_copy(p)=="ON") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorGBPLibor(0, h)); else if (to_upper_copy(p)=="1D") QL_FAIL("1D is ambigous: please specify ON, TN, or SN"); else if (to_upper_copy(p)=="TN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorGBPLibor(1, h)); else if (to_upper_copy(p)=="SN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorGBPLibor(2, h)); else if (to_upper_copy(p)=="SW") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::GBPLibor(1*QuantLib::Weeks, h)); else { QuantLib::Period pp = QuantLib::PeriodParser::parse(p); pp.normalize(); libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::GBPLibor(pp, h)); } break; case 756: // CHF if (to_upper_copy(p)=="ON") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorCHFLibor(0, h)); else if (to_upper_copy(p)=="1D") QL_FAIL("1D is ambigous: please specify ON, TN, or SN"); else if (to_upper_copy(p)=="TN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorCHFLibor(1, h)); else if (to_upper_copy(p)=="SN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorCHFLibor(2, h)); else if (to_upper_copy(p)=="SW") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::CHFLibor(1*QuantLib::Weeks, h)); else { QuantLib::Period pp = QuantLib::PeriodParser::parse(p); pp.normalize(); libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::CHFLibor(pp, h)); } break; case 392: // JPY if (to_upper_copy(p)=="ON") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorJPYLibor(0, h)); else if (to_upper_copy(p)=="1D") QL_FAIL("1D is ambigous: please specify ON, TN, or SN"); else if (to_upper_copy(p)=="TN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorJPYLibor(1, h)); else if (to_upper_copy(p)=="SN") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::DailyTenorJPYLibor(2, h)); else if (to_upper_copy(p)=="SW") libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::JPYLibor(1*QuantLib::Weeks, h)); else { QuantLib::Period pp = QuantLib::PeriodParser::parse(p); pp.normalize(); libraryObject_ = shared_ptr<QuantLib::IborIndex>(new QuantLib::JPYLibor(pp, h)); } break; default: QL_FAIL("Unhandled currency " << currency); } }