mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-07 18:01:10 +00:00
Hotfix/ stocks/fa/dcf (#4992)
* Remove flags * Update DCF params and file naming
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user