コード例 #1
0
        private static double AdjustCapletImpliedVol(int expiry, double volatility, QuarterlyDiscounts discount, QuarterlyShifts shift)
        {
            double strike      = RateAnalytics.CashForwardRate(expiry, discount);
            double capletPrice = BlackModel.GetValue(expiry / 4.0, strike, strike, volatility, PayStyle.Call);
            double result      = BlackModel.GetImpliedVolatility(expiry / 4.0, strike + shift.Get(expiry), strike + shift.Get(expiry), capletPrice, volatility, PayStyle.Call);

            return(result);
        }
コード例 #2
0
        private static double AdjustSwaptionImpliedVol(int expiry, int tenor, double volatility, QuarterlyDiscounts discount, QuarterlyShifts shift)
        {
            double strike        = RateAnalytics.SwapRate(expiry, tenor, discount);
            double swapShift     = RateAnalytics.SwapShift(expiry, tenor, discount, shift);
            double swaptionPrice = BlackModel.GetValue(expiry / 4.0, strike, strike, volatility, PayStyle.Call);
            double result        = BlackModel.GetImpliedVolatility(expiry / 4.0, strike + swapShift, strike + swapShift, swaptionPrice, volatility, PayStyle.Call);

            return(result);
        }