• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Bond类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: nextCashFlowDate

      public static Date nextCashFlowDate(Bond bond, Date refDate = null)
      {
         if (refDate == null)
            refDate = bond.settlementDate();

         return CashFlows.nextCashFlowDate(bond.cashflows(), false, refDate);
      }
开发者ID:minikie,项目名称:test,代码行数:7,代码来源:BondFunctions.cs


示例2: 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


示例3: previousCashFlow

      public static CashFlow previousCashFlow(Bond bond, Date refDate = null)
      {
         if (refDate == null)
            refDate = bond.settlementDate();

         return CashFlows.previousCashFlow(bond.cashflows(), false, refDate);
      }
开发者ID:minikie,项目名称:test,代码行数:7,代码来源:BondFunctions.cs


示例4: SendBondData

        public string SendBondData(Bond obj)
        {
            PropertyInfo[] properties = obj.GetType().GetProperties();

            if (obj == null)
                return "False";
            else
            {
                DataTable tempTable = new DataTable();
                List<string> columnList = DataAccessLayer.DAL.GetColumnNames("Bond", true);
                for (int i = 0; i < columnList.Count && columnList[i] != ""; i++)
                {
                    DataColumn dc = new DataColumn(columnList[i], typeof(string));
                    tempTable.Columns.Add(dc);
                }

                DataRow dr = tempTable.NewRow();
                foreach (PropertyInfo p in properties)
                {
                    dr[p.Name] = p.GetValue(obj, null);
                }
                tempTable.Rows.Add(dr);

                return DataAccessLayer.DAL.SendDataToDB(tempTable, "Bond").ToString();
            }
        }
开发者ID:abhipanorian,项目名称:Projects,代码行数:26,代码来源:OurService.svc.cs


示例5: Main

 static void Main(string[] args)
 {
     DependencyInversionTradeController ditc = new DependencyInversionTradeController();
     Gilt gilt = new Gilt() { value = 10 };
     Bond bond = new Bond() { value = 100 };
     ditc.TradeStock(gilt);
     ditc.TradeStock(bond);
 }
开发者ID:RajeevArora93,项目名称:Projects,代码行数:8,代码来源:Program.cs


示例6: BondHelper

        /*! \warning Setting a pricing engine to the passed bond from
                     external code will cause the bootstrap to fail or
                     to give wrong results. It is advised to discard
                     the bond after creating the helper, so that the
                     helper has sole ownership of it.
        */
        public BondHelper(Handle<Quote> cleanPrice, Bond bond) : base(cleanPrice) {
            bond_ = bond;

            latestDate_ = bond_.maturityDate();
            initializeDates();

            IPricingEngine bondEngine = new DiscountingBondEngine(termStructureHandle_);
            bond_.setPricingEngine(bondEngine);        
        }
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:15,代码来源:Bondhelpers.cs


示例7: accrualStartDate

        public static Date accrualStartDate(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.accrualStartDate(bond.cashflows(), false, settlementDate);
        }
开发者ID:huxletic,项目名称:qlnet,代码行数:11,代码来源:BondFunctions.cs


示例8: SendBondData

        public string SendBondData(Bond obj)
        {
            if (obj == null)
                return "False";
            else
            {
                DataTable tempTable = new DataTable();
                List<string> columnList = DataAccessLayer.DAL.GetColumnNames("Bond");
                for (int i = 0; i < columnList.Count && columnList[i] != ""; i++)
                {
                    DataColumn dc = new DataColumn(columnList[i], typeof(string));
                    tempTable.Columns.Add(dc);
                }
                
                tempTable.Rows.Add(new Object[] { obj.securityName, obj.securityDescription, obj.assetType,obj.investmentType,
                    obj.tradingFactor,obj.pricingFactor,obj.isin,obj.bloombergTicker,
                    obj.bloombergUniqueID,obj.cusip,obj.sedol,obj.firstCouponDate,obj.cap,obj.floor,
                    obj.couponFrequency,obj.coupon,obj.couponType,obj.spread,
                    obj.callableFlag,obj.fixToFloatFlag,obj.putableFlag,obj.issueDate,
                    obj.lastResetDate,obj.maturity,obj.callNotificationMaxDays,obj.putNotificationMaxDays,
                    obj.penultimateCouponDate,obj.resetFrequency,obj.hasPosition,obj.macaulayDuration,
                    obj.thirtyDayVolatility,obj.ninetyDayVolatility,obj.convexity,obj.thirtyDayAvgVolume,
                    obj.formPFAssetClass,obj.formPFCountry,obj.formPFCreditRating,obj.formPFCurrency,
                    obj.formPFInstrument,obj.formPFLiquidityProfile,obj.formPFMaturity,obj.formPFNAICSCode,
                    obj.formPFRegion,obj.formPFSector,obj.formPFSubAssetClass,obj.bloombergIndustryGroup,
                    obj.bloombergIndustrySubGroup,obj.bloombergIndustrySector,obj.countryOfIssuance,obj.issueCurrency,
                    obj.issuer,obj.riskCurrency,obj.putDate,obj.putPrice,
                    obj.askPrice,obj.highPrice,obj.lowPrice,obj.openPrice,
                    obj.volume,obj.bidPrice,obj.lastPrice,obj.callDate,
                    obj.callPrice });

                Console.WriteLine(tempTable.Columns.Count);

                DataAccessLayer.DAL.SendDataToDB(tempTable, "Bond");
                return "True";
            }
        }
开发者ID:abhipanorian,项目名称:Visual-Studio-2010,代码行数:37,代码来源:OurService.svc.cs


示例9: testZSpreadWithGenericBond

        public void testZSpreadWithGenericBond()
        {
            // Testing clean and dirty price with null Z-spread against theoretical prices...

             CommonVars vars = new CommonVars();

             Calendar bondCalendar = new TARGET();
             int settlementDays = 3;
             int fixingDays = 2;
             bool inArrears = false;

             // Fixed Underlying bond (Isin: DE0001135275 DBR 4 01/04/37)
             // maturity doesn't occur on a business day

             Date fixedBondStartDate1 = new Date(4,Month.January,2005);
             Date fixedBondMaturityDate1 = new Date(4,Month.January,2037);
             Schedule fixedBondSchedule1= new Schedule(fixedBondStartDate1,
                                    fixedBondMaturityDate1,
                                    new Period(Frequency.Annual), bondCalendar,
                                    BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,
                                    DateGeneration.Rule.Backward, false);
             List<CashFlow> fixedBondLeg1 = new FixedRateLeg(fixedBondSchedule1)
            .withCouponRates(0.04, new ActualActual(ActualActual.Convention.ISDA))
            .withNotionals(vars.faceAmount);
             Date fixedbondRedemption1 = bondCalendar.adjust(fixedBondMaturityDate1,
                                                         BusinessDayConvention.Following);
             fixedBondLeg1.Add(new SimpleCashFlow(100.0, fixedbondRedemption1));
             Bond fixedBond1 = new Bond(settlementDays, bondCalendar, vars.faceAmount, fixedBondMaturityDate1, fixedBondStartDate1,
                  fixedBondLeg1);
             IPricingEngine bondEngine = new DiscountingBondEngine(vars.termStructure);
             fixedBond1.setPricingEngine(bondEngine);

             double fixedBondImpliedValue1 = fixedBond1.cleanPrice();
             Date fixedBondSettlementDate1= fixedBond1.settlementDate();
             // standard market conventions:
             // bond's frequency + coumpounding and daycounter of the YieldCurve
             double fixedBondCleanPrice1 = BondFunctions.cleanPrice(fixedBond1, vars.termStructure, vars.spread,
            new Actual365Fixed(), vars.compounding, Frequency.Annual, fixedBondSettlementDate1);
             double tolerance = 1.0e-13;
             double error1 = Math.Abs(fixedBondImpliedValue1-fixedBondCleanPrice1);
             if (error1>tolerance) {
            Assert.Fail("wrong clean price for fixed bond:"
                        + "\n  market asset swap spread: "
                        + fixedBondImpliedValue1
                        + "\n  par asset swap spread: " + fixedBondCleanPrice1
                        + "\n  error:                 " + error1
                        + "\n  tolerance:             " + tolerance);
             }

             // Fixed Underlying bond (Isin: IT0006527060 IBRD 5 02/05/19)
             // maturity occurs on a business day

             Date fixedBondStartDate2 = new Date(5,Month.February,2005);
             Date fixedBondMaturityDate2 = new Date(5,Month.February,2019);
             Schedule fixedBondSchedule2= new Schedule(fixedBondStartDate2,
                                    fixedBondMaturityDate2,
                                    new Period(Frequency.Annual), bondCalendar,
                                    BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,
                                    DateGeneration.Rule.Backward, false);
             List<CashFlow> fixedBondLeg2 = new FixedRateLeg(fixedBondSchedule2)
            .withCouponRates(0.05, new Thirty360(Thirty360.Thirty360Convention.BondBasis))
            .withNotionals(vars.faceAmount);
             Date fixedbondRedemption2 = bondCalendar.adjust(fixedBondMaturityDate2, BusinessDayConvention.Following);
             fixedBondLeg2.Add(new SimpleCashFlow(100.0, fixedbondRedemption2));
             Bond fixedBond2 = new Bond(settlementDays, bondCalendar, vars.faceAmount,
                  fixedBondMaturityDate2, fixedBondStartDate2, fixedBondLeg2);
             fixedBond2.setPricingEngine(bondEngine);

             double fixedBondImpliedValue2 = fixedBond2.cleanPrice();
             Date fixedBondSettlementDate2= fixedBond2.settlementDate();
             // standard market conventions:
             // bond's frequency + coumpounding and daycounter of the YieldCurve

             double fixedBondCleanPrice2 = BondFunctions.cleanPrice(fixedBond2, vars.termStructure, vars.spread,
            new Actual365Fixed(), vars.compounding, Frequency.Annual, fixedBondSettlementDate2);
             double error3 = Math.Abs(fixedBondImpliedValue2-fixedBondCleanPrice2);
             if (error3>tolerance) {
            Assert.Fail("wrong clean price for fixed bond:"
                        + "\n  market asset swap spread: "
                        + fixedBondImpliedValue2
                        + "\n  par asset swap spread: " + fixedBondCleanPrice2
                        + "\n  error:                 " + error3
                        + "\n  tolerance:             " + tolerance);
             }

             // FRN Underlying bond (Isin: IT0003543847 ISPIM 0 09/29/13)
             // maturity doesn't occur on a business day

             Date floatingBondStartDate1 = new Date(29,Month.September,2003);
             Date floatingBondMaturityDate1 = new Date(29,Month.September,2013);
             Schedule floatingBondSchedule1= new Schedule(floatingBondStartDate1,
                                       floatingBondMaturityDate1,
                                       new Period(Frequency.Semiannual), bondCalendar,
                                       BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,
                                       DateGeneration.Rule.Backward, false);
             List<CashFlow> floatingBondLeg1 = new IborLeg(floatingBondSchedule1, vars.iborIndex)
            .withPaymentDayCounter(new Actual360())
            .withFixingDays(fixingDays)
            .withSpreads(0.0056)
            .inArrears(inArrears)
//.........这里部分代码省略.........
开发者ID:akasolace,项目名称:qlnet,代码行数:101,代码来源:T_AssetSwap.cs


示例10: testMASWWithGenericBond

        public void testMASWWithGenericBond()
        {
            // Testing market asset swap against par asset swap with generic bond...

             CommonVars vars = new CommonVars();

             Calendar bondCalendar = new TARGET();
             int settlementDays = 3;
             int fixingDays = 2;
             bool payFixedRate = true;
             bool parAssetSwap = true;
             bool mktAssetSwap = false;
             bool inArrears = false;

             // Fixed Underlying bond (Isin: DE0001135275 DBR 4 01/04/37)
             // maturity doesn't occur on a business day

             Date fixedBondStartDate1 = new Date(4,Month.January,2005);
             Date fixedBondMaturityDate1 = new Date(4,Month.January,2037);
             Schedule fixedBondSchedule1 = new Schedule(fixedBondStartDate1,
                                    fixedBondMaturityDate1,
                                    new Period(Frequency.Annual), bondCalendar,
                                    BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,
                                    DateGeneration.Rule.Backward, false);
             List<CashFlow> fixedBondLeg1 = new FixedRateLeg(fixedBondSchedule1)
            .withCouponRates(0.04, new ActualActual(ActualActual.Convention.ISDA))
            .withNotionals(vars.faceAmount);
             Date fixedbondRedemption1 = bondCalendar.adjust(fixedBondMaturityDate1,   BusinessDayConvention.Following);
             fixedBondLeg1.Add(new SimpleCashFlow(100.0, fixedbondRedemption1));
             Bond fixedBond1 = new Bond(settlementDays, bondCalendar, vars.faceAmount, fixedBondMaturityDate1,
            fixedBondStartDate1, fixedBondLeg1);
             IPricingEngine bondEngine = new DiscountingBondEngine(vars.termStructure);
             IPricingEngine swapEngine = new DiscountingSwapEngine(vars.termStructure);
             fixedBond1.setPricingEngine(bondEngine);

             double fixedBondMktPrice1 = 89.22 ; // market price observed on 7th June 2007
             double fixedBondMktFullPrice1=fixedBondMktPrice1+fixedBond1.accruedAmount();
             AssetSwap fixedBondParAssetSwap1= new AssetSwap(payFixedRate,
                                          fixedBond1, fixedBondMktPrice1,
                                          vars.iborIndex, vars.spread,
                                          null,
                                          vars.iborIndex.dayCounter(),
                                          parAssetSwap);
             fixedBondParAssetSwap1.setPricingEngine(swapEngine);
             double fixedBondParAssetSwapSpread1 = fixedBondParAssetSwap1.fairSpread();
             AssetSwap fixedBondMktAssetSwap1 = new AssetSwap(payFixedRate,
                                          fixedBond1, fixedBondMktPrice1,
                                          vars.iborIndex, vars.spread,
                                          null,
                                          vars.iborIndex.dayCounter(),
                                          mktAssetSwap);
             fixedBondMktAssetSwap1.setPricingEngine(swapEngine);
             double fixedBondMktAssetSwapSpread1 = fixedBondMktAssetSwap1.fairSpread();

             double tolerance = 1.0e-13;
             double error1 =
            Math.Abs(fixedBondMktAssetSwapSpread1-
                     100*fixedBondParAssetSwapSpread1/fixedBondMktFullPrice1);

             if (error1>tolerance)
            Assert.Fail("wrong asset swap spreads for fixed bond:" +
                        "\n  market asset swap spread: " + fixedBondMktAssetSwapSpread1 +
                        "\n  par asset swap spread:    " + fixedBondParAssetSwapSpread1 +
                        "\n  error:                    " + error1 +
                        "\n  tolerance:                " + tolerance);

             // Fixed Underlying bond (Isin: IT0006527060 IBRD 5 02/05/19)
             // maturity occurs on a business day

             Date fixedBondStartDate2 = new Date(5,Month.February,2005);
             Date fixedBondMaturityDate2 = new Date(5,Month.February,2019);
             Schedule fixedBondSchedule2 = new Schedule(fixedBondStartDate2,
                                    fixedBondMaturityDate2,
                                    new Period(Frequency.Annual), bondCalendar,
                                    BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,
                                    DateGeneration.Rule.Backward, false);
             List<CashFlow> fixedBondLeg2 = new FixedRateLeg(fixedBondSchedule2)
            .withCouponRates(0.05, new Thirty360(Thirty360.Thirty360Convention.BondBasis))
            .withNotionals(vars.faceAmount);
             Date fixedbondRedemption2 = bondCalendar.adjust(fixedBondMaturityDate2,  BusinessDayConvention.Following);
             fixedBondLeg2.Add(new SimpleCashFlow(100.0, fixedbondRedemption2));
             Bond fixedBond2 = new Bond(settlementDays, bondCalendar, vars.faceAmount, fixedBondMaturityDate2, fixedBondStartDate2,
            fixedBondLeg2);
             fixedBond2.setPricingEngine(bondEngine);

             double fixedBondMktPrice2 = 99.98 ; // market price observed on 7th June 2007
             double fixedBondMktFullPrice2=fixedBondMktPrice2+fixedBond2.accruedAmount();
             AssetSwap fixedBondParAssetSwap2= new AssetSwap(payFixedRate,
                                          fixedBond2, fixedBondMktPrice2,
                                          vars.iborIndex, vars.spread,
                                          null,
                                          vars.iborIndex.dayCounter(),
                                          parAssetSwap);
             fixedBondParAssetSwap2.setPricingEngine(swapEngine);
             double fixedBondParAssetSwapSpread2 = fixedBondParAssetSwap2.fairSpread();
             AssetSwap fixedBondMktAssetSwap2= new AssetSwap(payFixedRate,
                                          fixedBond2, fixedBondMktPrice2,
                                          vars.iborIndex, vars.spread,
                                          null,
                                          vars.iborIndex.dayCounter(),
//.........这里部分代码省略.........
开发者ID:akasolace,项目名称:qlnet,代码行数:101,代码来源:T_AssetSwap.cs


示例11: nextCashFlowDate

 public static Date nextCashFlowDate(Bond bond) {
   Date ret = new Date(NQuantLibcPINVOKE.BondFunctions_nextCashFlowDate__SWIG_1(Bond.getCPtr(bond)), true);
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例12: isTradable

 public static bool isTradable(Bond bond) {
   bool ret = NQuantLibcPINVOKE.BondFunctions_isTradable__SWIG_1(Bond.getCPtr(bond));
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例13: yieldValueBasisPoint

 public static double yieldValueBasisPoint(Bond bond, InterestRate yield) {
   double ret = NQuantLibcPINVOKE.BondFunctions_yieldValueBasisPoint__SWIG_1(Bond.getCPtr(bond), InterestRate.getCPtr(yield));
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例14: basisPointValue

 public static double basisPointValue(Bond bond, InterestRate yield, Date settlementDate) {
   double ret = NQuantLibcPINVOKE.BondFunctions_basisPointValue__SWIG_0(Bond.getCPtr(bond), InterestRate.getCPtr(yield), Date.getCPtr(settlementDate));
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例15: nextCouponRate

 public static double nextCouponRate(Bond bond) {
   double ret = NQuantLibcPINVOKE.BondFunctions_nextCouponRate__SWIG_1(Bond.getCPtr(bond));
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例16: duration

 public static double duration(Bond bond, InterestRate yield) {
   double ret = NQuantLibcPINVOKE.BondFunctions_duration__SWIG_2(Bond.getCPtr(bond), InterestRate.getCPtr(yield));
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例17: accrualEndDate

 public static Date accrualEndDate(Bond bond, Date settlementDate) {
   Date ret = new Date(NQuantLibcPINVOKE.BondFunctions_accrualEndDate__SWIG_0(Bond.getCPtr(bond), Date.getCPtr(settlementDate)), true);
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例18: accrualPeriod

 public static double accrualPeriod(Bond bond) {
   double ret = NQuantLibcPINVOKE.BondFunctions_accrualPeriod__SWIG_1(Bond.getCPtr(bond));
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例19: accrualDays

 public static int accrualDays(Bond bond) {
   int ret = NQuantLibcPINVOKE.BondFunctions_accrualDays__SWIG_1(Bond.getCPtr(bond));
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs


示例20: previousCashFlowDate

 public static Date previousCashFlowDate(Bond bond, Date refDate) {
   Date ret = new Date(NQuantLibcPINVOKE.BondFunctions_previousCashFlowDate__SWIG_0(Bond.getCPtr(bond), Date.getCPtr(refDate)), true);
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
开发者ID:minikie,项目名称:test,代码行数:5,代码来源:BondFunctions.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Bone类代码示例发布时间:2022-05-24
下一篇:
C# Boletos类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap