当前位置: 首页>>代码示例>>C#>>正文


C# Bond.notional方法代码示例

本文整理汇总了C#中Bond.notional方法的典型用法代码示例。如果您正苦于以下问题:C# Bond.notional方法的具体用法?C# Bond.notional怎么用?C# Bond.notional使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bond的用法示例。


在下文中一共展示了Bond.notional方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: isTradable

      public static bool isTradable(Bond bond, Date settlementDate = null)
      {
         if (settlementDate == null)
            settlementDate = bond.settlementDate();

         return bond.notional(settlementDate) != 0.0;
      }
开发者ID:minikie,项目名称:test,代码行数:7,代码来源:BondFunctions.cs

示例2: AssetSwap

        public AssetSwap(bool payBondCoupon,
                       Bond bond,
                       double bondCleanPrice,
                       IborIndex iborIndex,
                       double spread,
                       Schedule floatSchedule = null,
                       DayCounter floatingDayCount = null,
                       bool parAssetSwap = true)
            : base(2)
        {
            bond_ = bond;
             bondCleanPrice_ = bondCleanPrice;
             nonParRepayment_ = 100;
             spread_ = spread;
             parSwap_ = parAssetSwap;

             Schedule schedule = floatSchedule;
             if (floatSchedule == null)
            schedule = new Schedule(bond_.settlementDate(),
                                    bond_.maturityDate(),
                                    iborIndex.tenor(),
                                    iborIndex.fixingCalendar(),
                                    iborIndex.businessDayConvention(),
                                    iborIndex.businessDayConvention(),
                                    DateGeneration.Rule.Backward,
                                    false); // endOfMonth

             // the following might become an input parameter
             BusinessDayConvention paymentAdjustment = BusinessDayConvention.Following;

             Date finalDate = schedule.calendar().adjust(schedule.endDate(), paymentAdjustment);
             Date adjBondMaturityDate = schedule.calendar().adjust(bond_.maturityDate(), paymentAdjustment);

             Utils.QL_REQUIRE( finalDate == adjBondMaturityDate, () =>
                          "adjusted schedule end date (" +
                          finalDate +
                          ") must be equal to adjusted bond maturity date (" +
                          adjBondMaturityDate + ")");

             // bondCleanPrice must be the (forward) clean price
             // at the floating schedule start date
             upfrontDate_ = schedule.startDate();
             double dirtyPrice = bondCleanPrice_ +
                             bond_.accruedAmount(upfrontDate_);

             double notional = bond_.notional(upfrontDate_);
             /* In the market asset swap, the bond is purchased in return for
            payment of the full price. The notional of the floating leg is
            then scaled by the full price. */
             if (!parSwap_)
            notional *= dirtyPrice / 100.0;

             if (floatingDayCount == null)
            legs_[1] = new IborLeg(schedule, iborIndex)
                .withSpreads(spread)
                .withNotionals(notional)
                .withPaymentAdjustment(paymentAdjustment);
             else
            legs_[1] = new IborLeg(schedule, iborIndex)
                .withSpreads(spread)
                .withPaymentDayCounter(floatingDayCount)
                .withNotionals(notional)
                .withPaymentAdjustment(paymentAdjustment);

             foreach (CashFlow c in legs_[1])
            c.registerWith(update);

             List<CashFlow> bondLeg = bond_.cashflows();
             foreach (CashFlow c in bondLeg)
             {
            // whatever might be the choice for the discounting engine
            // bond flows on upfrontDate_ must be discarded
            bool upfrontDateBondFlows = false;
            if (!(c.hasOccurred(upfrontDate_, upfrontDateBondFlows)))
               legs_[0].Add(c);
             }

             Utils.QL_REQUIRE( !legs_[0].empty(), () => "empty bond leg to start with" );

             // special flows
             if (parSwap_)
             {
            // upfront on the floating leg
            double upfront = (dirtyPrice - 100.0) / 100.0 * notional;
            CashFlow upfrontCashFlow = new SimpleCashFlow(upfront, upfrontDate_);
            legs_[1].Insert(0, upfrontCashFlow);
            // backpayment on the floating leg
            // (accounts for non-par redemption, if any)
            double backPayment = notional;
            CashFlow backPaymentCashFlow = new SimpleCashFlow(backPayment, finalDate);
            legs_[1].Add(backPaymentCashFlow);
             }
             else
             {
            // final notional exchange
            CashFlow finalCashFlow = new SimpleCashFlow(notional, finalDate);
            legs_[1].Add(finalCashFlow);
             }

             Utils.QL_REQUIRE( !legs_[0].empty(), () => "empty bond leg" );
//.........这里部分代码省略.........
开发者ID:Yenyenx,项目名称:qlnet,代码行数:101,代码来源:AssetSwap.cs

示例3: zSpread

      public static double zSpread(Bond bond, double cleanPrice, YieldTermStructure discount, DayCounter dayCounter, Compounding compounding,
                             Frequency frequency, Date settlementDate = null, double accuracy = 1.0e-10, int maxIterations = 100,
                             double guess = 0.0)
      {
         if (settlementDate == null)
            settlementDate = bond.settlementDate();

         Utils.QL_REQUIRE( BondFunctions.isTradable( bond, settlementDate ), () =>
                   "non tradable at " + settlementDate +
                   " (maturity being " + bond.maturityDate() + ")");

         double dirtyPrice = cleanPrice + bond.accruedAmount(settlementDate);
         dirtyPrice /= 100.0 / bond.notional(settlementDate);

         return CashFlows.zSpread(bond.cashflows(),
                                  discount,
                                  dirtyPrice,
                                  dayCounter, compounding, frequency,
                                  false, settlementDate, settlementDate,
                                  accuracy, maxIterations, guess);
      }
开发者ID:minikie,项目名称:test,代码行数:21,代码来源:BondFunctions.cs

示例4: bps

      public static double bps(Bond bond, InterestRate yield, Date settlementDate = null)
      {
         if (settlementDate == null)
            settlementDate = bond.settlementDate();

         Utils.QL_REQUIRE( BondFunctions.isTradable( bond, settlementDate ), () =>
                   "non tradable at " + settlementDate +
                   " (maturity being " + bond.maturityDate() + ")");

         return CashFlows.bps(bond.cashflows(), yield, false, settlementDate) *
                              100.0 / bond.notional(settlementDate);
      }
开发者ID:minikie,项目名称:test,代码行数:12,代码来源:BondFunctions.cs

示例5: cleanPrice

      public static double cleanPrice(Bond bond, YieldTermStructure discount, double zSpread, DayCounter dayCounter, Compounding compounding,
                                Frequency frequency, Date settlementDate = null)
      {
         if (settlementDate == null)
            settlementDate = bond.settlementDate();

         Utils.QL_REQUIRE( BondFunctions.isTradable( bond, settlementDate ), () =>
                   "non tradable at " + settlementDate +
                   " (maturity being " + bond.maturityDate() + ")");

         double dirtyPrice = CashFlows.npv(bond.cashflows(), discount, zSpread, dayCounter, compounding, frequency, false, settlementDate) *
                             100.0 / bond.notional(settlementDate);
         return dirtyPrice - bond.accruedAmount(settlementDate);
      }
开发者ID:minikie,项目名称:test,代码行数:14,代码来源:BondFunctions.cs

示例6: atmRate

      public static double atmRate(Bond bond, YieldTermStructure discountCurve, Date settlementDate = null, double? cleanPrice = null)
      {
         if (settlementDate == null)
            settlementDate = bond.settlementDate();

         Utils.QL_REQUIRE( BondFunctions.isTradable( bond, settlementDate ), () =>
                   "non tradable at " + settlementDate +
                   " (maturity being " + bond.maturityDate() + ")");

         double? dirtyPrice = cleanPrice == null ? null : cleanPrice + bond.accruedAmount(settlementDate);
         double currentNotional = bond.notional(settlementDate);
         double? npv = dirtyPrice / 100.0 * currentNotional;

         return CashFlows.atmRate(bond.cashflows(), discountCurve, false, settlementDate, settlementDate, npv);
      }
开发者ID:minikie,项目名称:test,代码行数:15,代码来源:BondFunctions.cs

示例7: accruedAmount

        public static double accruedAmount(Bond bond, Date settlementDate = null)
        {
            if (settlementDate == null)
            settlementDate = bond.settlementDate();

             Utils.QL_REQUIRE(BondFunctions.isTradable(bond, settlementDate),
                   "non tradable at " + settlementDate +
                   " (maturity being " + bond.maturityDate() + ")");

             return CashFlows.accruedAmount(bond.cashflows(), false, settlementDate) * 100.0 / bond.notional(settlementDate);
        }
开发者ID:huxletic,项目名称:qlnet,代码行数:11,代码来源:BondFunctions.cs

示例8: cleanPrice

        public static double cleanPrice(Bond bond, InterestRate yield, Date settlementDate = null)
        {
            if (settlementDate == null)
            settlementDate = bond.settlementDate();

             Utils.QL_REQUIRE(BondFunctions.isTradable(bond, settlementDate),
                   "non tradable at " + settlementDate +
                   " (maturity being " + bond.maturityDate() + ")");

             double dirtyPrice = CashFlows.npv(bond.cashflows(), yield, false, settlementDate) *
                             100.0 / bond.notional(settlementDate);
             return dirtyPrice - bond.accruedAmount(settlementDate);
        }
开发者ID:huxletic,项目名称:qlnet,代码行数:13,代码来源:BondFunctions.cs

示例9: bps

        public static double bps(Bond bond, YieldTermStructure discountCurve, Date settlementDate = null)
        {
            if (settlementDate == null)
            settlementDate = bond.settlementDate();

             Utils.QL_REQUIRE(BondFunctions.isTradable(bond, settlementDate),
                   "non tradable at " + settlementDate +
                   " (maturity being " + bond.maturityDate() + ")");

             return CashFlows.bps(bond.cashflows(), discountCurve, false, settlementDate) * 100.0 / bond.notional(settlementDate);
        }
开发者ID:huxletic,项目名称:qlnet,代码行数:11,代码来源:BondFunctions.cs


注:本文中的Bond.notional方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。