mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
fix: catch error when getting the last candle fails
It's unknown when this actually happens - but this should be the safer bet than crashing completely. closes #11213
This commit is contained in:
@@ -1160,8 +1160,12 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
logger.warning(f"Empty candle (OHLCV) data for pair {pair}")
|
||||
return None, None
|
||||
|
||||
latest_date_pd = dataframe["date"].max()
|
||||
latest = dataframe.loc[dataframe["date"] == latest_date_pd].iloc[-1]
|
||||
try:
|
||||
latest_date_pd = dataframe["date"].max()
|
||||
latest = dataframe.loc[dataframe["date"] == latest_date_pd].iloc[-1]
|
||||
except Exception as e:
|
||||
logger.warning(f"Unable to get latest candle (OHLCV) data for pair {pair} - {e}")
|
||||
return None, None
|
||||
# Explicitly convert to datetime object to ensure the below comparison does not fail
|
||||
latest_date: datetime = latest_date_pd.to_pydatetime()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user