mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 21:12:16 +00:00
* First commit * Renamed to bot * change from discordbot to bots imports * refractor cmds + autocomplete helpers + updated dps plots/candle + quote cmd * isort fix * Update helpers.py * Added first refactor * Added commands and refactor * Added description handler * Through grains * ta + image border helper * Added indices * merged * Finished econ * options refactor * dark_pool_shorts, candle, quote done * pagination/dropdown logic to helpers + fixes * dd/disc/insider done + add image logic to helpers * linting * removed plt style * Almost done with Gov * fixing conflicts * Finished gov (excpect ones mentioned) * screener done * Test bug refactor * Store changes to switch * Finished refactor * Fixed error * Delete ::40 * Fixed issue * Fixed black * finished * fixes Co-authored-by: teh_coderer <me@tehcoderer.com> Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>
51 lines
1.1 KiB
Python
51 lines
1.1 KiB
Python
import df2img
|
|
|
|
import bots.config_discordbot as cfg
|
|
from bots.config_discordbot import logger
|
|
from bots.helpers import save_image
|
|
from gamestonk_terminal.stocks.options import barchart_model
|
|
|
|
|
|
def iv_command(ticker: str = None):
|
|
"""Options IV"""
|
|
|
|
# Debug
|
|
if cfg.DEBUG:
|
|
logger.debug("opt-iv %s", ticker)
|
|
|
|
# Check for argument
|
|
if ticker is None:
|
|
raise Exception("Stock ticker is required")
|
|
|
|
df = barchart_model.get_options_info(ticker)
|
|
df = df.fillna("")
|
|
df = df.set_axis(
|
|
[
|
|
" ",
|
|
"",
|
|
],
|
|
axis="columns",
|
|
)
|
|
df.set_index(" ", inplace=True)
|
|
fig = df2img.plot_dataframe(
|
|
df,
|
|
fig_size=(600, 1500),
|
|
col_width=[3, 3],
|
|
tbl_cells=dict(
|
|
align="left",
|
|
height=35,
|
|
),
|
|
template="plotly_dark",
|
|
font=dict(
|
|
family="Consolas",
|
|
size=20,
|
|
),
|
|
paper_bgcolor="rgba(0, 0, 0, 0)",
|
|
)
|
|
imagefile = save_image("opt-iv.png", fig)
|
|
|
|
return {
|
|
"title": f"{ticker.upper()} Options: IV",
|
|
"imagefile": imagefile,
|
|
}
|