Exemple #1
0
        /// <summary>
        /// Black, Scholes, Merton formula (1973) for European option Greeks.
        /// </summary>
        public static double BlackScholesGreek(double strike, double underlyingPrice, double yearsToExpiry, double vol, double riskFreeRate, double dividendYield, PutCallFlag putCallFlag, OptionGreeks optionGreek)
        {
            switch (optionGreek)
            {
            case OptionGreeks.Delta:
                return(BlackScholesDelta(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag));

            case OptionGreeks.Gamma:
                return(BlackScholesGamma(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag));

            case OptionGreeks.Rho:
                return(BlackScholesRho(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag));

            case OptionGreeks.Theta:
                return(BlackScholesTheta(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag));

            case OptionGreeks.Vega:
                return(BlackScholesVega(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag));

            default:
                return(double.NaN);
            }
        }
Exemple #2
0
 /// <summary>
 /// Black, Scholes, Merton formula (1973) for European option Greeks.
 /// </summary>
 public static double BlackScholesGreek(double strike, double underlyingPrice, double yearsToExpiry, double vol, double riskFreeRate, double dividendYield, PutCallFlag putCallFlag, OptionGreeks optionGreek)
 {
     switch (optionGreek)
     {
         case OptionGreeks.Delta:
             return BlackScholesDelta(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag);
         case OptionGreeks.Gamma:
             return BlackScholesGamma(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag);
         case OptionGreeks.Rho:
             return BlackScholesRho(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag);
         case OptionGreeks.Theta:
             return BlackScholesTheta(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag);
         case OptionGreeks.Vega:
             return BlackScholesVega(strike, underlyingPrice, yearsToExpiry, vol, riskFreeRate, dividendYield, putCallFlag);
         default:
             return double.NaN;
     }
 }