Fix trades duplicates if trade id is different

This commit is contained in:
Matthias
2023-08-17 18:04:13 +02:00
parent 5d5cc71945
commit 780f238904
3 changed files with 4 additions and 3 deletions

View File

@@ -203,7 +203,7 @@ def trades_remove_duplicates(trades: List[List]) -> List[List]:
:param trades: List of Lists with constants.DEFAULT_TRADES_COLUMNS as columns
:return: same format as above, but with duplicates removed
"""
return [i for i, _ in itertools.groupby(sorted(trades, key=itemgetter(0)))]
return [i for i, _ in itertools.groupby(sorted(trades, key=itemgetter(0, 1)))]
def trades_df_remove_duplicates(trades: pd.DataFrame) -> pd.DataFrame:

View File

@@ -2346,7 +2346,8 @@ def trades_history():
[1565798399629, '1261813bb30', None, 'buy', 0.019627, 0.244, 0.004788987999999999],
[1565798399752, '1261813cc31', None, 'sell', 0.019626, 0.011, 0.00021588599999999999],
[1565798399862, '126181cc332', None, 'sell', 0.019626, 0.011, 0.00021588599999999999],
[1565798399872, '1261aa81333', None, 'sell', 0.019626, 0.011, 0.00021588599999999999]]
[1565798399862, '126181cc333', None, 'sell', 0.019626, 0.012, 0.00021588599999999999],
[1565798399872, '1261aa81334', None, 'sell', 0.019626, 0.011, 0.00021588599999999999]]
@pytest.fixture(scope="function")

View File

@@ -581,7 +581,7 @@ def test_download_trades_history(trades_history, mocker, default_conf, testdatad
assert _download_trades_history(data_handler=data_handler, exchange=exchange,
pair='ETH/BTC')
assert log_has("New Amount of trades: 5", caplog)
assert log_has("New Amount of trades: 6", caplog)
assert file1.is_file()
ght_mock.reset_mock()