當前位置: 首頁>>代碼示例>>C#>>正文


C# Period.frequency方法代碼示例

本文整理匯總了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");
      }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:81,代碼來源:Fixedratebond.cs


注:本文中的QLNet.Period.frequency方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。