The formula of Black–Scholes model is realized in the S# to calculate the basic “Greeks”: delta, gamma, vega, theta and rho. The volatility trading and Delta-hedging strategies are realized on the basis of this formula. Also S# allows you to calculate the option premium and IV.
The following code shows the BlackScholes class methods to calculate the “Greeks”.
var bs = new BlackScholes(option, trader, trader); DateTimeOffset currentTime = DateTimeOffset.Now; decimal delta = bs.Delta(currentTime); decimal gamma = bs.Gamma(currentTime); decimal vega = bs.Vega(currentTime); decimal theta = bs.Theta(currentTime); decimal rho = bs.Rho(currentTime); decimal iv = bs.ImpliedVolatility(currentTime, premium); // premium is premium of the option contract