mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-25 10:42:58 +00:00
sdk powered working commands on stocks menu
This commit is contained in:
@@ -21,6 +21,7 @@ from openbb_terminal.helper_funcs import (
|
||||
EXPORT_BOTH_RAW_DATA_AND_FIGURES,
|
||||
EXPORT_ONLY_RAW_DATA_ALLOWED,
|
||||
export_data,
|
||||
print_rich_table,
|
||||
)
|
||||
from openbb_terminal.menu import session
|
||||
from openbb_terminal.parent_classes import StockBaseController
|
||||
@@ -564,11 +565,29 @@ class StocksController(StockBaseController):
|
||||
if c_out.error:
|
||||
console.print(f"[red]{c_out.error}[/]\n")
|
||||
else:
|
||||
console.print(c_out.results)
|
||||
sheet_name = (
|
||||
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None
|
||||
)
|
||||
export = ns_parser.export if ns_parser.export else None
|
||||
|
||||
if ns_parser.chart:
|
||||
# TODO : charting needs to be implemented on the sdk
|
||||
c_out.show()
|
||||
print_rich_table(
|
||||
df=c_out.to_dataframe(),
|
||||
show_index=True,
|
||||
title="News",
|
||||
index_name="Date",
|
||||
export=bool(export),
|
||||
)
|
||||
export_data(
|
||||
export_type=export,
|
||||
dir_path=os.path.dirname(os.path.abspath(__file__)),
|
||||
func_name="news",
|
||||
df=c_out.to_dataframe(),
|
||||
sheet_name=sheet_name,
|
||||
)
|
||||
|
||||
# TODO : charting needs to be implemented on the sdk
|
||||
# if ns_parser.chart:
|
||||
# c_out.show()
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_multiples(self, other_args: List[str]):
|
||||
@@ -578,18 +597,38 @@ class StocksController(StockBaseController):
|
||||
parser = translator.parser
|
||||
|
||||
if ns_parser := self.parse_known_args_and_warn(
|
||||
parser=parser, other_args=other_args
|
||||
parser=parser,
|
||||
other_args=other_args,
|
||||
export_allowed=EXPORT_ONLY_RAW_DATA_ALLOWED,
|
||||
):
|
||||
c_out = translator.execute_func(parsed_args=ns_parser)
|
||||
|
||||
if c_out.error:
|
||||
console.print(f"[red]{c_out.error}[/]\n")
|
||||
else:
|
||||
console.print(c_out.results)
|
||||
sheet_name = (
|
||||
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None
|
||||
)
|
||||
export = ns_parser.export if ns_parser.export else None
|
||||
|
||||
if ns_parser.chart:
|
||||
# TODO : charting needs to be implemented on the sdk
|
||||
c_out.show()
|
||||
print_rich_table(
|
||||
df=c_out.to_dataframe(),
|
||||
show_index=True,
|
||||
title=f"Multiples",
|
||||
index_name="Metric",
|
||||
export=bool(export),
|
||||
)
|
||||
export_data(
|
||||
export_type=export,
|
||||
dir_path=os.path.dirname(os.path.abspath(__file__)),
|
||||
func_name="multiples",
|
||||
df=c_out.to_dataframe(),
|
||||
sheet_name=sheet_name,
|
||||
)
|
||||
|
||||
# TODO : charting needs to be implemented on the sdk
|
||||
# if ns_parser.chart:
|
||||
# c_out.show()
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_disc(self, _):
|
||||
|
||||
Reference in New Issue
Block a user