mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-02 01:53:05 +00:00
Don't skip trades if the exchange doesn't do inclusive filtering
This commit is contained in:
@@ -2287,6 +2287,9 @@ class Exchange:
|
||||
trades: List[List] = []
|
||||
# DEFAULT_TRADES_COLUMNS: 0 -> timestamp
|
||||
# DEFAULT_TRADES_COLUMNS: 1 -> id
|
||||
has_overlap = self._ft_has.get('trades_pagination_overlap', True)
|
||||
# Skip last trade by default since its the key for the next call
|
||||
x = slice(None, -1) if has_overlap else slice(None)
|
||||
|
||||
if not from_id or not self._valid_trade_pagination_id(pair, from_id):
|
||||
# Fetch first elements using timebased method to get an ID to paginate on
|
||||
@@ -2295,19 +2298,19 @@ class Exchange:
|
||||
# e.g. Binance returns the "last 1000" candles within a 1h time interval
|
||||
# - so we will miss the first trades.
|
||||
t, from_id = await self._async_fetch_trades(pair, since=since)
|
||||
trades.extend(t[:-1])
|
||||
trades.extend(t[x])
|
||||
while True:
|
||||
try:
|
||||
t, from_id_next = await self._async_fetch_trades(
|
||||
pair, params={self._trades_pagination_arg: from_id})
|
||||
if t:
|
||||
# Skip last id since its the key for the next call
|
||||
trades.extend(t[:-1])
|
||||
trades.extend(t[x])
|
||||
if from_id == from_id_next or t[-1][0] > until:
|
||||
logger.debug(f"Stopping because from_id did not change. "
|
||||
f"Reached {t[-1][0]} > {until}")
|
||||
# Reached the end of the defined-download period - add last trade as well.
|
||||
trades.extend(t[-1:])
|
||||
if has_overlap:
|
||||
trades.extend(t[-1:])
|
||||
break
|
||||
|
||||
from_id = from_id_next
|
||||
|
||||
@@ -30,6 +30,7 @@ class Kraken(Exchange):
|
||||
"ohlcv_has_history": False,
|
||||
"trades_pagination": "id",
|
||||
"trades_pagination_arg": "since",
|
||||
"trades_pagination_overlap": False,
|
||||
"mark_ohlcv_timeframe": "4h",
|
||||
}
|
||||
|
||||
@@ -157,7 +158,7 @@ class Kraken(Exchange):
|
||||
|
||||
return fees if is_short else -fees
|
||||
|
||||
def _get_trade_pagination_next_value(self, trades: List[Dict]) -> str:
|
||||
def _get_trade_pagination_next_value(self, trades: List[Dict]):
|
||||
"""
|
||||
Extract pagination id for the next "from_id" value
|
||||
Applies only to fetch_trade_history by id.
|
||||
|
||||
Reference in New Issue
Block a user