Small options fix + docstring (#3792)

* fix dte for options

* sorry henrique
This commit is contained in:
James Maslek
2022-12-16 05:33:45 -05:00
committed by GitHub
parent 0aae71cba8
commit d99c5491d1
2 changed files with 8 additions and 6 deletions

View File

@@ -160,7 +160,7 @@ def blcp() -> pd.DataFrame:
Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> openbb.stocks.ins.bclp()
>>> openbb.stocks.ins.blcp()
"""
return openinsider_model.get_print_insider_data("blcp")

View File

@@ -127,9 +127,9 @@ def get_option_chain_expiry(
df_list = [x[x["impliedVolatility"] > 0].copy() for x in df_list]
# Add in greeks to each df
# Time to expiration:
dt = (datetime.strptime(expiry, "%Y-%m-%d") - datetime.now()).seconds / (
60 * 60 * 24
)
dt = (
datetime.strptime(expiry, "%Y-%m-%d") + timedelta(hours=16) - datetime.now()
).total_seconds() / (60 * 60 * 24)
# Note the way the Option class is defined, put has a -1 input and call has a +1 input
for df, option_type in zip(df_list, option_factor):
df["Delta"] = df.apply(
@@ -539,8 +539,10 @@ def get_greeks(
risk_free = rf if rf is not None else get_rf()
expire_dt = datetime.strptime(expire, "%Y-%m-%d")
dif = (expire_dt - datetime.now()).total_seconds() / (60 * 60 * 24)
dif = (expire_dt - datetime.now() + timedelta(hours=16)).total_seconds() / (
60 * 60 * 24
)
print(dif)
strikes = []
for _, row in chain.iterrows():
vol = row["impliedVolatility"]