mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
Patches from discord #bugs (#965)
This commit is contained in:
@@ -56,7 +56,7 @@ def unusual_options(num: int, sort_column: str, ascending: bool):
|
||||
# Subtract an hour to align with NYSE timezone
|
||||
last_updated = pd.to_datetime(
|
||||
data_list[-1]["last_updated"], unit="s"
|
||||
) - pd.Timedelta(hours=1)
|
||||
) - pd.Timedelta(hours=5)
|
||||
|
||||
df = pd.DataFrame(
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ def display_options(num: int, sort_column: pd.Timestamp, export: str, ascending:
|
||||
"""
|
||||
data, last_update = fdscanner_model.unusual_options(num, sort_column, ascending)
|
||||
|
||||
print(f"Last Updated: {last_update}")
|
||||
print(f"Last Updated: {last_update} (EST)")
|
||||
print(
|
||||
tabulate(
|
||||
data[:num], headers=data.columns, tablefmt="fancy_grid", showindex=False
|
||||
|
||||
@@ -55,6 +55,7 @@ class OptionsController:
|
||||
]
|
||||
|
||||
CHOICES_COMMANDS = [
|
||||
"pres",
|
||||
"disp",
|
||||
"scr",
|
||||
"calc",
|
||||
@@ -127,7 +128,8 @@ What do you want to do?
|
||||
quit quit to abandon program
|
||||
|
||||
Explore:
|
||||
disp display all preset screeners filters
|
||||
pres display available preset templates
|
||||
disp display filters for selected preset
|
||||
scr output screener options [Syncretism.io]
|
||||
unu show unusual options activity [fdscanner.com]
|
||||
calc basic call/put PnL calculator
|
||||
@@ -387,6 +389,23 @@ Current Expiry: {self.selected_date or None}
|
||||
return
|
||||
barchart_view.print_options_data(ticker=self.ticker, export=ns_parser.export)
|
||||
|
||||
@try_except
|
||||
def call_pres(self, other_args: List[str]):
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="pres",
|
||||
description="""View available presets under presets folder.""",
|
||||
)
|
||||
ns_parser = parse_known_args_and_warn(parser, other_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
presets = [f for f in os.listdir(self.PRESET_PATH) if f.endswith(".ini")]
|
||||
|
||||
for preset in presets:
|
||||
print(preset)
|
||||
print("")
|
||||
|
||||
@try_except
|
||||
def call_disp(self, other_args: List[str]):
|
||||
"""Process disp command"""
|
||||
@@ -394,7 +413,7 @@ Current Expiry: {self.selected_date or None}
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="disp",
|
||||
description="""View available presets under presets folder.""",
|
||||
description="""View filters for a selected preset.""",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-p",
|
||||
@@ -895,7 +914,7 @@ Current Expiry: {self.selected_date or None}
|
||||
min_sp=ns_parser.min,
|
||||
max_sp=ns_parser.max,
|
||||
calls_only=ns_parser.calls,
|
||||
puts_only=ns_parser.puts_only,
|
||||
puts_only=ns_parser.puts,
|
||||
export=ns_parser.export,
|
||||
)
|
||||
else:
|
||||
|
||||
@@ -41,25 +41,8 @@ def view_available_presets(preset: str, presets_path: str):
|
||||
print("")
|
||||
|
||||
else:
|
||||
presets = [
|
||||
preset.split(".")[0]
|
||||
for preset in os.listdir(presets_path)
|
||||
if preset[-4:] == ".ini"
|
||||
]
|
||||
|
||||
for preset_i in presets:
|
||||
with open(
|
||||
os.path.join(presets_path, preset + ".ini"),
|
||||
encoding="utf8",
|
||||
) as f:
|
||||
description = ""
|
||||
for line in f:
|
||||
if line.strip() == "[FILTER]":
|
||||
break
|
||||
description += line.strip()
|
||||
print(f"\nPRESET: {preset_i}")
|
||||
print(description.split("Description: ")[1].replace("#", ""))
|
||||
print("")
|
||||
print("Please provide a preset template.")
|
||||
print("")
|
||||
|
||||
|
||||
def view_screener_output(preset: str, presets_path: str, n_show: int, export: str):
|
||||
|
||||
Reference in New Issue
Block a user