希腊人

Black–Scholes 模型 的公式在 S# 中实现,用于计算基本的“希腊字母”:delta、gamma、vega、theta 和 rho。基于此公式实现了 波动率交易Delta 对冲 策略。S# 还允许你计算期权溢价和 隐含波动率

以下代码展示了用于计算“希腊字母”的 BlackScholes 类方法。

var bs = new BlackScholes(option, _connector, _connector);
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

此外,安装包中包括 OptionCalculator 示例,其中所有的“希腊字母”都使用 OptionDesk 图形组件进行计算和可视化。请参阅 图形组件