diff options
Diffstat (limited to 'openbb_terminal')
-rw-r--r-- | openbb_terminal/forecast/helpers.py | 15 | ||||
-rw-r--r-- | openbb_terminal/forecast/timegpt_model.py | 4 | ||||
-rw-r--r-- | openbb_terminal/stocks/fundamental_analysis/av_model.py | 12 | ||||
-rw-r--r-- | openbb_terminal/stocks/options/tradier_model.py | 4 |
4 files changed, 20 insertions, 15 deletions
diff --git a/openbb_terminal/forecast/helpers.py b/openbb_terminal/forecast/helpers.py index cfefcb8191f..95e5e698a31 100644 --- a/openbb_terminal/forecast/helpers.py +++ b/openbb_terminal/forecast/helpers.py @@ -986,8 +986,9 @@ def dt_format(x) -> str: Returns: x: formatted string """ - x = pd.to_datetime(x) - x = x.strftime("%Y-%m-%d") + # x = pd.to_datetime(x, infer_datetime_format=False) + + # x = x.strftime("%Y-%m-%d") if x.time() == datetime.time(0,0) else x.strftime("%Y-%m-%d %H:%M:%S") return x @@ -1002,9 +1003,10 @@ def get_series( df=data, time_col=time_col, value_cols=[target_column], - freq="B", + freq=None, fill_missing_dates=True, ) + freq = "D" try: # for the sdk, we must check if date is a column not an index # check if date is in the index, if true, reset the index @@ -1014,7 +1016,10 @@ def get_series( # reset the index data.reset_index(drop=True, inplace=True) # remove 00:00:00 from 2019-11-19 00:00:00 - data[time_col] = data[time_col].apply(lambda x: dt_format(x)) + # data[time_col] = data[time_col].apply(lambda x: dt_format(x)) + freq = pd.infer_freq(data[time_col]) + + filler_kwargs["freq"] = freq ticker_series = TimeSeries.from_dataframe(**filler_kwargs) except ValueError: @@ -1078,7 +1083,7 @@ def get_prediction( ): _, val = ticker_series.split_before(train_split) - console.print(f"Predicting {model_name} for {n_predict} days") + console.print(f"Predicting {model_name} for {n_predict} periods") if model_name not in ["Regression", "Logistic Regression"]: # need to create a new pytorch trainer for historical backtesting to remove progress bar best_model.trainer = None diff --git a/openbb_terminal/forecast/timegpt_model.py b/openbb_terminal/forecast/timegpt_model.py index d973329e59f..1cc3a9724c9 100644 --- a/openbb_terminal/forecast/timegpt_model.py +++ b/openbb_terminal/forecast/timegpt_model.py @@ -69,9 +69,9 @@ def get_timegpt_model( levels = [80, 95] if isinstance(data[time_col].values[0], pd.Timestamp): - data[time_col] = data[time_col].dt.strftime("%Y-%m-%d") + data[time_col] = data[time_col].dt.strftime("%Y-%m-%d %H:%M:%S") elif isinstance(data[time_col].values[0], numpy.datetime64): - data[time_col] = pd.to_datetime(data[time_col]).dt.strftime("%Y-%m-%d") + data[time_col] = pd.to_datetime(data[time_col]).dt.strftime("%Y-%m-%d %H:%M:%S") date_features_param = True if "auto" in date_features else date_features # type: ignore diff --git a/openbb_terminal/stocks/fundamental_analysis/av_model.py b/openbb_terminal/stocks/fundamental_analysis/av_model.py index 3f9dccc1b5a..08fae05678b 100644 --- a/openbb_terminal/stocks/fundamental_analysis/av_model.py +++ b/openbb_terminal/stocks/fundamental_analysis/av_model.py @@ -724,17 +724,17 @@ def get_dupont(symbol: str) -> pd.DataFrame: ) return pd.DataFrame() - if not df_bs.index.equals(df_is.index): - console.print( - "The fiscal dates in the balance sheet do not correspond to the fiscal dates in the income statement." - ) - return pd.DataFrame() - # pylint: disable=no-member df_bs = df_bs.set_index("fiscalDateEnding") df_is = df_is.set_index("fiscalDateEnding") dupont_years = pd.DataFrame() + if len(df_bs) != len(df_is): + console.print( + "The fiscal dates in the balance sheet do not correspond to the fiscal dates in the income statement." + ) + return pd.DataFrame() + for i in range(len(df_bs)): ni = df_values(df_is, "netIncome", i, 1) pretax = df_values(df_is, "incomeBeforeTax", i, 1) diff --git a/openbb_terminal/stocks/options/tradier_model.py b/openbb_terminal/stocks/options/tradier_model.py index 90f96998584..6d88eb78eb0 100644 --- a/openbb_terminal/stocks/options/tradier_model.py +++ b/openbb_terminal/stocks/options/tradier_model.py @@ -393,9 +393,9 @@ def get_underlying_price(symbol: str) -> pd.Series: "root_symbols": "rootSymbols", } ) - underlying_price[ + underlying_price[ # pylint: disable=unsupported-assignment-operation "lastTradeTimestamp" - ] = ( # pylint: disable=unsupported-assignment-operation + ] = ( pd.to_datetime(underlying_price["lastTradeTimestamp"], unit="ms").tz_localize( "EST" ) |