Skip to content

feat(data-api-v2): Integrate Data API v2 to SDK - #316

Merged
kartojal merged 77 commits into
mainfrom
integration/data-api-v2
Sep 9, 2026
Merged

feat(data-api-v2): Integrate Data API v2 to SDK#316
kartojal merged 77 commits into
mainfrom
integration/data-api-v2

Conversation

@ExoMonk

@ExoMonk ExoMonk commented Aug 26, 2026

Copy link
Copy Markdown
Member

Note

High Risk
Large breaking changes across portfolio, feeds, pagination, and identifiers; secure listPositions always binds the authenticated wallet, so integrators must update call sites and paging logic.

Overview
Migrates @polymarket/bindings and @polymarket/client onto the Data API /v2 surface with shared dataPageSchema / dataEnvelopeSchema parsing, server-minted cursor pagination (replacing offset probing), and withRateLimitRetry on data calls. Feed and portfolio reads (listTrades, listActivity, listPositions, combo activity/positions, holders, leaderboards, open interest, live volume, price history, portfolio value**) keep familiar names but break callers: conditionId (≤20 ids, client-validated) instead of market, unified window time selection, stricter normalized rows (DecimalString, epoch ms, sentinels → undefined), and OrderSide instead of Side.

Removals / replacements: listClosedPositions and listMarketPositionslistPositions with status; listOpenInterestfetchOpenInterest; CLOB fetchPriceHistory → data listPriceHistory; fetchTradedMarketCountfetchUserStats().tradedMarketCount. Adds fetchResolutions, fetchUserPnl, fetchUserVolume, fetchTraderLeaderboardStanding, listBiggestWinners, MIGRATION/TIP activity types, combo leg display metadata, protocol v2 condition ID canonicalization, and a builder analytics example. SDK direction doc now standardizes public assetId (with deprecated tokenId alias).

Reviewed by Cursor Bugbot for commit a641918. Bugbot is set up for automated code reviews on this repo. Configure here.

Exomonk and others added 30 commits August 26, 2026 03:46
…nt-envelope-errors-429-retry-auth-ready

feat(data-api): sdk core client envelope errors 429 retry auth ready
…ature/dev-610-sdk-cursor-pagination-engine-walker-pinning-no-offset
…gination-engine-walker-pinning-no-offset

feat(data-api-v2): Cursor implementation with /v2/trades replacement - DEV-610
Review follow-up (Cesare): the v2 wire serves JSON numbers, and the SDK
surface normalizes every money, size, price, and PnL value through
DecimalishSchema to DecimalString so v2 methods read like the v1 SDK.
Values stringify losslessly at their 6-decimal wire grain. endDate becomes
a typed IsoCalendarDateString with the corresponding field schema.

Also absorbs the DENG-599 combos wire flip (gross_entry_cost_usdc,
entry_fees_usdc, leg_current_price serve as numbers; Decimalish accepts
both encodings, so the SDK is transition-proof), and ComboPositionStatus
gains Redeemable: tolerated on rows, sole-value-only as a filter (the
multi-status arm rejects it with a typed message, matching the service).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cursor finding on 2f648a9: the multi-status refine rejected the
type-valid `status: [ComboPositionStatus.Redeemable]`, which serializes
to the same `status=REDEEMABLE` query as the scalar form. REDEEMABLE is
now rejected only when it rides with other statuses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…oints-trades-activity-positions-combos-pair

feat: integrate positions & activity with combos for data-api /v2 path
@ExoMonk ExoMonk changed the title !WIP feat(data-api-v2): Integrate Data API v2 to SDK feat(data-api-v2): Integrate Data API v2 to SDK Sep 3, 2026
@ExoMonk
ExoMonk marked this pull request as ready for review September 3, 2026 17:34

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6b16313. Configure here.

Comment thread packages/bindings/src/data/activity.ts Outdated
@kartojal
kartojal merged commit 1f371f6 into main Sep 9, 2026
8 checks passed
@kartojal
kartojal deleted the integration/data-api-v2 branch September 9, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants