public double getValue ( ForwardCurveInterface forwardCurve , double swaprateVolatility ) { double swaprate = swaprates [ 0 ] ; for ( double swaprate1 : swaprates ) { if ( swaprate1 != swaprate ) { throw new RuntimeException ( "Uneven swaprates not allows for analytical pricing." ) ; } } double [ ] swapTenor = new double [ fixingDates . length + 1 ] ; System . arraycopy ( fixingDates , 0 , swapTenor , 0 , fixingDates . length ) ; swapTenor [ swapTenor . length - 1 ] = paymentDates [ paymentDates . length - 1 ] ; double forwardSwapRate = Swap . getForwardSwapRate ( new TimeDiscretization ( swapTenor ) , new TimeDiscretization ( swapTenor ) , forwardCurve ) ; double swapAnnuity = SwapAnnuity . getSwapAnnuity ( new TimeDiscretization ( swapTenor ) , forwardCurve ) ; return AnalyticFormulas . blackModelSwaptionValue ( forwardSwapRate , swaprateVolatility , exerciseDate , swaprate , swapAnnuity ) ; }
This method returns the value of the product using a Black - Scholes model for the swap rate The model is determined by a discount factor curve and a swap rate volatility .