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


C# QLNet.Schedule類代碼示例

本文整理匯總了C#中QLNet.Schedule的典型用法代碼示例。如果您正苦於以下問題:C# Schedule類的具體用法?C# Schedule怎麽用?C# Schedule使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Schedule類屬於QLNet命名空間,在下文中一共展示了Schedule類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FixedRateBond

        public FixedRateBond(int settlementDays, double faceAmount, Schedule schedule,
            List<double> coupons, DayCounter accrualDayCounter,
            BusinessDayConvention paymentConvention, double redemption, Date issueDate)
            : this(settlementDays, faceAmount, schedule, coupons, accrualDayCounter,
				   paymentConvention, redemption, issueDate, new Calendar())
        {
        }
開發者ID:ammachado,項目名稱:QLNet,代碼行數:7,代碼來源:Fixedratebond.cs

示例2: CmsLeg

 public CmsLeg(Schedule schedule, SwapIndex swapIndex) {
     schedule_ = schedule;
     index_ = swapIndex;
     paymentAdjustment_ = BusinessDayConvention.Following;
     inArrears_ = false;
     zeroPayments_ = false;
 }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:7,代碼來源:CmsCoupon.cs

示例3: FixedRateBond

      //! fixed-rate bond
      /*! \ingroup instruments

          \test calculations are tested by checking results against
                cached values.
      */
 

      //! simple annual compounding coupon rates      
      public FixedRateBond(int settlementDays, double faceAmount, Schedule schedule,List<double> coupons, 
                           DayCounter accrualDayCounter, BusinessDayConvention paymentConvention = BusinessDayConvention.Following,
                           double redemption = 100, Date issueDate = null,Calendar paymentCalendar = null,
			                  Period exCouponPeriod = null,
                           Calendar exCouponCalendar = null,
									BusinessDayConvention exCouponConvention = BusinessDayConvention.Unadjusted,
                           bool exCouponEndOfMonth = false)
         : base(settlementDays, paymentCalendar == null ? schedule.calendar() : paymentCalendar, 
                issueDate) 
      {
         frequency_ = schedule.tenor().frequency();
         dayCounter_ = accrualDayCounter;
         maturityDate_ = schedule.endDate();

         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,代碼行數:41,代碼來源:Fixedratebond.cs

示例4: FloatingRateBond

        public FloatingRateBond(int settlementDays, double faceAmount, Schedule schedule, IborIndex index,
            DayCounter paymentDayCounter, BusinessDayConvention paymentConvention, int fixingDays,
            List<double> gearings, List<double> spreads)
            : this(settlementDays, faceAmount, schedule, index, paymentDayCounter, BusinessDayConvention.Following,
				   fixingDays, gearings, spreads, new List<double>(), new List<double>(), false, 100, null)
        {
        }
開發者ID:ariesy,項目名稱:QLNet,代碼行數:7,代碼來源:FloatingRateBond.cs

示例5: testFairRate

        public void testFairRate()
        {
            Calendar calendar = new TARGET();

             Date settlementDate = new Date(10, Month.Mar, 2010);

             /*********************
             * LOAN TO BE PRICED *
             **********************/

             // constant nominal 1,000,000 Euro
             double nominal = 1000000.0;
             // fixed leg
             Frequency fixedLegFrequency = Frequency.Monthly;
             BusinessDayConvention fixedLegConvention = BusinessDayConvention.Unadjusted;
             BusinessDayConvention principalLegConvention = BusinessDayConvention.ModifiedFollowing;
             DayCounter fixedLegDayCounter = new Thirty360(Thirty360.Thirty360Convention.European);
             double fixedRate = 0.04;

             // Principal leg
             Frequency pricipalLegFrequency = Frequency.Annual;

             int lenghtInMonths = 3;
             Loan.Type loanType = Loan.Type.Payer;

             Date maturity = settlementDate + new Period(lenghtInMonths, TimeUnit.Years);
             Schedule fixedSchedule = new Schedule(settlementDate, maturity, new Period(fixedLegFrequency),
                                  calendar, fixedLegConvention, fixedLegConvention, DateGeneration.Rule.Forward, false);
             Schedule principalSchedule = new Schedule(settlementDate, maturity, new Period(pricipalLegFrequency),
                                  calendar, principalLegConvention, principalLegConvention, DateGeneration.Rule.Forward, false);
             Loan testLoan = new FixedLoan(loanType, nominal, fixedSchedule, fixedRate, fixedLegDayCounter,
                                     principalSchedule, principalLegConvention);
        }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:33,代碼來源:T_Loan.cs

示例6: BasisSwap

 // constructor
 public BasisSwap(Type type, double nominal,
     Schedule float1Schedule, IborIndex iborIndex1, double spread1, DayCounter float1DayCount,
     Schedule float2Schedule, IborIndex iborIndex2, double spread2, DayCounter float2DayCount)
     : this(type, nominal, float1Schedule, iborIndex1, spread1, float1DayCount,
                        float2Schedule, iborIndex2, spread2, float2DayCount, null)
 {
 }
開發者ID:ariesy,項目名稱:QLNet,代碼行數:8,代碼來源:BasisSwap.cs

示例7: AmortizingFixedRateBond

      public AmortizingFixedRateBond(
                          int settlementDays,
                          List<double> notionals,
                          Schedule schedule,
                          List<double> coupons,
                          DayCounter accrualDayCounter,
                          BusinessDayConvention paymentConvention = BusinessDayConvention.Following,
                          Date issueDate = null)
         :base(settlementDays, schedule.calendar(), issueDate)
      {
         frequency_ = schedule.tenor().frequency();
         dayCounter_ = accrualDayCounter;
         schedule_ = schedule;

         maturityDate_ = schedule.endDate();

         cashflows_ = new FixedRateLeg(schedule)
             .withCouponRates(coupons, accrualDayCounter)
             .withNotionals(notionals)
             .withPaymentAdjustment(paymentConvention).value();
             

         addRedemptionsToCashflows();

         if ( cashflows().empty())
            throw new ApplicationException("bond with no cashflows!");
      }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:27,代碼來源:AmortizingFixedRateBond.cs

示例8: FloatingRateBond

        public FloatingRateBond(int settlementDays, double faceAmount, Schedule schedule, IborIndex index, DayCounter paymentDayCounter,
                                BusinessDayConvention paymentConvention, int fixingDays, List<double> gearings, List<double> spreads,
                                List<double> caps, List<double> floors, bool inArrears, double redemption, Date issueDate)
            : base(settlementDays, schedule.calendar(), issueDate) {
            maturityDate_ = schedule.endDate();
            cashflows_ = new IborLeg(schedule, index)
                            .withPaymentDayCounter(paymentDayCounter)
                            .withFixingDays(fixingDays)
                            .withGearings(gearings)
                            .withSpreads(spreads)
                            .withCaps(caps)
                            .withFloors(floors)
                            .inArrears(inArrears)
                            .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");

            index.registerWith(update);
        }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:25,代碼來源:FloatingRateBond.cs

示例9: testCashedValues

        public void testCashedValues()
        {
            Date startDate = new Date(01, 03, 2007);
             Period period = new Period(360, TimeUnit.Months);
             Calendar calendar = new TARGET();
             Date endDate = calendar.advance(startDate,period,BusinessDayConvention.Unadjusted);

             Schedule schedule = new Schedule( startDate, endDate, new Period(1,TimeUnit.Months), calendar,
                                           BusinessDayConvention.Unadjusted,
                                           BusinessDayConvention.Unadjusted,
                                           DateGeneration.Rule.Backward, false);

             // PSA 100%
             PSACurve psa100 = new PSACurve(startDate);
             double[] listCPR = {0.2000,0.4000,0.6000,0.8000,1.0000,1.2000,1.4000,1.6000,1.8000,2.0000,2.2000,2.4000,2.6000,2.8000,
                             3.0000,3.2000,3.4000,3.6000,3.8000,4.0000,4.2000,4.4000,4.6000,4.8000,5.0000,5.2000,5.4000,5.6000,
                             5.8000,6.0000};

             for (int i = 0; i < schedule.Count; i++)
             {
            if ( i <= 29 )
               Assert.AreEqual(listCPR[i], psa100.getCPR(schedule[i])*100,0.001);
            else
               Assert.AreEqual(6.0000, psa100.getCPR(schedule[i])*100);
             }
        }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:26,代碼來源:T_PSACurve.cs

示例10: ConvertibleBond

        protected ConvertibleBond( Exercise exercise,
                                 double conversionRatio,
                                 DividendSchedule dividends,
                                 CallabilitySchedule callability,
                                 Handle<Quote> creditSpread,
                                 Date issueDate,
                                 int settlementDays,
                                 Schedule schedule,
                                 double redemption)
            : base(settlementDays, schedule.calendar(), issueDate)
        {
            conversionRatio_ = conversionRatio;
             callability_ = callability;
             dividends_ = dividends;
             creditSpread_ = creditSpread;

             maturityDate_ = schedule.endDate();

             if (!callability.empty())
             {
            Utils.QL_REQUIRE( callability.Last().date() <= maturityDate_, () =>
                              "last callability date ("
                              + callability.Last().date()
                              + ") later than maturity ("
                              + maturityDate_.ToShortDateString() + ")");
            }

             creditSpread.registerWith(update);
        }
開發者ID:Yenyenx,項目名稱:qlnet,代碼行數:29,代碼來源:ConvertibleBond.cs

示例11: FixedRateBondHelper

        //public FixedRateBondHelper(Quote cleanPrice, int settlementDays, double faceAmount, Schedule schedule,
        //                   List<double> coupons, DayCounter dayCounter,
        //                   BusinessDayConvention paymentConv = Following,
        //                   double redemption = 100.0,
        //                   Date issueDate = null);
        public FixedRateBondHelper(Handle<Quote> cleanPrice, int settlementDays, double faceAmount, Schedule schedule,
                                   List<double> coupons, DayCounter dayCounter, BusinessDayConvention paymentConvention,
                                   double redemption, Date issueDate)
            : base(cleanPrice, new FixedRateBond(settlementDays, faceAmount, schedule,
                                                 coupons, dayCounter, paymentConvention,
                                                 redemption, issueDate)) {

            fixedRateBond_ = bond_ as FixedRateBond;
        }
開發者ID:minikie,項目名稱:OTCDerivativesCalculatorModule,代碼行數:14,代碼來源:Bondhelpers.cs

示例12: testATMRate

        public void testATMRate()
        {
            CommonVars vars = new CommonVars();

            int[] lengths = { 1, 2, 3, 5, 7, 10, 15, 20 };
            double[] strikes = { 0.0, 0.03, 0.04, 0.05, 0.06, 0.07 };
            double[] vols = { 0.01, 0.05, 0.10, 0.15, 0.20 };

            Date startDate = vars.termStructure.link.referenceDate();

            for (int i = 0; i < lengths.Length; i++) {
                List<CashFlow> leg = vars.makeLeg(startDate, lengths[i]);
                Date maturity = vars.calendar.advance(startDate, lengths[i], TimeUnit.Years, vars.convention);
                Schedule schedule = new Schedule(startDate, maturity,
                                                 new Period(vars.frequency), vars.calendar,
                                                 vars.convention, vars.convention,
                                                 DateGeneration.Rule.Forward, false);

                for (int j = 0; j < strikes.Length; j++) {
                    for (int k = 0; k < vols.Length; k++) {

                        CapFloor cap = vars.makeCapFloor(CapFloorType.Cap, leg, strikes[j], vols[k]);
                        CapFloor floor = vars.makeCapFloor(CapFloorType.Floor, leg, strikes[j], vols[k]);
                        double capATMRate = cap.atmRate(vars.termStructure);
                        double floorATMRate = floor.atmRate(vars.termStructure);

                        if (!checkAbsError(floorATMRate, capATMRate, 1.0e-10))
                            Assert.Fail(
                              "Cap ATM Rate and floor ATM Rate should be equal :\n"
                              + "   length:        " + lengths[i] + " years\n"
                              + "   volatility:    " + vols[k] + "\n"
                              + "   strike:        " + strikes[j] + "\n"
                              + "   cap ATM rate:  " + capATMRate + "\n"
                              + "   floor ATM rate:" + floorATMRate + "\n"
                              + "   relative Error:"
                              + Utilities.relativeError(capATMRate, floorATMRate, capATMRate) * 100 + "%");
                        VanillaSwap swap = new VanillaSwap(VanillaSwap.Type.Payer, vars.nominals[0],
                                                           schedule, floorATMRate,
                                                           vars.index.dayCounter(),
                                                           schedule, vars.index, 0.0,
                                                           vars.index.dayCounter());
                        swap.setPricingEngine((IPricingEngine)(
                                               new DiscountingSwapEngine(vars.termStructure)));
                        double swapNPV = swap.NPV();
                        if (!checkAbsError(swapNPV, 0, 1.0e-10))
                            Assert.Fail(
                              "the NPV of a Swap struck at ATM rate "
                              + "should be equal to 0:\n"
                              + "   length:        " + lengths[i] + " years\n"
                              + "   volatility:    " + vols[k] + "\n"
                              + "   ATM rate:      " + floorATMRate + "\n"
                              + "   swap NPV:      " + swapNPV);

                    }
                }
            }
        }
開發者ID:tickzoom,項目名稱:QLNet,代碼行數:57,代碼來源:T_CapFloor.cs

示例13: AverageBMACoupon

        private int bmaCutoffDays = 0; // to be verified

        // double gearing = 1.0, double spread = 0.0, 
        // Date refPeriodStart = Date(), Date refPeriodEnd = Date(), DayCounter dayCounter = DayCounter());
        public AverageBMACoupon(double nominal, Date paymentDate, Date startDate, Date endDate, BMAIndex index,
                                double gearing, double spread, Date refPeriodStart, Date refPeriodEnd, DayCounter dayCounter)
            : base(nominal, paymentDate, startDate, endDate, index.fixingDays(), index, gearing, spread,
                         refPeriodStart, refPeriodEnd, dayCounter, false) {
            fixingSchedule_ = index.fixingSchedule(
                                index.fixingCalendar()
                                    .advance(startDate, new Period(-index.fixingDays() + bmaCutoffDays, TimeUnit.Days),
                                                   BusinessDayConvention.Preceding), endDate);
            setPricer(new AverageBMACouponPricer());
        }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:14,代碼來源:averagebmacoupon.cs

示例14: yoyInflationLeg

 public yoyInflationLeg(Schedule schedule,Calendar cal,
                        YoYInflationIndex index,
                        Period observationLag)
 {
    schedule_ = schedule;
    index_ = index;
    observationLag_ = observationLag;
    paymentAdjustment_ = BusinessDayConvention.ModifiedFollowing;
    paymentCalendar_ = cal;
 }
開發者ID:jrviala,項目名稱:qlnet,代碼行數:10,代碼來源:YoYInflationCoupon.cs

示例15: DigitalIborLeg

 public DigitalIborLeg(Schedule schedule, IborIndex index)
 {
    schedule_ = schedule;
    index_ = index;
    paymentAdjustment_ = BusinessDayConvention.Following;
    inArrears_ = false;
    longCallOption_ = Position.Type.Long;
    callATM_ = false;
    longPutOption_ = Position.Type.Long;
    putATM_ = false;
 }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:11,代碼來源:DigitalIborCoupon.cs


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