update doc to reflect better empty dataframe check

This commit is contained in:
Robert Caulk
2021-05-17 11:40:57 +02:00
committed by GitHub
parent 6542070afa
commit 860a4d2390

View File

@@ -65,9 +65,10 @@ class AwesomeStrategy(IStrategy):
trade_date = timeframe_to_prev_date(self.timeframe, trade.open_date_utc)
# Look up trade candle.
trade_candle = dataframe.loc[dataframe['date'] == trade_date]
# trade_candle may be None for trades that just opened as it is still incomplete.
if trade_candle is not None:
# trade_candle may be empty for trades that just opened as it is still incomplete.
if trade_candle.empty:
# <...>
trade_candle = trade_candle.squeeze()
```
!!! Warning "Using .iloc[-1]"