本文整理汇总了C++中Period::frequency方法的典型用法代码示例。如果您正苦于以下问题:C++ Period::frequency方法的具体用法?C++ Period::frequency怎么用?C++ Period::frequency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Period
的用法示例。
在下文中一共展示了Period::frequency方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: schedule
FixedRateBond::FixedRateBond(Natural settlementDays,
const Calendar& calendar,
Real faceAmount,
const Date& startDate,
const Date& maturityDate,
const Period& tenor,
const std::vector<Rate>& coupons,
const DayCounter& accrualDayCounter,
BusinessDayConvention accrualConvention,
BusinessDayConvention paymentConvention,
Real redemption,
const Date& issueDate,
const Date& stubDate,
DateGeneration::Rule rule,
bool endOfMonth,
const Calendar& paymentCalendar)
: Bond(settlementDays,
paymentCalendar==Calendar() ? calendar : paymentCalendar,
issueDate),
frequency_(tenor.frequency()), dayCounter_(accrualDayCounter) {
maturityDate_ = maturityDate;
Date firstDate, nextToLastDate;
switch (rule) {
case DateGeneration::Backward:
firstDate = Date();
nextToLastDate = stubDate;
break;
case DateGeneration::Forward:
firstDate = stubDate;
nextToLastDate = Date();
break;
case DateGeneration::Zero:
case DateGeneration::ThirdWednesday:
case DateGeneration::Twentieth:
case DateGeneration::TwentiethIMM:
QL_FAIL("stub date (" << stubDate << ") not allowed with " <<
rule << " DateGeneration::Rule");
default:
QL_FAIL("unknown DateGeneration::Rule (" << Integer(rule) << ")");
}
Schedule schedule(startDate, maturityDate_, tenor,
calendar, accrualConvention, accrualConvention,
rule, endOfMonth,
firstDate, nextToLastDate);
cashflows_ = FixedRateLeg(schedule)
.withNotionals(faceAmount)
.withCouponRates(coupons, accrualDayCounter)
.withPaymentCalendar(calendar_)
.withPaymentAdjustment(paymentConvention);
addRedemptionsToCashflows(std::vector<Real>(1, redemption));
QL_ENSURE(!cashflows().empty(), "bond with no cashflows!");
QL_ENSURE(redemptions_.size() == 1, "multiple redemptions created");
}
示例2: frequencyFromPeriod
Frequency frequencyFromPeriod(const Period& p) {
return p.frequency();
}