diff --git a/freqtrade/data/btanalysis.py b/freqtrade/data/btanalysis.py index accb92e42..c32db9165 100644 --- a/freqtrade/data/btanalysis.py +++ b/freqtrade/data/btanalysis.py @@ -284,7 +284,7 @@ def load_backtest_data(filename: Union[Path, str], strategy: Optional[str] = Non df['enter_tag'] = df['buy_tag'] df = df.drop(['buy_tag'], axis=1) if 'orders' not in df.columns: - df.loc[:, 'orders'] = None + df['orders'] = None else: # old format - only with lists. diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 601190b4f..e942bdfeb 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -370,10 +370,10 @@ class Backtesting: for col in HEADERS[5:]: tag_col = col in ('enter_tag', 'exit_tag') if col in df_analyzed.columns: - df_analyzed.loc[:, col] = df_analyzed.loc[:, col].replace( + df_analyzed[col] = df_analyzed.loc[:, col].replace( [nan], [0 if not tag_col else None]).shift(1) elif not df_analyzed.empty: - df_analyzed.loc[:, col] = 0 if not tag_col else None + df_analyzed[col] = 0 if not tag_col else None df_analyzed = df_analyzed.drop(df_analyzed.head(1).index) diff --git a/tests/data/test_btanalysis.py b/tests/data/test_btanalysis.py index 72084d067..dab76d0cb 100644 --- a/tests/data/test_btanalysis.py +++ b/tests/data/test_btanalysis.py @@ -275,7 +275,7 @@ def test_create_cum_profit1(testdatadir): filename = testdatadir / "backtest_results/backtest-result_new.json" bt_data = load_backtest_data(filename) # Move close-time to "off" the candle, to make sure the logic still works - bt_data.loc[:, 'close_date'] = bt_data.loc[:, 'close_date'] + DateOffset(seconds=20) + bt_data['close_date'] = bt_data.loc[:, 'close_date'] + DateOffset(seconds=20) timerange = TimeRange.parse_timerange("20180110-20180112") df = load_pair_history(pair="TRX/BTC", timeframe='5m', diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index 697443e00..bd87b2b42 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -839,7 +839,7 @@ def test_backtest_trim_no_data_left(default_conf, fee, mocker, testdatadir) -> N data = history.load_data(datadir=testdatadir, timeframe='5m', pairs=['UNITTEST/BTC'], timerange=timerange) df = data['UNITTEST/BTC'] - df.loc[:, 'date'] = df.loc[:, 'date'] - timedelta(days=1) + df['date'] = df.loc[:, 'date'] - timedelta(days=1) # Trimming 100 candles, so after 2nd trimming, no candle is left. df = df.iloc[:100] data['XRP/USDT'] = df diff --git a/tests/plugins/test_pairlist.py b/tests/plugins/test_pairlist.py index 538751251..d6f074edb 100644 --- a/tests/plugins/test_pairlist.py +++ b/tests/plugins/test_pairlist.py @@ -622,10 +622,10 @@ def test_VolumePairList_range(mocker, whitelist_conf, shitcoinmarkets, tickers, # create candles for high volume with all candles high volume, but very low price. ohlcv_history_high_volume = ohlcv_history.copy() - ohlcv_history_high_volume.loc[:, 'volume'] = 10 - ohlcv_history_high_volume.loc[:, 'low'] = ohlcv_history_high_volume.loc[:, 'low'] * 0.01 - ohlcv_history_high_volume.loc[:, 'high'] = ohlcv_history_high_volume.loc[:, 'high'] * 0.01 - ohlcv_history_high_volume.loc[:, 'close'] = ohlcv_history_high_volume.loc[:, 'close'] * 0.01 + ohlcv_history_high_volume['volume'] = 10 + ohlcv_history_high_volume['low'] = ohlcv_history_high_volume.loc[:, 'low'] * 0.01 + ohlcv_history_high_volume['high'] = ohlcv_history_high_volume.loc[:, 'high'] * 0.01 + ohlcv_history_high_volume['close'] = ohlcv_history_high_volume.loc[:, 'close'] * 0.01 mocker.patch('freqtrade.exchange.ftx.Ftx.market_is_tradable', return_value=True)