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


C# IborIndex.dayCounter方法代碼示例

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


在下文中一共展示了IborIndex.dayCounter方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ForwardRateAgreement

      // Handle<YieldTermStructure> discountCurve = Handle<YieldTermStructure>());
      public ForwardRateAgreement(Date valueDate, Date maturityDate, Position.Type type, double strikeForwardRate,
                                  double notionalAmount, IborIndex index, Handle<YieldTermStructure> discountCurve)
         : base(index.dayCounter(), index.fixingCalendar(), index.businessDayConvention(), index.fixingDays(), new Payoff(),
                 valueDate, maturityDate, discountCurve) {

         fraType_ = type;
         notionalAmount_ = notionalAmount;
         index_ = index;

         if (notionalAmount <= 0.0)
            throw new ApplicationException("notional Amount must be positive");

         // do I adjust this ?
         // valueDate_ = calendar_.adjust(valueDate_,businessDayConvention_);
         Date fixingDate = calendar_.advance(valueDate_, -settlementDays_, TimeUnit.Days);
         forwardRate_ = new InterestRate(index.fixing(fixingDate), index.dayCounter(), Compounding.Simple, Frequency.Once);
         strikeForwardRate_ = new InterestRate(strikeForwardRate, index.dayCounter(), Compounding.Simple, Frequency.Once);
         double strike = notionalAmount_ * strikeForwardRate_.compoundFactor(valueDate_, maturityDate_);
         payoff_ = new ForwardTypePayoff(fraType_, strike);
         // incomeDiscountCurve_ is irrelevant to an FRA
         incomeDiscountCurve_ = discountCurve_;
         // income is irrelevant to FRA - set it to zero
         underlyingIncome_ = 0.0;
         
         index_.registerWith(update);
      }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:27,代碼來源:forwardrateagreement.cs

示例2: DepositRateHelper

 public DepositRateHelper(double rate, IborIndex i)
     : base(rate)
 {
     iborIndex_ = new IborIndex("no-fix", // never take fixing into account
                                i.tenor(), i.fixingDays(), new Currency(),
                                i.fixingCalendar(), i.businessDayConvention(),
                                i.endOfMonth(), i.dayCounter(), termStructureHandle_);
     initializeDates();
 }
開發者ID:StreetConnect,項目名稱:QLNet,代碼行數:9,代碼來源:DepositRateHelper.cs

示例3: FuturesRateHelper

        public FuturesRateHelper(double price, Date immDate, IborIndex i, double convAdj)
            : base(price)
        {
            convAdj_ = new Handle<Quote>(new SimpleQuote(convAdj));

            if (!IMM.isIMMdate(immDate, false)) throw new ArgumentException(immDate + "is not a valid IMM date");
            earliestDate_ = immDate;

            Calendar cal = i.fixingCalendar();
            latestDate_ = cal.advance(immDate, i.tenor(), i.businessDayConvention());
            yearFraction_ = i.dayCounter().yearFraction(earliestDate_, latestDate_);
        }
開發者ID:StreetConnect,項目名稱:QLNet,代碼行數:12,代碼來源:FuturesRateHelper.cs

示例4: FRARateHelper

        public FRARateHelper(double rate, int monthsToStart, IborIndex i)
            : base(rate)
        {
            periodToStart_ = new Period(monthsToStart, TimeUnit.Months);

            iborIndex_ = new IborIndex("no-fix",  // never take fixing into account
                                       i.tenor(), i.fixingDays(), new Currency(),
                                       i.fixingCalendar(), i.businessDayConvention(),
                                       i.endOfMonth(), i.dayCounter(), termStructureHandle_);

            initializeDates();
        }
開發者ID:ammachado,項目名稱:QLNet,代碼行數:12,代碼來源:FRARateHelper.cs

示例5: LiborForwardModelProcess

        public LiborForwardModelProcess(int size, IborIndex index, IDiscretization disc)
            : base(disc)
        {
            size_ = size;
            index_ = index;
            initialValues_ = new InitializedList<double>(size_);
            fixingTimes_ = new InitializedList<double>(size);
            fixingDates_ = new InitializedList<Date>(size_);
            accrualStartTimes_ = new InitializedList<double>(size);
            accrualEndTimes_ = new InitializedList<double>(size);
            accrualPeriod_ = new InitializedList<double>(size_);
            m1 = new Vector(size_);
            m2 = new Vector(size_);
            DayCounter dayCounter = index.dayCounter();
            IList<CashFlow> flows = cashFlows(1);

            if(!(size_ == flows.Count))
                    throw new ArgumentException( "wrong number of cashflows");

            Date settlement = index_.forwardingTermStructure().link.referenceDate();
            Date startDate;
            IborCoupon iborcoupon = (IborCoupon)flows[0];
            startDate = iborcoupon.fixingDate();

            for (int i = 0; i < size_; ++i)
            {
                IborCoupon coupon = (IborCoupon)flows[i];

                if(!(coupon.date() == coupon.accrualEndDate()))
                    throw new ArgumentException("irregular coupon types are not suppported");

                initialValues_[i]=coupon.rate();
                accrualPeriod_[i]=coupon.accrualPeriod();

                fixingDates_[i]=coupon.fixingDate();
                fixingTimes_[i]=dayCounter.yearFraction(startDate, coupon.fixingDate());
                accrualStartTimes_[i]=dayCounter.yearFraction(settlement, coupon.accrualStartDate());
                accrualEndTimes_[i]=dayCounter.yearFraction(settlement, coupon.accrualEndDate());
            }
        }
開發者ID:Yenyenx,項目名稱:qlnet,代碼行數:40,代碼來源:lfmprocess.cs

示例6: MakeVanillaSwap

        public MakeVanillaSwap(Period swapTenor, IborIndex index, double? fixedRate, Period forwardStart) {
            swapTenor_ = swapTenor;
            iborIndex_ = index;
            fixedRate_ = fixedRate;
            forwardStart_ = forwardStart;
            effectiveDate_ = null;
            fixedCalendar_ = floatCalendar_ = index.fixingCalendar();
            
            type_ = VanillaSwap.Type.Payer;
            nominal_ = 1.0;
            fixedTenor_ = new Period(1, TimeUnit.Years);
            floatTenor_ = index.tenor();
            fixedConvention_ = fixedTerminationDateConvention_ = BusinessDayConvention.ModifiedFollowing;
            floatConvention_ = floatTerminationDateConvention_ = index.businessDayConvention();
            fixedRule_ = floatRule_ = DateGeneration.Rule.Backward;
            fixedEndOfMonth_ = floatEndOfMonth_ = false;
            fixedFirstDate_ = fixedNextToLastDate_ = floatFirstDate_ = floatNextToLastDate_ = null;
            floatSpread_ = 0.0;
            fixedDayCount_ = new Thirty360(Thirty360.Thirty360Convention.BondBasis);
            floatDayCount_ = index.dayCounter();

            engine_ = new DiscountingSwapEngine(index.forwardingTermStructure());
        }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:23,代碼來源:Makevanillaswap.cs

示例7: MakeBasisSwap

        public MakeBasisSwap(Period swapTenor, IborIndex index1, IborIndex index2, Period forwardStart)
        {
            swapTenor_ = swapTenor;
             iborIndex1_ = index1;
             iborIndex2_ = index2;
             forwardStart_ = forwardStart;
             effectiveDate_ = null;
             float1Calendar_ = float2Calendar_ = index1.fixingCalendar();

             type_ = BasisSwap.Type.Payer;
             nominal_ = 1.0;
             float1Tenor_ = index1.tenor();
             float2Tenor_ = index2.tenor();
             float1Convention_ = float1TerminationDateConvention_ = index1.businessDayConvention();
             float2Convention_ = float2TerminationDateConvention_ = index2.businessDayConvention();
             float1Rule_ = float2Rule_ = DateGeneration.Rule.Backward;
             float1EndOfMonth_ = float2EndOfMonth_ = false;
             float1FirstDate_ = float1NextToLastDate_ = float2FirstDate_ = float2NextToLastDate_ = null;
             float1Spread_ = float2Spread_ = 0.0;
             float1DayCount_ = index1.dayCounter();
             float2DayCount_ = index2.dayCounter();

             engine_ = new DiscountingBasisSwapEngine(index1.forwardingTermStructure(), index2.forwardingTermStructure());
        }
開發者ID:ammachado,項目名稱:QLNet,代碼行數:24,代碼來源:MakeBasisSwap.cs

示例8: CommonVars

            //public IndexHistoryCleaner indexCleaner;
            // initial setup
            public CommonVars()
            {
                backup = new SavedSettings();
                //indexCleaner = new IndexHistoryCleaner();
                termStructure = new RelinkableHandle<YieldTermStructure>();
                int swapSettlementDays = 2;
                faceAmount = 100.0;
                BusinessDayConvention fixedConvention = BusinessDayConvention.Unadjusted;
                compounding = Compounding.Continuous;
                Frequency fixedFrequency = Frequency.Annual;
                Frequency floatingFrequency = Frequency.Semiannual;
                iborIndex = new Euribor(new Period(floatingFrequency), termStructure);
                Calendar calendar = iborIndex.fixingCalendar();
                swapIndex=  new SwapIndex("EuriborSwapIsdaFixA", new Period(10,TimeUnit.Years), swapSettlementDays,
                                      iborIndex.currency(), calendar,
                                      new Period(fixedFrequency), fixedConvention,
                                      iborIndex.dayCounter(), iborIndex);
                spread = 0.0;
                nonnullspread = 0.003;
                Date today = new Date(24,Month.April,2007);
                Settings.setEvaluationDate(today);

                //Date today = Settings::instance().evaluationDate();
                termStructure.linkTo(Utilities.flatRate(today, 0.05, new Actual365Fixed()));

                pricer = new BlackIborCouponPricer();
                Handle<SwaptionVolatilityStructure> swaptionVolatilityStructure =
                   new Handle<SwaptionVolatilityStructure>(new ConstantSwaptionVolatility(today,
                   new NullCalendar(),BusinessDayConvention.Following, 0.2, new Actual365Fixed()));

                Handle<Quote> meanReversionQuote = new Handle<Quote>(new SimpleQuote(0.01));
                cmspricer = new AnalyticHaganPricer(swaptionVolatilityStructure, GFunctionFactory.YieldCurveModel.Standard, meanReversionQuote);
            }
開發者ID:akasolace,項目名稱:qlnet,代碼行數:35,代碼來源:T_AssetSwap.cs


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