Skip to content

Commit 34a72a0

Browse files
committed
feat: doin't drop last candle for funding fees
1 parent a9db7d0 commit 34a72a0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

freqtrade/exchange/exchange.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,7 +2481,14 @@ async def _async_get_historic_ohlcv(
24812481
data.extend(new_data)
24822482
# Sort data again after extending the result - above calls return in "async order"
24832483
data = sorted(data, key=lambda x: x[0])
2484-
return pair, timeframe, candle_type, data, self._ohlcv_partial_candle
2484+
return (
2485+
pair,
2486+
timeframe,
2487+
candle_type,
2488+
data,
2489+
# funding_rates are always complete, so never need to be dropped.
2490+
self._ohlcv_partial_candle if candle_type != CandleType.FUNDING_RATE else False,
2491+
)
24852492

24862493
def _try_build_from_websocket(
24872494
self, pair: str, timeframe: str, candle_type: CandleType
@@ -2816,7 +2823,14 @@ async def _async_get_candle_history(
28162823
logger.exception("Error loading %s. Result was %s.", pair, data)
28172824
return pair, timeframe, candle_type, [], self._ohlcv_partial_candle
28182825
logger.debug("Done fetching pair %s, %s interval %s...", pair, candle_type, timeframe)
2819-
return pair, timeframe, candle_type, data, self._ohlcv_partial_candle
2826+
return (
2827+
pair,
2828+
timeframe,
2829+
candle_type,
2830+
data,
2831+
# funding_rates are always complete, so never need to be dropped.
2832+
self._ohlcv_partial_candle if candle_type != CandleType.FUNDING_RATE else False,
2833+
)
28202834

28212835
except ccxt.NotSupported as e:
28222836
raise OperationalException(

0 commit comments

Comments
 (0)