Ejemplo n.º 1
0
        //! dirty price given Z-spread

        /*! Z-spread compounding, frequency, daycount are taken into account
         *  The default bond settlement is used if no date is given.
         *  For details on Z-spread refer to:
         *  "Credit Spreads Explained", Lehman Brothers European Fixed Income Research - March 2004, D. O'Kane*/
        public double dirtyPriceFromZSpread(double zSpread, DayCounter dc, Compounding comp, Frequency freq, Date settlement)
        {
            if (settlement == null)
            {
                settlement = settlementDate();
            }

            if (engine_ == null)
            {
                throw new ApplicationException("null pricing engine");
            }

            if (!engine_.GetType().IsSubclassOf(typeof(DiscountingBondEngine)))
            {
                throw new ApplicationException("engine not compatible with calculation");
            }

            return(Utils.dirtyPriceFromZSpreadFunction(notional(settlement), cashflows_, zSpread, dc, comp, freq,
                                                       settlement, ((DiscountingBondEngine)engine_).discountCurve()));
        }