Fix test warning

This commit is contained in:
Matthias 2022-09-27 08:10:58 +00:00
parent 43e847ff2f
commit 8c2e473ee5
5 changed files with 9 additions and 9 deletions

View File

@ -284,7 +284,7 @@ def load_backtest_data(filename: Union[Path, str], strategy: Optional[str] = Non
df['enter_tag'] = df['buy_tag'] df['enter_tag'] = df['buy_tag']
df = df.drop(['buy_tag'], axis=1) df = df.drop(['buy_tag'], axis=1)
if 'orders' not in df.columns: if 'orders' not in df.columns:
df.loc[:, 'orders'] = None df['orders'] = None
else: else:
# old format - only with lists. # old format - only with lists.

View File

@ -370,10 +370,10 @@ class Backtesting:
for col in HEADERS[5:]: for col in HEADERS[5:]:
tag_col = col in ('enter_tag', 'exit_tag') tag_col = col in ('enter_tag', 'exit_tag')
if col in df_analyzed.columns: 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) [nan], [0 if not tag_col else None]).shift(1)
elif not df_analyzed.empty: 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) df_analyzed = df_analyzed.drop(df_analyzed.head(1).index)

View File

@ -275,7 +275,7 @@ def test_create_cum_profit1(testdatadir):
filename = testdatadir / "backtest_results/backtest-result_new.json" filename = testdatadir / "backtest_results/backtest-result_new.json"
bt_data = load_backtest_data(filename) bt_data = load_backtest_data(filename)
# Move close-time to "off" the candle, to make sure the logic still works # 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") timerange = TimeRange.parse_timerange("20180110-20180112")
df = load_pair_history(pair="TRX/BTC", timeframe='5m', df = load_pair_history(pair="TRX/BTC", timeframe='5m',

View File

@ -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'], data = history.load_data(datadir=testdatadir, timeframe='5m', pairs=['UNITTEST/BTC'],
timerange=timerange) timerange=timerange)
df = data['UNITTEST/BTC'] 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. # Trimming 100 candles, so after 2nd trimming, no candle is left.
df = df.iloc[:100] df = df.iloc[:100]
data['XRP/USDT'] = df data['XRP/USDT'] = df

View File

@ -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. # 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 = ohlcv_history.copy()
ohlcv_history_high_volume.loc[:, 'volume'] = 10 ohlcv_history_high_volume['volume'] = 10
ohlcv_history_high_volume.loc[:, 'low'] = ohlcv_history_high_volume.loc[:, 'low'] * 0.01 ohlcv_history_high_volume['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['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['close'] = ohlcv_history_high_volume.loc[:, 'close'] * 0.01
mocker.patch('freqtrade.exchange.ftx.Ftx.market_is_tradable', return_value=True) mocker.patch('freqtrade.exchange.ftx.Ftx.market_is_tradable', return_value=True)