コード例 #1
0
        public double Theta()
        {
            var diff     = 1.0 / 252.0;
            var myCall_1 = new LeastSquareMethod(this.InitialStock, this.Strike, this.T + diff, this.Volatility, this.RiskFreeOptionPrice, this.Simulations, this.OptionType);
            var myCall_2 = new LeastSquareMethod(this.InitialStock, this.Strike, this.T - diff, this.Volatility, this.RiskFreeOptionPrice, this.Simulations, this.OptionType);

            return((myCall_1.ReturnPrice() - myCall_2.ReturnPrice()) / (2 * diff));
        }
コード例 #2
0
        public double Vega()
        {
            var diff     = this.Volatility * 0.01;
            var myCall_1 = new LeastSquareMethod(this.InitialStock, this.Strike, this.T, this.Volatility + diff, this.RiskFreeOptionPrice, this.Simulations, this.OptionType);
            var myCall_2 = new LeastSquareMethod(this.InitialStock, this.Strike, this.T, this.Volatility - diff, this.RiskFreeOptionPrice, this.Simulations, this.OptionType);

            return((myCall_1.ReturnPrice() - myCall_2.ReturnPrice()) / (2 * diff));
        }
コード例 #3
0
        public double Rho()
        {
            var diff = this.RiskFreeOptionPrice * 0.01;
            LeastSquareMethod myCall_1;
            LeastSquareMethod myCall_2;

            if (this.RiskFreeOptionPrice - diff < 0)
            {
                myCall_1 = new LeastSquareMethod(this.InitialStock, this.Strike, this.T, this.Volatility, this.RiskFreeOptionPrice + diff, this.Simulations, this.OptionType);
                myCall_2 = new LeastSquareMethod(this.InitialStock, this.Strike, this.T, this.Volatility, this.RiskFreeOptionPrice, this.Simulations, this.OptionType);
                return((myCall_1.ReturnPrice() - myCall_2.ReturnPrice()) / (2 * diff));
            }
            myCall_1 = new LeastSquareMethod(this.InitialStock, this.Strike, this.T, this.Volatility, this.RiskFreeOptionPrice + diff, this.Simulations, this.OptionType);
            myCall_2 = new LeastSquareMethod(this.InitialStock, this.Strike, this.T, this.Volatility, this.RiskFreeOptionPrice - diff, this.Simulations, this.OptionType);
            return((myCall_1.ReturnPrice() - myCall_2.ReturnPrice()) / (2 * diff));
        }