Skip to content
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
8befd1f
feat(data): v2 envelope schemas, rate-limit retry helper, MIGRATION a…
Aug 26, 2026
334bff7
feat: cleaning
Aug 26, 2026
d02b337
fix: comments
Aug 26, 2026
f2585c1
Merge pull request #313 from Polymarket/feature/dev-609-sdk-core-clie…
ExoMonk Aug 26, 2026
7ed1af9
feat: pagination implementation
Aug 26, 2026
c814791
fix: findings
Aug 26, 2026
329eda8
feat: pag
Aug 26, 2026
0680cf0
fix: file proliferation
Aug 26, 2026
15c4d5f
feat: replacement for trades
Aug 26, 2026
93dd749
feat: market -> condition renaming
Aug 26, 2026
86b4f3a
feat: limit
Aug 27, 2026
f75e1ce
fix: nits from comments
Aug 27, 2026
be617a5
feat: dedup
Aug 27, 2026
d72830c
rebase
Aug 27, 2026
6a5a96a
Merge remote-tracking branch 'origin/main' into integration/data-api-v2
Aug 27, 2026
2195b8f
Merge remote-tracking branch 'origin/integration/data-api-v2' into fe…
Aug 27, 2026
1ce66ab
Merge pull request #315 from Polymarket/feature/dev-610-sdk-cursor-pa…
ExoMonk Aug 27, 2026
7b68c7a
feat: integrate positions & activity with combos for data-api /v2 path
Aug 27, 2026
e6783bb
fix: PR comments
Aug 27, 2026
b3b93de
feat: tip addition
Aug 27, 2026
44caa60
feat: limit update
Aug 27, 2026
02b1f66
feat: tip
Aug 27, 2026
f170412
feat: tip side
Aug 27, 2026
494c506
feat: address PR
Aug 28, 2026
6e3ae8d
feat(data): migrate builder analytics to data api v2
skanda-polymarket Aug 30, 2026
cb664fb
feat(data): add resolution lifecycle queries
skanda-polymarket Aug 31, 2026
2f648a9
refactor(data): normalize v2 decimal values to DecimalString
Aug 31, 2026
d886068
fix(client): accept a sole-element REDEEMABLE status array
Aug 31, 2026
aab022c
Merge pull request #325 from Polymarket/feature/dev-611-sdk-feed-endp…
ExoMonk Aug 31, 2026
b06b59e
Merge branch 'main' into integration/data-api-v2
ExoMonk Aug 31, 2026
efa5247
test(data): stabilize builder leaderboard pagination
skanda-polymarket Sep 1, 2026
a3cb2ca
chore(data): sync data api v2 integration
skanda-polymarket Sep 1, 2026
516cf84
chore(data): sync builder analytics stack
skanda-polymarket Sep 1, 2026
a13dc95
fix(data): align resolution boundary contracts
skanda-polymarket Sep 1, 2026
0df4f2b
feat(data): migrate portfolio summaries to v2
skanda-polymarket Sep 1, 2026
c686bbf
fix(data): align portfolio decimals with sdk contract
skanda-polymarket Sep 1, 2026
4f6e827
Merge pull request #332 from Polymarket/feat/data-api-v2-builder-anal…
skanda-polymarket Sep 1, 2026
14c9d29
Merge pull request #333 from Polymarket/feat/data-api-v2-resolutions
skanda-polymarket Sep 1, 2026
a10de64
fix(bindings): name yearly builder volume interval
skanda-polymarket Sep 1, 2026
5bdc101
chore(changesets): record builder volume interval rename
skanda-polymarket Sep 1, 2026
d64f383
feat(data): migrate market metrics to v2
skanda-polymarket Sep 1, 2026
d320dfa
feat(data): add user pnl and volume
skanda-polymarket Sep 1, 2026
8fd4b90
fix(data): normalize resolution response fields
skanda-polymarket Sep 2, 2026
b56a0a8
chore(data): add resolution normalization changeset
skanda-polymarket Sep 2, 2026
d27df24
Merge pull request #340 from Polymarket/fix/builder-volume-year-interval
skanda-polymarket Sep 2, 2026
0612a64
fix(data): align market metrics with sdk contracts
skanda-polymarket Sep 2, 2026
50bf476
fix(data): reuse condition id response schema
skanda-polymarket Sep 2, 2026
085ea41
fix(data): make portfolio condition filters plural
skanda-polymarket Sep 2, 2026
e3c3f7f
fix(data): expose traded market count semantically
skanda-polymarket Sep 2, 2026
0586ebd
fix(data): expose max as canonical pnl interval
skanda-polymarket Sep 2, 2026
615a8fa
fix(data): normalize absent resolution transaction metadata
skanda-polymarket Sep 2, 2026
556ca50
Merge pull request #339 from Polymarket/feat/data-api-v2-portfolio-su…
skanda-polymarket Sep 2, 2026
ecfc84a
Merge pull request #342 from Polymarket/feat/data-api-v2-market-metrics
skanda-polymarket Sep 2, 2026
f5ad37b
Merge pull request #343 from Polymarket/feat/data-api-v2-user-metrics
skanda-polymarket Sep 2, 2026
7992375
feat(data): migrate trader boards to v2
skanda-polymarket Sep 2, 2026
454c772
feat(data): migrate price history to v2
skanda-polymarket Sep 2, 2026
40ead18
refactor(data): simplify price history checks
skanda-polymarket Sep 2, 2026
12935c4
feat(data): migrate holders to v2
skanda-polymarket Sep 2, 2026
569c8ff
Merge pull request #345 from Polymarket/fix/data-resolution-normaliza…
ExoMonk Sep 3, 2026
e8a3a06
fix(client): default trader standing to account wallet
skanda-polymarket Sep 3, 2026
d65e0e2
refactor(client): reuse account wallet binding
skanda-polymarket Sep 3, 2026
1214772
docs(data): document holder balance threshold
skanda-polymarket Sep 3, 2026
87ec140
fix(data): use asset id for price history
skanda-polymarket Sep 3, 2026
5cf065d
Merge pull request #347 from Polymarket/feat/data-api-v2-trader-boards
ExoMonk Sep 3, 2026
79bb544
chore(data): merge price history stack
skanda-polymarket Sep 3, 2026
44219e5
docs(data): clarify holder balance units
skanda-polymarket Sep 3, 2026
c195137
fix(data): align price history with adaptive resolution
skanda-polymarket Sep 3, 2026
440544b
chore(data): sync data api v2 integration
skanda-polymarket Sep 3, 2026
0fe5ba4
chore(data): sync price history stack
skanda-polymarket Sep 3, 2026
2a3a632
test(data): use public v2 actions in integration tests
skanda-polymarket Sep 3, 2026
95b7096
Merge pull request #348 from Polymarket/feat/data-api-v2-price-history
ExoMonk Sep 3, 2026
5f13ab0
Merge pull request #349 from Polymarket/feat/data-api-v2-holders
ExoMonk Sep 3, 2026
fbbbb49
Merge branch 'main' into integration/data-api-v2
ExoMonk Sep 3, 2026
e7882e8
fix(data): normalize portfolio condition IDs and sync window docs
kartojal Sep 7, 2026
6e5c293
fix(data): preserve combo leg display metadata
kartojal Sep 7, 2026
6b16313
Merge branch 'main' into integration/data-api-v2
kartojal Sep 9, 2026
a641918
fix(bindings): tolerate unknown trade activity outcomes
kartojal Sep 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/builder-volume-year-interval.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': patch
'@polymarket/client': patch
---

Expose the yearly builder-volume bucket as `BuilderVolumeInterval.Year` while preserving the wire value `all`.
6 changes: 6 additions & 0 deletions .changeset/data-resolution-normalization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': patch
'@polymarket/client': patch
---

Normalize resolution timestamps, transaction metadata, and payout values into canonical SDK types.
6 changes: 6 additions & 0 deletions .changeset/data-v2-builder-analytics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

**Breaking**: migrate `listBuilderLeaderboard` and `fetchBuilderVolume` to their v2 contracts. Builder rankings now use server cursors and normalized `BuilderStanding` rows; builder volume returns complete date buckets as `BuilderVolumePoint` rows. Replace `timePeriod` with `window` or `interval`, and use `bucketLimit` to bound volume buckets.
6 changes: 6 additions & 0 deletions .changeset/data-v2-combo-display-metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@polymarket/bindings": patch
"@polymarket/client": patch
---

Expose question, groupItemTitle, sportsMarketType, line, and outcomes on combo leg markets returned by listComboPositions and listComboActivity.
6 changes: 6 additions & 0 deletions .changeset/data-v2-core-welcome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

Add the core pieces for the data `/v2` surface: `/v2` envelope schemas (paginated list with server-minted branded cursors, and single-object including null answers), a `withRateLimitRetry` pipeline helper that honors server-requested delays, and the `MIGRATION` activity type with its `MigrationActivity` variant. All additive — no existing API shape changes.
6 changes: 6 additions & 0 deletions .changeset/data-v2-feed-endpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

**Breaking**: the feed surfaces are fully replaced — same names, new contracts. `listActivity`, `listComboActivity`, `listPositions`, and `listComboPositions` now serve exact cursor pagination with automatic rate-limit retry and the `condition`-id vocabulary. `conditionId` filters validate the service's shared selector cap client-side: at most 20 distinct ids per request (case-insensitive dedupe first), so an oversized list fails typed instead of as a service 400. `listPositions` bundles the whole lifecycle behind `status` (`OPEN`/`REDEEMABLE`/`CLOSED`) with `redeemable`/`mergeable` flags and fee-exclusive entry economics on every row — `listClosedPositions` and `listMarketPositions` are removed (use `listPositions` with `status`/a `conditionId` anchor). Every windowed method takes one `window` option (`'full' | { start?, end? }`, epoch seconds or `Date`) replacing raw `start`/`end`. Money, size, price, and PnL fields normalize to `DecimalString` (the wire's JSON numbers are stringified without loss at their 6-decimal grain, matching the v1 SDK surface), `endDate` is a typed `IsoCalendarDateString`, and `ComboPositionStatus` gains `Redeemable` (sole-value filter, also tolerated on rows); the `Activity` union, `Position`, `ComboPosition`, and `ComboActivity` rows are strict and normalized (epoch ms, empty-string/999-sentinel absence as `undefined`, `assetId` canonical with deprecated `tokenId` alias). Combo activity rows carry `positionId` on every row while dropping `transactionAt`/`logIndex`/`moduleId`. Request vocabularies are exported enums: trade direction reuses `OrderSide` (the standalone `Side` type is removed), and `SortDirection`, `TradeFilterType`, `PositionFilterType`, `PositionSortBy`, `ComboPositionSortBy`, and `TipSide` join `PositionStatus`/`ComboPositionStatus`. On the secure client, `listPositions` always binds the authenticated wallet (the `user: null` opt-out is removed); list a market's holders through a public client instead.
6 changes: 6 additions & 0 deletions .changeset/data-v2-holders.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

**Breaking**: migrate `listMarketHolders` to its cursor-paginated `/v2` contract, using condition IDs, normalized holder fields, and optional position economics.
6 changes: 6 additions & 0 deletions .changeset/data-v2-market-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

**Breaking**: migrate open-interest and live-volume reads to their v2 contracts. Replace `listOpenInterest` with `fetchOpenInterest`, use condition and event identifiers, and expose cumulative taker volume explicitly.
6 changes: 6 additions & 0 deletions .changeset/data-v2-portfolio-condition-normalization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@polymarket/bindings": patch
"@polymarket/client": patch
---

Normalize protocol v2 market condition IDs for position and portfolio-value reads, share canonicalization in bindings, and clarify activity and trade history windows.
6 changes: 6 additions & 0 deletions .changeset/data-v2-portfolio-summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

**Breaking**: migrate `fetchPortfolioValue` to its `/v2` contract, returning one `PortfolioValue` with a decimal-string value and accepting `conditionIds` instead of the legacy `market` filter. Add `fetchUserStats` with decimal-string money, size, and PnL fields, and remove `fetchTradedMarketCount`; use `fetchUserStats().tradedMarketCount` for the exact distinct-market count. The accounting snapshot download remains available unchanged.
6 changes: 6 additions & 0 deletions .changeset/data-v2-price-history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

**Breaking**: replace `fetchPriceHistory` with cursor-paginated `listPriceHistory`, using token IDs, strict time selections, second-based bucket widths, and normalized price points.
6 changes: 6 additions & 0 deletions .changeset/data-v2-resolutions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

Add `fetchResolutions` for non-paginated resolution lifecycle lookups by question, condition, or event. Resolution rows normalize identity, lifecycle, oracle, payout, and finality fields, while unset wire sentinels become omitted SDK fields.
6 changes: 6 additions & 0 deletions .changeset/data-v2-trader-boards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

**Breaking**: migrate trader leaderboard reads to the cursor-paginated v2 contract, add a separate by-wallet standing method, and add biggest-winner pagination with explicit market and Combo variants.
6 changes: 6 additions & 0 deletions .changeset/data-v2-trades-pagination.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

**Breaking**: `listTrades` is fully replaced — same name, new contract. It now serves exact continuation signals (`hasMore`/server-minted `nextCursor` — no page-size probing), re-sends the original filters with every page, has no offset vocabulary (`pageSize` default 100, max 1000 rejected-not-clamped), retries transient rate limits after the server-requested delay, and accepts partial `filterType`/`filterAmount` (the service fills the other half in). The `Trade` row is strict and normalized (numbers for `size`/`price`, epoch milliseconds, empty-string and unknown-sentinel absence as `undefined`). Following the service's naming remap, the request filter is `conditionId` (the wire's `condition`/`condition_id` — the old `market` key no longer exists upstream) and the row field parsed is `condition_id`. Bindings gain the reusable data envelope parsers (`dataPageSchema`, `dataEnvelopeSchema`) that turn the service's paginated envelope straight into the SDK page shape.
6 changes: 6 additions & 0 deletions .changeset/data-v2-user-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@polymarket/bindings': minor
'@polymarket/client': minor
---

Add `fetchUserPnl` and `fetchUserVolume` with normalized decimal-string amounts, cumulative PnL metadata, shared time-window inputs, and authenticated-wallet defaults.
2 changes: 1 addition & 1 deletion docs/sdk-direction.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The SDK should hide internal service boundaries where possible while staying clo
- Prefer workflow-first APIs over service-shaped APIs.
- Keep public models pragmatic, typed, and consistent.
- Standardize SDK identifier naming on JS/TS-style `...Id` forms such as `orderId`, `tradeId`, `tokenId`, and `marketId`.
- Normalize the CTF position identifier to `tokenId` in the SDK public model, even when upstream services call the same value `assetId`.
- Use `assetId` for exchange assets in the SDK public model, whether they identify a CTF token or a Polymarket V2 position.
- Translate legacy `...ID` and wire-format variants at the service boundary.
- Add lower-level controls only when they support a concrete SDK workflow.

Expand Down
1 change: 1 addition & 0 deletions examples/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This private workspace package contains runnable TypeScript scripts that demonst
Run an example from the repository root:

```bash
pnpm --filter @polymarket/examples analytics:builders
pnpm --filter @polymarket/examples list:markets
pnpm --filter @polymarket/examples fetch:market
pnpm --filter @polymarket/examples pagination
Expand Down
1 change: 1 addition & 0 deletions examples/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"analytics:builders": "tsx src/builder-analytics.ts",
"fetch:market": "tsx src/fetch-market.ts",
"list:markets": "tsx src/list-markets.ts",
"market:prices": "tsx src/market-prices.ts",
Expand Down
44 changes: 44 additions & 0 deletions examples/scripts/src/builder-analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {
BuilderVolumeInterval,
createPublicClient,
LeaderboardWindow,
} from '@polymarket/client';

const client = createPublicClient();

const leaderboard = await client
.listBuilderLeaderboard({
window: LeaderboardWindow.Week,
pageSize: 10,
})
.firstPage();

console.log('Top builders this week');
console.table(
leaderboard.items.map((builder) => ({
rank: builder.rank,
name: builder.builderName,
code: builder.builderCode,
volumeShares: builder.volume,
activeUsers: builder.activeUsers,
})),
);

const volume = await client.fetchBuilderVolume({
interval: BuilderVolumeInterval.Day,
bucketLimit: 2,
});
const latestBucketDate = volume[0]?.bucketDate;
const latestBucket = volume.filter(
(point) => point.bucketDate === latestBucketDate,
);

console.log(`Builder volume for ${latestBucketDate ?? 'the latest bucket'}`);
console.table(
latestBucket.slice(0, 10).map((point) => ({
rank: point.rank,
name: point.builderName,
volumeShares: point.volume,
activeUsers: point.activeUsers,
})),
);
4 changes: 2 additions & 2 deletions examples/scripts/src/list-positions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ for await (const page of positions) {
...page.items.map((position) => ({
title: position.title ?? position.slug ?? position.conditionId,
outcome: position.outcome ?? '',
size: position.size ?? '0',
size: position.currentSize,
currentValue: position.currentValue ?? '0',
avgPrice: position.avgPrice ?? '',
curPrice: position.curPrice ?? '',
curPrice: position.currentPrice,
redeemable: position.redeemable ?? false,
mergeable: position.mergeable ?? false,
assetId: position.assetId ?? '',
Expand Down
22 changes: 0 additions & 22 deletions packages/bindings/src/clob/market-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ import {
type TokenId,
} from '../shared';

export enum PriceHistoryInterval {
MAX = 'max',
ONE_WEEK = '1w',
ONE_DAY = '1d',
SIX_HOURS = '6h',
ONE_HOUR = '1h',
}

export const PriceHistoryIntervalSchema = z.enum(PriceHistoryInterval);

export const MidpointSchema = z.object({
mid: DecimalStringSchema,
});
Expand Down Expand Up @@ -105,18 +95,6 @@ export const LastTradePricesSchema = z.array(
);
export type LastTradePrices = z.infer<typeof LastTradePricesSchema>;

const PriceHistoryPointSchema = z.object({
t: z.number().int(),
// CLOB price history is intentionally approximate and emitted as JSON numbers.
p: z.number(),
});
export type PriceHistoryPoint = z.infer<typeof PriceHistoryPointSchema>;

export const PriceHistorySchema = z.object({
history: z.array(PriceHistoryPointSchema),
});
export type PriceHistory = z.infer<typeof PriceHistorySchema>;

export const ConditionByTokenSchema = z
.object({
condition_id: ConditionIdSchema,
Expand Down
Loading