From 1c869afd2fdc440eb0e171711d0635e7ca19ec7f Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Mon, 8 May 2023 22:18:37 +0200 Subject: [PATCH] Hotfix/ stocks/fa/dcf (#4992) * Remove flags * Update DCF params and file naming --- .../stocks/fundamental_analysis/dcf_model.py | 10 ++++------ .../stocks/fundamental_analysis/dcf_view.py | 3 ++- .../stocks/fundamental_analysis/fa_controller.py | 4 +--- .../stocks/fundamental_analysis/test_dcf_model.py | 3 +-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/openbb_terminal/stocks/fundamental_analysis/dcf_model.py b/openbb_terminal/stocks/fundamental_analysis/dcf_model.py index 3bd65e52e84..23b25ced19a 100644 --- a/openbb_terminal/stocks/fundamental_analysis/dcf_model.py +++ b/openbb_terminal/stocks/fundamental_analysis/dcf_model.py @@ -584,7 +584,7 @@ def frac(num: float, denom: float) -> Union[str, float]: @log_start_end(log=logger) -def generate_path(n: int, symbol: str, date: str) -> Path: +def generate_path(n: int, file_name: str) -> Path: """ Create the path to save an excel file to @@ -592,10 +592,8 @@ def generate_path(n: int, symbol: str, date: str) -> Path: ---------- n: int The try number - symbol: str - The ticker symbol to be saved - date: str - The date the dcf was generated + file_name: str + The name of the file to save Returns ------- @@ -606,7 +604,7 @@ def generate_path(n: int, symbol: str, date: str) -> Path: export_folder = compose_export_path( func_name="dcf", dir_path=os.path.abspath(os.path.dirname(__file__)) ).parent - trypath = export_folder / symbol / date / val + trypath = export_folder / file_name / val trypath = str(trypath) + ".xlsx" # type: ignore return Path(trypath) diff --git a/openbb_terminal/stocks/fundamental_analysis/dcf_view.py b/openbb_terminal/stocks/fundamental_analysis/dcf_view.py index c8fbe8d7e06..ab474f7ce8b 100644 --- a/openbb_terminal/stocks/fundamental_analysis/dcf_view.py +++ b/openbb_terminal/stocks/fundamental_analysis/dcf_view.py @@ -145,7 +145,8 @@ class CreateExcelFA: i = 0 while True: - path = dcf_model.generate_path(i, self.info["symbol"], self.data["now"]) + file_name = f"{self.data['now'].replace('-', '')}_dcf_{self.info['symbol']}" + path = dcf_model.generate_path(i, file_name) path.parent.mkdir(parents=True, exist_ok=True) if not path.is_file(): diff --git a/openbb_terminal/stocks/fundamental_analysis/fa_controller.py b/openbb_terminal/stocks/fundamental_analysis/fa_controller.py index 9dac76cbd5d..f8d6bb666f2 100644 --- a/openbb_terminal/stocks/fundamental_analysis/fa_controller.py +++ b/openbb_terminal/stocks/fundamental_analysis/fa_controller.py @@ -1625,9 +1625,7 @@ class FundamentalAnalysisController(StockBaseController): default=False, help="Whether to replace a linear regression estimate with a growth estimate.", ) - ns_parser = self.parse_known_args_and_warn( - parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED - ) + ns_parser = self.parse_known_args_and_warn(parser, other_args) if ns_parser: if ns_parser.ticker: diff --git a/tests/openbb_terminal/stocks/fundamental_analysis/test_dcf_model.py b/tests/openbb_terminal/stocks/fundamental_analysis/test_dcf_model.py index bb558742483..b488103eb36 100644 --- a/tests/openbb_terminal/stocks/fundamental_analysis/test_dcf_model.py +++ b/tests/openbb_terminal/stocks/fundamental_analysis/test_dcf_model.py @@ -150,8 +150,7 @@ def test_frac(): def test_generate_path(): result = dcf_model.generate_path( n=1, - symbol="TSLA", - date="2021-10-31", + file_name="test_dcf_model", ) assert isinstance(result, Path)