Ejemplo n.º 1
0
def get_greeks(row, greek):
    b_s = BlackScholes(row['underlying_price'], 0, 0, row['mtr'])
    if greek == 'gamma':
        result = b_s.BS_gamma(row['Strike'], row['m_mid_vol'])
    elif greek == 'theta':
        result = b_s.BS_theta(row['Strike'], row['m_mid_vol'], row['CallPut'])
    elif greek == 'vega':
        result = b_s.BS_vega(row['Strike'], row['m_mid_vol'])
    elif greek == 'delta':
        result = b_s.BS_delta(row['Strike'], row['m_mid_vol'], row['CallPut'])
    elif greek == 'vanna':
        result = b_s.BS_vanna(row['Strike'], row['m_mid_vol'])
    elif greek == 'volga':
        result = b_s.BS_volga(row['Strike'], row['m_mid_vol'])
    elif greek == 'gamma_deri':
        result = b_s.BS_gamma_deri(row['Strike'], row['m_mid_vol'])
    return result
Ejemplo n.º 2
0
def get_gamma(row):
    b_s = BlackScholes(row['underlying_price'], interest_rate, dividend, ttm)
    gamma = b_s.BS_gamma(row['Strike'], row['m_mid_vol'])
    return gamma