mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Improve kraken pagination behavior
This commit is contained in:
parent
f9b6830b78
commit
ac5b12cfd2
|
@ -157,21 +157,21 @@ class Kraken(Exchange):
|
|||
|
||||
return fees if is_short else -fees
|
||||
|
||||
def _trades_contracts_to_amount(self, trades: List) -> List:
|
||||
def _get_trade_pagination_next_value(self, trades: List[Dict]) -> str:
|
||||
"""
|
||||
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
|
||||
Extract pagination id for the next "from_id" value
|
||||
Applies only to fetch_trade_history by id.
|
||||
"""
|
||||
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
|
||||
if len(trades) > 0:
|
||||
if (
|
||||
isinstance(trades[-1].get('info'), list)
|
||||
and len(trades[-1].get('info', [])) > 7
|
||||
):
|
||||
# Trade response's "last" value.
|
||||
return trades[-1].get('info', [])[-1]
|
||||
# Fall back to timestamp if info is somehow empty.
|
||||
return trades[-1].get('timestamp')
|
||||
return None
|
||||
|
||||
def _valid_trade_pagination_id(self, pair: str, from_id: str) -> bool:
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user