The Greeks measure sensitivity of option price to parameters: Delta (price), Gamma (delta change), Theta (time decay), Vega (volatility), Rho (rates). Essential for risk management and hedging.
// Calculate d1 and d2
const d1 = (Math.log(S/K) + (r + sigma*sigma/2)*T) / (sigma * Math.sqrt(T));
const d2 = d1 - sigma * Math.sqrt(T);
// Delta: rate of change of price wrt underlying
const delta = isCall ? normalCDF(d1) : normalCDF(d1) - 1;
// Gamma: rate of change of delta
const gamma = normalPDF(d1) / (S * sigma * Math.sqrt(T));
// Theta: time decay per day
const theta = (-S * normalPDF(d1) * sigma / (2 * Math.sqrt(T))
- r * K * Math.exp(-r*T) * normalCDF(d2)) / 365;
// Vega: sensitivity to volatility (per 1% change)
const vega = S * Math.sqrt(T) * normalPDF(d1) / 100;
// Rho: sensitivity to interest rates
const rho = K * T * Math.exp(-r*T) * normalCDF(d2) / 100;