From 5d5cc719450f597c706148edfad11f793875c7e5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 17 Aug 2023 17:53:08 +0200 Subject: [PATCH] Fix pandas duplication detection, improve test --- freqtrade/data/converter.py | 2 +- tests/data/test_history.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/freqtrade/data/converter.py b/freqtrade/data/converter.py index cd5719326..d2943f450 100644 --- a/freqtrade/data/converter.py +++ b/freqtrade/data/converter.py @@ -213,7 +213,7 @@ def trades_df_remove_duplicates(trades: pd.DataFrame) -> pd.DataFrame: :param trades: DataFrame with the columns constants.DEFAULT_TRADES_COLUMNS :return: DataFrame with duplicates removed based on the 'timestamp' column """ - return trades.drop_duplicates(subset=['timestamp']) + return trades.drop_duplicates(subset=['timestamp', 'id']) def trades_dict_to_list(trades: List[Dict]) -> TradeList: diff --git a/tests/data/test_history.py b/tests/data/test_history.py index 417f984ca..931365c78 100644 --- a/tests/data/test_history.py +++ b/tests/data/test_history.py @@ -651,10 +651,10 @@ def test_convert_trades_to_ohlcv(testdatadir, tmpdir, caplog): assert_frame_equal(dfbak_1m, df_1m, check_exact=True) assert_frame_equal(dfbak_5m, df_5m, check_exact=True) - - assert not log_has('Could not convert NoDatapair to OHLCV.', caplog) + msg = 'Could not convert NoDatapair to OHLCV.' + assert not log_has(msg, caplog) convert_trades_to_ohlcv(['NoDatapair'], timeframes=['1m', '5m'], data_format_trades='jsongz', datadir=tmpdir1, timerange=tr, erase=True) - assert log_has('Could not convert NoDatapair to OHLCV.', caplog) + assert log_has(msg, caplog)