Move squeeze into if block

This commit is contained in:
Matthias 2021-05-21 08:06:27 +02:00
parent 860a4d2390
commit 1a30e39222

View File

@ -40,7 +40,6 @@ class AwesomeStrategy(IStrategy):
!!! Note !!! Note
If the data is pair-specific, make sure to use pair as one of the keys in the dictionary. If the data is pair-specific, make sure to use pair as one of the keys in the dictionary.
## Dataframe access ## Dataframe access
You may access dataframe in various strategy functions by querying it from dataprovider. You may access dataframe in various strategy functions by querying it from dataprovider.
@ -67,8 +66,8 @@ class AwesomeStrategy(IStrategy):
trade_candle = dataframe.loc[dataframe['date'] == trade_date] trade_candle = dataframe.loc[dataframe['date'] == trade_date]
# trade_candle may be empty for trades that just opened as it is still incomplete. # trade_candle may be empty for trades that just opened as it is still incomplete.
if trade_candle.empty: if trade_candle.empty:
trade_candle = trade_candle.squeeze()
# <...> # <...>
trade_candle = trade_candle.squeeze()
``` ```
!!! Warning "Using .iloc[-1]" !!! Warning "Using .iloc[-1]"