public static double huntKennedyCMSAdjustedRate ( double forwardSwaprate , double volatility , double swapAnnuity , double optionMaturity , double swapMaturity , double payoffUnit ) { double a = 1.0 / swapMaturity ; double b = ( payoffUnit / swapAnnuity - a ) / forwardSwaprate ; double convexityAdjustment = Math . exp ( volatility * volatility * optionMaturity ) ; double rateUnadjusted = forwardSwaprate ; double rateAdjusted = forwardSwaprate * convexityAdjustment ; return ( a * rateUnadjusted + b * forwardSwaprate * rateAdjusted ) * swapAnnuity / payoffUnit ; }
Calculate the adjusted forward swaprate corresponding to a change of payoff unit from the given swapAnnuity to the given payoffUnit using the Black - Scholes model for the swap rate together with the Hunt - Kennedy convexity adjustment .