Skip to content

Bybit fetch_funding_rate_history returns different time periods based on limit parameter #27745

@engineswap

Description

@engineswap

Operating System

Linux

Programming Language

Python

CCXT Version

4.5.10

Description

Bybit's fetch_funding_rate_history exhibits inconsistent behavior where the limit parameter determines which time period is returned, causing gaps in historical data retrieval.

Issue: When fetching funding rate history from a specific since timestamp, different limit values return completely different time periods instead of just limiting the number of results.

Test Case:

import ccxt
import pandas as pd

exchange = ccxt.bybit()
exchange.verbose = True

symbol = "ZRX/USDT:USDT" 
since = int(pd.Timestamp("2025-11-01T00:00:00Z").timestamp() * 1000)

# Test different limits
for limit in [100, 200, 300]:
    bars = exchange.fetch_funding_rate_history(symbol, since=since, limit=limit)
    if bars:
        print(f"Limit {limit}: {len(bars)} bars from {bars[0]['datetime']} to {bars[-1]['datetime']}")

Actual Results:

Limit 100: 100 bars from 2025-11-01T08:00:00.000Z to 2025-12-04T08:00:00.000Z
Limit 200: 200 bars from 2025-12-22T16:00:00.000Z to 2026-01-06T16:00:00.000Z  
Limit 300: 200 bars from 2026-01-17T13:00:00.000Z to 2026-01-25T20:00:00.000Z

Expected Results:
All limits should return data starting from the same since timestamp (2025-11-01), with higher limits simply returning more consecutive records.

Impact:

  • Pagination fails to retrieve complete historical data
  • Forward pagination with paginationDirection: "forward" skips chunks of data

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions