Gate spot historical candle pagination leaves gaps across multiple timeframes
Describe the bug
On the Indicators page, dragging left to load older candles creates gaps between the existing candles and the newly loaded historical candles.
This occurs across multiple timeframes, not only 4H. The following 4H case is one reproducible example:
For Gate spot BTC/USDT, the initial page starts at 2026-08-15 00:00 (UTC+8), but the historical page ends at 2026-06-25 20:00 (UTC+8), leaving a large gap.
Steps to reproduce
- Open the Indicators page.
- Select Gate, spot, BTC/USDT, and the 4H timeframe.
- Load the initial 480 candles.
- Drag left to load older candles.
- Observe the gap between the two pages.
Initial request: /api/indicator/kline?market=Crypto&symbol=BTC%2FUSDT&timeframe=4H&exchange_id=gate&market_type=spot&limit=480
Historical request: /api/indicator/kline?market=Crypto&symbol=BTC%2FUSDT&timeframe=4H&exchange_id=gate&market_type=spot&limit=500&before_time=1786723200
Expected behavior
The historical page should end at 2026-08-14 20:00 (UTC+8), exactly four hours before the first candle on the initial page, with no missing candles between pages.
Deployment method
Docker Compose
Version
5.8.1
Relevant logs
Thanks for the clear reproduction details. This issue was fixed in #343 and the fix is now available on main.
The Gate spot historical pagination logic now respects the requested right boundary, and we added a regression test for the exact reported 4H case (before_time=1786723200). The test verifies that the historical page ends at 1786708800, the immediately preceding 4H candle, without a gap. Additional pagination continuity coverage was also added across timeframes and supported venues.
Closing this as resolved. If the gap still occurs on the latest main, please open a new issue with the current version and request/response timestamps so we can investigate it further.