mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-20 14:00:38 +00:00
Re-set funding-fee history limit for bybit to 200
This commit is contained in:
@@ -7,6 +7,7 @@ import ccxt
|
||||
|
||||
from freqtrade.constants import BuySell
|
||||
from freqtrade.enums import MarginMode, PriceType, TradingMode
|
||||
from freqtrade.enums.candletype import CandleType
|
||||
from freqtrade.exceptions import DDosProtection, OperationalException, TemporaryError
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.common import retrier
|
||||
@@ -91,6 +92,14 @@ class Bybit(Exchange):
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
|
||||
def ohlcv_candle_limit(
|
||||
self, timeframe: str, candle_type: CandleType, since_ms: Optional[int] = None) -> int:
|
||||
|
||||
if candle_type in (CandleType.FUNDING_RATE):
|
||||
return 200
|
||||
|
||||
return super().ohlcv_candle_limit(timeframe, candle_type, since_ms)
|
||||
|
||||
async def _fetch_funding_rate_history(
|
||||
self,
|
||||
pair: str,
|
||||
@@ -104,7 +113,8 @@ class Bybit(Exchange):
|
||||
"""
|
||||
params = {}
|
||||
if since_ms:
|
||||
until = since_ms + (timeframe_to_msecs(timeframe) * self._ft_has['ohlcv_candle_limit'])
|
||||
limit = self.ohlcv_candle_limit(timeframe, CandleType.FUNDING_RATE, since_ms)
|
||||
until = since_ms + (timeframe_to_msecs(timeframe) * limit)
|
||||
params.update({'until': until})
|
||||
# Funding rate
|
||||
data = await self._api_async.fetch_funding_rate_history(
|
||||
|
||||
@@ -26,7 +26,7 @@ async def test_bybit_fetch_funding_rate(default_conf, mocker):
|
||||
api_mock = MagicMock()
|
||||
api_mock.fetch_funding_rate_history = get_mock_coro(return_value=[])
|
||||
exchange = get_patched_exchange(mocker, default_conf, id='bybit', api_mock=api_mock)
|
||||
limit = 1000
|
||||
limit = 200
|
||||
# Test fetch_funding_rate_history (current data)
|
||||
await exchange._fetch_funding_rate_history(
|
||||
pair='BTC/USDT:USDT',
|
||||
|
||||
Reference in New Issue
Block a user