def SABR_delta_2(f, t, k, CallPut, alpha, beta, rho, volvol):
    f2 = f * 1.01
    b_s = BlackScholes(f, 0, 0, t)
    SABR_vol = lognormal_vol(k, f, t, alpha, beta, rho, volvol) * 100
    SABR_vol_shift = lognormal_vol(k, f2, t, alpha, beta, rho, volvol) * 100
    bs_delta = b_s.BS_delta(k, SABR_vol, CallPut)
    bs_vega = b_s.BS_vega(k, SABR_vol)
    delta = bs_delta + bs_vega * (SABR_vol_shift - SABR_vol) / (f2 - f)
    return delta
def SABR_delta_3(f, t, k, CallPut, alpha, beta, rho, volvol):
    f2 = f * 1.01
    b_s = BlackScholes(f, 0, 0, t)
    SABR_vol = lognormal_vol(k, f, t, alpha, beta, rho, volvol) * 100
    SABR_vol_shift = lognormal_vol(k, f2, t, alpha, beta, rho, volvol) * 100
    bs_delta = b_s.BS_delta(k, SABR_vol, CallPut)
    bs_vega = b_s.BS_vega(k, SABR_vol)

    SABR_vol_alpha_shift = lognormal_vol(k, f, t, alpha * 1.01, beta, rho,
                                         volvol) * 100
    alpha_deri = (SABR_vol - SABR_vol_alpha_shift) / (alpha - 1.01 * alpha)
    delta = bs_delta + bs_vega * ((SABR_vol_shift - SABR_vol) /
                                  (f2 - f) + alpha_deri * (rho * volvol /
                                                           (f**beta)))

    return delta
Esempio n. 3
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
def SABR_bs_delta(f, t, k, CallPut, alpha, beta, rho, volvol):
    b_s = BlackScholes(f, 0, 0, t)
    SABR_vol = lognormal_vol(k, f, t, alpha, beta, rho, volvol) * 100
    bs_delta = b_s.BS_delta(k, SABR_vol, CallPut)
    return bs_delta
Esempio n. 5
0
def get_delta(row):
    b_s = BlackScholes(row['underlying_price'], interest_rate, dividend, ttm)
    delta = b_s.BS_delta(row['Strike'], row['m_mid_vol'], row['CallPut'])
    return delta