本文整理匯總了C#中QLNet.Period.frequency方法的典型用法代碼示例。如果您正苦於以下問題:C# Period.frequency方法的具體用法?C# Period.frequency怎麽用?C# Period.frequency使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類QLNet.Period
的用法示例。
在下文中一共展示了Period.frequency方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FixedRateBond
/*! simple annual compounding coupon rates
with internal schedule calculation */
public FixedRateBond(int settlementDays,
Calendar calendar,
double faceAmount,
Date startDate,
Date maturityDate,
Period tenor,
List<double> coupons,
DayCounter accrualDayCounter,
BusinessDayConvention accrualConvention = BusinessDayConvention.Following,
BusinessDayConvention paymentConvention = BusinessDayConvention.Following,
double redemption = 100,
Date issueDate = null,
Date stubDate = null,
DateGeneration.Rule rule = DateGeneration.Rule.Backward,
bool endOfMonth = false,
Calendar paymentCalendar = null,
Period exCouponPeriod = null,
Calendar exCouponCalendar = null,
BusinessDayConvention exCouponConvention = BusinessDayConvention.Unadjusted,
bool exCouponEndOfMonth = false)
: base(settlementDays, paymentCalendar == null ? calendar : paymentCalendar,
issueDate)
{
frequency_ = tenor.frequency();
dayCounter_ = accrualDayCounter;
maturityDate_ = maturityDate;
Date firstDate, nextToLastDate;
switch (rule)
{
case DateGeneration.Rule.Backward:
firstDate = null;
nextToLastDate = stubDate;
break;
case DateGeneration.Rule.Forward:
firstDate = stubDate;
nextToLastDate = null;
break;
case DateGeneration.Rule.Zero:
case DateGeneration.Rule.ThirdWednesday:
case DateGeneration.Rule.Twentieth:
case DateGeneration.Rule.TwentiethIMM:
throw new ApplicationException("stub date (" + stubDate + ") not allowed with " + rule + " DateGeneration::Rule");
default:
throw new ApplicationException("unknown DateGeneration::Rule (" + rule + ")");
}
Schedule schedule = new Schedule(startDate, maturityDate_, tenor,
calendar, accrualConvention, accrualConvention,
rule, endOfMonth,
firstDate, nextToLastDate);
cashflows_ = new FixedRateLeg(schedule)
.withCouponRates(coupons, accrualDayCounter)
.withExCouponPeriod(exCouponPeriod,
exCouponCalendar,
exCouponConvention,
exCouponEndOfMonth)
.withPaymentCalendar(calendar_)
.withNotionals(faceAmount)
.withPaymentAdjustment(paymentConvention);
addRedemptionsToCashflows(new List<double>() { redemption });
if (cashflows().Count == 0)
throw new ApplicationException("bond with no cashflows!");
if (redemptions_.Count != 1)
throw new ApplicationException("multiple redemptions created");
}