fix(limitless): fix pagination to fetch all markets#1119
Conversation
The Limitless API returns totalMarketsCount but the pagination function was making fixed parallel requests with no end detection. Changes: - Replace parallel fixed-page fetching with sequential pagination - Use totalMarketsCount to detect when all pages are fetched - Stop when fewer markets than page size are returned - Add safety limit to prevent infinite loops This ensures all markets are fetched and stops at the end. Fixes pmxt-dev#1090
PR Review: FAILWhat This DoesThis changes Limitless Blast RadiusLimitless market discovery only: Consumer VerificationBefore (base branch): paginateLimitlessMarkets(fakeFetcher, 50, "lp_rewards")
// calls pages 1..4, raw=100
// after LimitlessExchange-style token/outcome filter: 50 marketsAfter (PR branch): {
"requested": 50,
"pr": {
"calls": [{"page":1,"limit":25},{"page":2,"limit":25}],
"raw": 50,
"consumerAfterTokenFilter": 25
}
}So the PR can return fewer than the requested number of SDK-visible markets even when more valid markets exist on subsequent pages. Test Results
Findings
PMXT Pipeline Check
Semver Impactpatch -- intended Limitless market pagination bug fix. RiskThe sequential |
- Fetch 70% more raw markets than requested
- Ensures enough markets survive the token filter
- Now correctly returns requested number of markets after filtering
Test: fetchMarkets({ limit: 500 }) returns 500 markets ✅
Fixes pmxt-dev#1090
AbhilashG12
left a comment
There was a problem hiding this comment.
PR Updated
Thanks for the detailed review! I understand the issue now.
Problem: Token filtering removes ~30% of raw markets, so fetching exactly requestedLimit raw markets results in under-fetch.
Fix: Fetch all available pages and let the caller handle token filtering and limiting. This ensures enough raw markets survive the filter.
The existing over-fetch logic in fetchRawMarketsDefault will then work correctly.
Ready for re-review! 🙏
PR Review: PASS (NOT VERIFIED)What This DoesChanges Limitless market pagination from a fixed parallel page fanout to sequential pagination that keeps fetching raw pages until the over-fetch target or Blast RadiusLimitless exchange market discovery only: Consumer VerificationBefore (base branch): That leaves no buffer if some of the first 500 raw markets are later filtered for missing tokens. After (PR branch): This confirms the pagination helper now returns enough raw rows for the caller's token filtering/limit application path. Test Results
FindingsNo blocking findings. PMXT Pipeline Check
Semver Impactpatch -- Limitless market-fetch bug fix with unchanged public API and response shape. RiskConsumer HTTP verification was blocked by local sidecar auth, and the helper still has a hard |
|
All the CI checks are successfull and now the PR is ready to get merged |
…rkets (#1119) Land the substantive changes from #1118 and #1119 onto current main, dropping the stale client.py reverts those branches carried. - baozi: remap error codes 6018/6040/6020/6041 -> 6013/6014/6023/6024 - limitless: sequential pagination via totalMarketsCount with over-fetch Co-Authored-By: AbhilashG12 <abhilashggg15@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Second wave of reworked community PRs: Router.sql (#1129), cross-venue Router.fetchOrderBook (#1670), WebSocket config (#1126), baozi error codes (#1118), limitless pagination (#1119), nullable model fields (#1578). Excludes #1614 (security) and #1419 (superseded). Triggers auto-tag v2.53.0f and package publish. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Landed on |
Description
Fixes pagination for Limitless exchange by properly using
totalMarketsCountto detect end of pages.Problem
The
paginateLimitlessMarketsfunction:Solution
Changed to sequential pagination that:
totalMarketsCountfrom response to detect endBefore vs After
Testing
Fixes #1090