Пример #1
0
        public void TestSkewDigitalEuroCallPut()
        {
            DateTime today        = new DateTime(2010, 06, 22);
            DateTime expiry       = new DateTime(2011, 03, 24);
            double   tau          = System.Convert.ToDouble(expiry.Subtract(today).Days) / 365.0;
            double   spot         = 42.00;
            double   upperbarrier = 44.00;
            double   lowerbarrier = 40.00;

            int[]             zerodays  = { 0, 10 };
            double[]          zerorates = { 0.05, 0.05 };
            int[]             divdays   = new int[] { 0, 51, 247 };
            double[]          divAmts   = new double[] { 4, 1.350, 1.420 };
            double            fwd       = EquityAnalytics.GetForwardCCLin365(spot, tau, divdays, divAmts, zerodays, zerorates);
            OrcWingParameters owp       = new OrcWingParameters()
            {
                AtmForward = fwd, CallCurve = 0.1250, CurrentVol = 0.26, DnCutoff = -0.25, Dsr = 0.9, PutCurve = 0.10, RefFwd = fwd, RefVol = 0.26, Scr = 0.0, SlopeRef = -0.1750, Ssr = 100, TimeToMaturity = tau, UpCutoff = 0.20, Usr = 0.50, Vcr = 0.0
            };
            List <OrcWingParameters> owpList = new List <OrcWingParameters>();

            owpList.Add(owp);
            double     skew1 = EquityAnalytics.GetWingSkew(owpList, new LinearInterpolation(), tau, upperbarrier);
            double     vol   = EquityAnalytics.GetWingValue(owpList, new LinearInterpolation(), tau, upperbarrier);
            BinaryEuro op1   = new BinaryEuro(spot, upperbarrier, true, tau, vol, zerodays, zerorates, divdays, divAmts, skew1);
            double     pr1   = op1.GetPrice();

            Assert.AreEqual(0.35784, pr1, 0.005);
            double     skew2 = EquityAnalytics.GetWingSkew(owpList, new LinearInterpolation(), tau, lowerbarrier);
            BinaryEuro op2   = new BinaryEuro(spot, lowerbarrier, false, tau, vol, zerodays, zerorates, divdays, divAmts, skew2);
            double     pr2   = op2.GetPrice();

            Assert.AreEqual(0.43275, pr2, 0.005);
        }
Пример #2
0
        /// <summary>
        /// We can roughly proxy the alpha-th percentile of the simulation
        /// by calculating the upper alpha percentile confidence point for a given time slice
        /// of the ln-OU process and pricing the collar with this asset value for a given profile point
        /// This should roughly compare to the calculated (1-alpha)-worst PCE point.
        /// </summary>
        /// <param name="spot"></param>
        /// <param name="kappa"></param>
        /// <param name="theta"></param>
        /// <param name="histvol"></param>
        /// <param name="time0"></param>
        /// <param name="maturity"></param>
        /// <param name="callstrike"></param>
        /// <param name="putstrike"></param>
        /// <param name="zerodays"></param>
        /// <param name="zerorates"></param>
        /// <param name="divdays"></param>
        /// <param name="divamts"></param>
        /// <param name="volSurface"></param>
        /// <returns></returns>
        public static double PCEProxyCalc(double spot,
                                          double kappa,
                                          double theta,
                                          double histvol,
                                          double time0,
                                          double maturity,
                                          double callstrike,
                                          double putstrike,
                                          int[] zerodays,
                                          double[] zerorates,
                                          int[] divdays,
                                          double[] divamts,
                                          List <OrcWingParameters> volSurface)
        {
            double       tau        = maturity - time0;
            double       upperBound = EquityPCEAnalytics.LNOUUpperBound(spot, 0.95, kappa, theta, histvol, time0);
            double       fStar      = EquityAnalytics.GetForwardCCLin365(upperBound, time0, maturity, divdays, divamts, zerodays, zerorates);
            double       callvol    = EquityAnalytics.GetWingValue(volSurface, new LinearInterpolation(), tau, callstrike);
            double       putvol     = EquityAnalytics.GetWingValue(volSurface, new LinearInterpolation(), tau, putstrike);
            double       r0         = EquityAnalytics.GetRateCCLin365(time0, maturity, zerodays, zerorates);
            BlackScholes bs         = new BlackScholes();
            double       lhs        = Math.Max(bs.BSprice(fStar, tau, callstrike, r0, callvol, true) - bs.BSprice(fStar, tau, putstrike, r0, putvol, false), 0);

            return(lhs);
        }
Пример #3
0
        /// <summary>
        /// Evaluate the PCE for a collar given the parameters passed below
        /// </summary>
        /// <param name="ratedays"></param>
        /// <param name="rateamts"></param>
        /// <param name="divdays"></param>
        /// <param name="divamts"></param>
        /// <param name="volSurface"></param>
        /// <param name="spot"></param>
        /// <param name="s"></param>
        /// <param name="callstrike"></param>
        /// <param name="putstrike"></param>
        /// <param name="t0"></param>
        /// <param name="maturity"></param>
        /// <returns></returns>
        private static double CollarPCEFunction(int[] ratedays,
                                                double[] rateamts,
                                                int[] divdays,
                                                double[] divamts,
                                                List <OrcWingParameters> volSurface,
                                                double spot,
                                                double s,
                                                double callstrike,
                                                double putstrike,
                                                double t0,
                                                double maturity)
        {
            t0 = Math.Min(t0, maturity); // cap profile point to maturity;
            double       tau     = maturity - t0;
            double       r       = EquityAnalytics.GetRateCCLin365(t0, maturity, ratedays, rateamts);
            double       q       = EquityAnalytics.GetYieldCCLin365(spot, t0, maturity, divdays, divamts, ratedays, rateamts);
            double       callvol = EquityAnalytics.GetWingValue(volSurface, new LinearInterpolation(), tau, callstrike);
            double       putvol  = EquityAnalytics.GetWingValue(volSurface, new LinearInterpolation(), tau, putstrike);
            double       fwd     = s * Math.Exp((r - q) * tau);
            BlackScholes bs      = new BlackScholes();
            double       lhs     = Math.Max(bs.BSprice(fwd, tau, callstrike, r, callvol, true) - bs.BSprice(fwd, tau, putstrike, r, putvol, false), 0);

            return(lhs);
        }