示例#1
0
        /// <summary>
        /// Gets the orc vol.
        /// </summary>
        /// <param name="k">The k.</param>
        /// <param name="timeToMaturity">The time to maturity.</param>
        /// <param name="atm">The atm.</param>
        /// <param name="currentVol">The current vol.</param>
        /// <param name="slopeRef">The slope ref.</param>
        /// <param name="putCurve">The put curve.</param>
        /// <param name="callCurve">The call curve.</param>
        /// <param name="dnCutOff">The dn cut off.</param>
        /// <param name="upCutOff">Up cut off.</param>
        /// <param name="vcr">The VCR.</param>
        /// <param name="scr">The SCR.</param>
        /// <param name="ssr">The SSR.</param>
        /// <param name="dsr">The DSR.</param>
        /// <param name="usr">The usr.</param>
        /// <param name="refFwd">The ref FWD.</param>
        /// <returns></returns>
        public static double GetWingVol(double k, double timeToMaturity, double atm, double currentVol, double slopeRef, double putCurve, double callCurve,
                                        double dnCutOff, double upCutOff, double vcr, double scr, double ssr, double dsr, double usr,
                                        double refFwd)
        {
            var volSurface = new OrcWingVol
            {
                CurrentVol = currentVol,
                DnCutoff   = dnCutOff,
                Dsr        = dsr,
                PutCurve   = putCurve,
                CallCurve  = callCurve,
                RefFwd     = refFwd
            };

            volSurface.CurrentVol     = currentVol;
            volSurface.Scr            = scr;
            volSurface.SlopeRef       = slopeRef;
            volSurface.Ssr            = ssr;
            volSurface.TimeToMaturity = timeToMaturity;
            volSurface.UpCutoff       = upCutOff;
            volSurface.Usr            = usr;
            volSurface.Vcr            = vcr;
            double res = volSurface.Orcvol(atm, k);

            return(res);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="myZero"></param>
        /// <param name="myDiv"></param>
        /// <param name="orcParams"></param>
        /// <param name="t"></param>
        /// <param name="strike"></param>
        /// <param name="spot"></param>
        /// <param name="style"></param>
        /// <param name="paystyle"></param>
        /// <param name="gridsteps"></param>
        /// <returns></returns>
        public static double FindPrice(ZeroCurve myZero, DivList myDiv, double[] orcParams, double t,
                                       double strike, double spot, string style, string paystyle, double gridsteps)
        {
            //get the atfwd
            double atFwd = GetATMfwd(myZero, myDiv, spot, t);
            //unpack the orc paramters
            //double currentVol = OrcParams[0];
            //double slopeRef = OrcParams[1];
            //double putCurve = OrcParams[2];
            //double callCurve = OrcParams[3];
            //double dnCutOff = OrcParams[4];
            //double upCutOff = OrcParams[5];
            //double refFwd = OrcParams[6];
            //double refVol = OrcParams[7];
            //double vcr = OrcParams[8];
            //double scr = OrcParams[9];
            //double ssr = OrcParams[10];
            //double dsr = OrcParams[11];
            //double usr = OrcParams[12];

            //set up the tree
            var myTree     = new DiscreteTree();
            var myVol      = new OrcWingVol();
            int nGridsteps = (gridsteps < 20.0) ? 20 : Convert.ToInt32(gridsteps);

            myTree.Gridsteps = nGridsteps;
            myTree.Tau       = t;
            myTree.Sig       = myVol.Orcvol(atFwd, strike);
            myTree.Spot      = spot;
            myTree.MakeGrid(myZero, myDiv);
            //create pricer
            var myPrice = new Pricer {
                Strike = strike, Payoff = paystyle, Smoothing = "y", Style = style
            };

            myPrice.MakeGrid(myTree);
            double pr = myPrice.Price();

            return(pr);
        }