chore: improve type safety

This commit is contained in:
Matthias
2024-12-07 13:21:18 +01:00
parent 63f8217cd5
commit fb9e11b7b5

View File

@@ -1163,10 +1163,10 @@ class IStrategy(ABC, HyperStrategyMixin):
logger.warning(f"Empty candle (OHLCV) data for pair {pair}")
return None, None
latest_date = dataframe["date"].max()
latest = dataframe.loc[dataframe["date"] == latest_date].iloc[-1]
latest_date_pd = dataframe["date"].max()
latest = dataframe.loc[dataframe["date"] == latest_date_pd].iloc[-1]
# Explicitly convert to datetime object to ensure the below comparison does not fail
latest_date = latest_date.to_pydatetime()
latest_date: datetime = latest_date_pd.to_pydatetime()
# Check if dataframe is out of date
timeframe_minutes = timeframe_to_minutes(timeframe)