diff --git a/openbb_terminal/common/technical_analysis/custom_indicators_model.py b/openbb_terminal/common/technical_analysis/custom_indicators_model.py index b7fc5ace265e..6846ba9159e5 100644 --- a/openbb_terminal/common/technical_analysis/custom_indicators_model.py +++ b/openbb_terminal/common/technical_analysis/custom_indicators_model.py @@ -51,12 +51,12 @@ def calculate_fib_levels( return pd.DataFrame(), pd.Timestamp(), pd.Timestamp(), 0, 0, "" if start_date and end_date: if start_date not in data.index: - date0 = data.index[data.index.get_loc(start_date, method="nearest")] + date0 = data.index[data.index.get_indexer([end_date], method="nearest")[0]] console.print(f"Start date not in data. Using nearest: {date0}") else: date0 = start_date if end_date not in data.index: - date1 = data.index[data.index.get_loc(end_date, method="nearest")] + date1 = data.index[data.index.get_indexer([end_date], method="nearest")[0]] console.print(f"End date not in data. Using nearest: {date1}") else: date1 = end_date diff --git a/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py b/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py index 5b01ac0ecbfd..79775c2dbf09 100644 --- a/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py +++ b/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py @@ -146,8 +146,8 @@ def plot_fib(self, fig: OpenBBFigure, df_ta: pd.DataFrame): "0.65", "1", ] - min_date = min_date.to_pydatetime() - max_date = max_date.to_pydatetime() + min_date = pd.to_datetime(min_date).to_pydatetime() + max_date = pd.to_datetime(max_date).to_pydatetime() self.df_fib = df_fib fig.add_scatter(