diff --git a/py_vollib_vectorized/api.py b/py_vollib_vectorized/api.py index db49983..dfc7ccc 100644 --- a/py_vollib_vectorized/api.py +++ b/py_vollib_vectorized/api.py @@ -135,9 +135,9 @@ def price_dataframe(df, *, flag_col=None, underlying_price_col=None, strike_col= raise ValueError("Model must be one of: `black`, `black_scholes`, `black_scholes_merton`") if inplace: - df["Price"] = price + df["Price"] = price.to_numpy() if not isinstance(price, np.ndarray) else price else: - output_df["Price"] = price + output_df["Price"] = price.to_numpy() if not isinstance(price, np.ndarray) else price if _iv_calc: if model == "black": @@ -164,16 +164,16 @@ def price_dataframe(df, *, flag_col=None, underlying_price_col=None, strike_col= raise ValueError("Model must be one of: `black`, `black_scholes`, `black_scholes_merton`") if inplace: - df["IV"] = sigma + df["IV"] = sigma.to_numpy() if not isinstance(sigma, np.ndarray) else sigma else: - output_df["IV"] = sigma + output_df["IV"] = sigma.to_numpy() if not isinstance(sigma, np.ndarray) else sigma if _greek_calc: greeks = get_all_greeks(flag, S, K, t, r, sigma, q, model=model, return_as="dataframe") for col in greeks: if inplace: - df[col] = greeks[col] + df[col] = greeks[col].to_numpy() else: output_df[col] = greeks[col] diff --git a/py_vollib_vectorized/greeks.py b/py_vollib_vectorized/greeks.py index a2e0e11..6d6f63d 100644 --- a/py_vollib_vectorized/greeks.py +++ b/py_vollib_vectorized/greeks.py @@ -44,7 +44,7 @@ def delta(flag, S, K, t, r, sigma, q=None, *, model="black_scholes", return_as=" if model == "black": b = 0 - delta = numerical_delta_black(flag, S, K, t, r, sigma, b) + delta = numerical_delta_black(flag, S, K, t, r, sigma) elif model == "black_scholes": b = r delta = numerical_delta_black_scholes(flag, S, K, t, r, sigma, b) @@ -106,7 +106,7 @@ def theta(flag, S, K, t, r, sigma, q=None, *, model="black_scholes", return_as= if model == "black": b = 0 - theta = numerical_theta_black(flag, S, K, t, r, sigma, b) + theta = numerical_theta_black(flag, S, K, t, r, sigma) elif model == "black_scholes": b = r @@ -167,7 +167,7 @@ def vega(flag, S, K, t, r, sigma, q=None, *, model="black_scholes", return_as="d if model == "black": b = 0 - vega = numerical_vega_black(flag, S, K, t, r, sigma, b) + vega = numerical_vega_black(flag, S, K, t, r, sigma) elif model == "black_scholes": b = r @@ -229,7 +229,7 @@ def rho(flag, S, K, t, r, sigma, q=None, *, model="black_scholes", return_as="da if model == "black": b = 0 - rho = numerical_rho_black(flag, S, K, t, r, sigma, b) + rho = numerical_rho_black(flag, S, K, t, r, sigma) elif model == "black_scholes": b = r @@ -291,7 +291,7 @@ def gamma(flag, S, K, t, r, sigma, q=None, *, model="black_scholes", return_as= if model == "black": b = 0 # black scholes, it calls the black_scholes function and not the black function. - gamma = numerical_gamma_black(flag, S, K, t, r, sigma, b) + gamma = numerical_gamma_black(flag, S, K, t, r, sigma) elif model == "black_scholes": b = r gamma = numerical_gamma_black_scholes(flag, S, K, t, r, sigma, b)