HestonEstimator.HestonCall.HestonCallPutPrice C# (CSharp) Method

HestonCallPutPrice() private method

Jointly calculate a call and a put price.
private HestonCallPutPrice ( ) : Vector
return Vector
        internal Vector HestonCallPutPrice()
        {
            double F = this.s0 * Math.Exp((this.rate - this.dividend) * this.T);
            double firstTerm = 0.5 * (F - this.K);
            double a = 1E-12;
            double b = 1000.0;

            // The second term of this expressions approximates the integral in the interval [0,a].
            var integrate = new Integrate(this);
            integrate.Tolerance = 10e-8;
            integrate.MaxRecursionLevel = 4;// 4;

            double part1 = PerformIntegral(a, b, IntegrandFunc);
            double integral = part1 + a * IntegrandFunc(a / 2.0);
            Vector callPut= new Vector(2);
            callPut[0] = Math.Exp(-this.rate * this.T) * (firstTerm + integral / Math.PI);
            callPut[1] = Math.Exp(-this.rate * this.T) * (-firstTerm + integral / Math.PI);
            return callPut;
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Test method, displays a sensitivity on heston call and put prices.
        /// </summary>
        private void PutCallTest()
        {
            Console.WriteLine("Black-Sholes Calls Market Prices");
            Console.WriteLine(this.callMarketPrice);
            Console.WriteLine("Strikes");
            Console.WriteLine(this.strike);
            Console.WriteLine("Maturities");
            Console.WriteLine(this.maturity);

            var x = new Vector()
            {
                3.18344026504981,
                0.0427882999286046,
                0.644527074840708,
                -0.659960749691282,
                0.0150455464938991,
                0.0211747510984717
            };

            HestonCall hc = new HestonCall(this, x, this.s0);

            hc.T    = .1;
            hc.rate = this.rate[0];
            Console.WriteLine("Strike\tCall\tPut");
            for (int z = 200; z < 6500; z += 1000)
            {
                hc.K = z;

                var call    = hc.HestonCallPrice();
                var put     = hc.HestonPutPrice();
                var callPut = hc.HestonCallPutPrice();
                Console.WriteLine(z + "\t" + callPut[0] + "\t" + callPut[1]);
            }
        }
All Usage Examples Of HestonEstimator.HestonCall::HestonCallPutPrice