From 21d7406291de50d183b12c9b694233918b46e961 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 27 Nov 2022 15:14:19 +0100 Subject: [PATCH] Temporary fix for kraken download closes #7790 will be removed once the patch is in ccxt. --- freqtrade/exchange/kraken.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/freqtrade/exchange/kraken.py b/freqtrade/exchange/kraken.py index f3a9486f2..5d8c1ad29 100644 --- a/freqtrade/exchange/kraken.py +++ b/freqtrade/exchange/kraken.py @@ -218,3 +218,19 @@ class Kraken(Exchange): fees = sum(df['open_fund'] * df['open_mark'] * amount * time_in_ratio) return fees if is_short else -fees + + def _trades_contracts_to_amount(self, trades: List) -> List: + """ + Fix "last" id issue for kraken data downloads + This whole override can probably be removed once the following + issue is closed in ccxt: https://github.com/ccxt/ccxt/issues/15827 + """ + super()._trades_contracts_to_amount(trades) + if ( + len(trades) > 0 + and isinstance(trades[-1].get('info'), list) + and len(trades[-1].get('info', [])) > 7 + ): + + trades[-1]['id'] = trades[-1].get('info', [])[-1] + return trades