예제 #1
0
        // handling short time to expiry
        private double computeKappa(HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider, double[] discountedCashFlow, double[] alpha, double omega)
        {
            double kappa = 0d;

            if (DoubleArrayMath.fuzzyEqualsZero(alpha, SMALL))
            {     // threshold coherent to rootfinder in kappa computation
                double totalPv = DoubleArrayMath.sum(discountedCashFlow);
                kappa = totalPv * omega > 0d ? double.PositiveInfinity : double.NegativeInfinity;
            }
            else
            {
                kappa = hwProvider.Model.kappa(DoubleArray.ofUnsafe(discountedCashFlow), DoubleArray.ofUnsafe(alpha));
            }
            return(kappa);
        }