mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
deprecate econometrics/season
This commit is contained in:
@@ -56,7 +56,6 @@ class EconometricsController(BaseController):
|
||||
"type",
|
||||
"desc",
|
||||
"corr",
|
||||
"season",
|
||||
"index",
|
||||
"clean",
|
||||
"add",
|
||||
@@ -188,7 +187,6 @@ class EconometricsController(BaseController):
|
||||
"granger",
|
||||
"coint",
|
||||
"corr",
|
||||
"season",
|
||||
"lag",
|
||||
"vif",
|
||||
]:
|
||||
@@ -216,7 +214,6 @@ class EconometricsController(BaseController):
|
||||
"norm",
|
||||
"root",
|
||||
"coint",
|
||||
"season",
|
||||
"lag",
|
||||
"regressions",
|
||||
"ols",
|
||||
@@ -279,7 +276,6 @@ class EconometricsController(BaseController):
|
||||
mt.add_cmd("type", self.files)
|
||||
mt.add_cmd("desc", self.files)
|
||||
mt.add_cmd("corr", self.files)
|
||||
mt.add_cmd("season", self.files)
|
||||
mt.add_cmd("index", self.files)
|
||||
mt.add_cmd("clean", self.files)
|
||||
mt.add_cmd("add", self.files)
|
||||
@@ -752,79 +748,6 @@ class EconometricsController(BaseController):
|
||||
ns_parser.export,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_season(self, other_args: List[str]):
|
||||
"""Process season command"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
prog="season",
|
||||
description="The seasonality for a given column",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v",
|
||||
"--values",
|
||||
help="Dataset.column values to be displayed in a plot",
|
||||
dest="values",
|
||||
choices={
|
||||
f"{dataset}.{column}": {column: None, dataset: None}
|
||||
for dataset, dataframe in self.datasets.items()
|
||||
for column in dataframe.columns
|
||||
},
|
||||
type=str,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-m",
|
||||
help="A time lag to highlight on the plot",
|
||||
dest="m",
|
||||
type=int,
|
||||
default=None,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--max_lag",
|
||||
help="The maximal lag order to consider",
|
||||
dest="max_lag",
|
||||
type=int,
|
||||
default=24,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-a",
|
||||
"--alpha",
|
||||
help="The confidence interval to display",
|
||||
dest="alpha",
|
||||
type=float,
|
||||
default=0.05,
|
||||
)
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-v")
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser, other_args, export_allowed=EXPORT_ONLY_FIGURES_ALLOWED
|
||||
)
|
||||
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
if not ns_parser.values:
|
||||
console.print("[red]Please enter valid dataset.\n[/red]")
|
||||
return
|
||||
|
||||
try:
|
||||
dataset, col = ns_parser.values.split(".")
|
||||
data = self.datasets[dataset]
|
||||
data.name = dataset
|
||||
except ValueError:
|
||||
console.print("[red]Please enter 'dataset'.'column'.[/red]\n")
|
||||
return
|
||||
|
||||
econometrics_view.display_seasonality(
|
||||
data=data,
|
||||
column=col,
|
||||
export=ns_parser.export,
|
||||
m=ns_parser.m,
|
||||
max_lag=ns_parser.max_lag,
|
||||
alpha=ns_parser.alpha,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_type(self, other_args: List[str]):
|
||||
"""Process type command"""
|
||||
|
||||
@@ -200,63 +200,6 @@ def display_corr(
|
||||
return fig.show(external=external_axes)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_seasonality(
|
||||
data: pd.DataFrame,
|
||||
column: str = "close",
|
||||
export: str = "",
|
||||
sheet_name: Optional[str] = None,
|
||||
m: Optional[int] = None,
|
||||
max_lag: int = 24,
|
||||
alpha: float = 0.05,
|
||||
external_axes: bool = False,
|
||||
) -> Union[OpenBBFigure, None]:
|
||||
"""Plot seasonality from a dataset
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data: pd.DataFrame
|
||||
The dataframe to plot
|
||||
column: str
|
||||
The column of the dataframe to analyze
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export image
|
||||
m: Optional[int]
|
||||
Optionally, a time lag to highlight on the plot. Default is none.
|
||||
max_lag: int
|
||||
The maximal lag order to consider. Default is 24.
|
||||
alpha: float
|
||||
The confidence interval to display. Default is 0.05.
|
||||
external_axes : bool, optional
|
||||
Whether to return the figure object or not, by default False
|
||||
"""
|
||||
|
||||
if data.empty:
|
||||
return console.print("No data to plot")
|
||||
|
||||
series = data[column]
|
||||
|
||||
ending = get_ending(data.name, column)
|
||||
|
||||
fig = OpenBBFigure()
|
||||
fig.set_title(f"Seasonality{ending}", wrap=True, wrap_width=55)
|
||||
fig.add_corr_plot(series, m=m, max_lag=max_lag, alpha=alpha)
|
||||
fig.update_xaxes(autorange=False, range=[-1, max_lag + 1])
|
||||
fig.add_legend_label()
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"plot",
|
||||
sheet_name=sheet_name,
|
||||
figure=fig,
|
||||
)
|
||||
|
||||
return fig.show(external=external_axes)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_norm(
|
||||
data: pd.Series,
|
||||
|
||||
Reference in New Issue
Block a user