/**
  * The normalised intrinsic value of the protection leg of a CDS portfolio (index).
  * The actual value of the leg is this multiplied by the <b>initial</b>  notional of the index.
  *
  * @param indexCDS representation of the index cashflows (seen from today).
  * @param yieldCurve The current yield curves
  * @param intrinsicData credit curves, weights and recovery rates of the intrinsic names
  * @return The normalised intrinsic value of the protection leg.
  */
 public double indexProtLeg(
     CDS indexCDS,
     YieldTermStructure yieldCurve,
     IntrinsicIndexDataBundle intrinsicData)
 {
     return(indexProtLeg(indexCDS, yieldCurve, intrinsicData, indexCDS.getCashSettleTime()));
 }
 /**
  * The  intrinsic annuity of a CDS portfolio (index) for a unit (initial) notional.
  * The value of the premium leg is this multiplied by the <b> initial</b> notional of the index
  * and the index coupon (as a fraction).
  *
  * @param indexCDS representation of the index cashflows (seen from today).
  * @param yieldCurve The current yield curves
  * @param intrinsicData credit curves, weights and recovery rates of the intrinsic names
  * @param priceType Clean or dirty
  * @return The normalised intrinsic annuity of a CDS portfolio (index)
  */
 public double indexAnnuity(
     CDS indexCDS,
     YieldTermStructure yieldCurve,
     IntrinsicIndexDataBundle intrinsicData,
     CdsPriceType priceType)
 {
     return(indexAnnuity(indexCDS, yieldCurve, intrinsicData, priceType, indexCDS.getCashSettleTime()));
 }
Beispiel #3
0
        public double PremiumLegNPV_Exact(CDS cds, PiecewiseconstantHazardRate hazard,
                                          YieldTermStructure yt, DateTime tradedate, DateTime settlementDate, double notional, double coupon, List <double> Jumps, DateTime lastpayment)
        {
            double ita      = (double)365 / 360;
            double totalNPV = 0.0;

            CdsCoupon[] cf = cds.getCoupons();
            for (int i = 0; i < cf.Length; ++i)
            {
                totalNPV += cf[i].getYearFrac() * notional * Math.Exp(-hazard.getRT_(cf[i].getEffEnd()))
                            * Math.Exp(-yt.getRT_(cf[i].getEffEnd()));
            }
            double accrualpaidondefault = calculateSinglePeriodAccrualOnDefault(cf, coupon, tradedate, yt, hazard, lastpayment);

            totalNPV += ita * coupon * accrualpaidondefault * notional / yt.discount(tradedate.AddDays(3));
            OMLib.Conventions.DayCount.Actual360 dc = new OMLib.Conventions.DayCount.Actual360();
            Calendar calendar = new UnitedStates();


            return(totalNPV / Math.Exp(-yt.getRT_(cds.getCashSettleTime())));
        }