Skip to content

fix: restore account trades legacy timestamp parsing#91

Merged
cesarenaldi merged 2 commits into
mainfrom
fix/account-trades-legacy-timestamps
Jun 5, 2026
Merged

fix: restore account trades legacy timestamp parsing#91
cesarenaldi merged 2 commits into
mainfrom
fix/account-trades-legacy-timestamps

Conversation

@cesarenaldi
Copy link
Copy Markdown
Collaborator

@cesarenaldi cesarenaldi commented Jun 4, 2026

Summary

  • move listAccountTrades() back to legacy /data/trades
  • restore legacy account-trade response bindings for asset_id, market, nested maker-order asset_id, and cursor pagination
  • parse legacy match_time and last_update epoch-seconds values correctly
  • add shared EpochLikeToIsoDateTimeStringSchema and reuse it for account trades and builder trades
  • update the existing changeset to describe the legacy endpoint timestamp fix

Fixes #76

Verification

  • pnpm test:bindings
  • pnpm test:client
  • pnpm lint
  • pnpm typecheck
  • pnpm --filter @polymarket/types build && pnpm --filter @polymarket/bindings build

Note

Medium Risk
Changes the live CLOB route and response parsing for account trades; wrong assumptions would break listing or mis-parse trade times, but scope is limited to that API surface.

Overview
listAccountTrades() again calls the legacy GET /data/trades API with next_cursor pagination (aligned with open orders), replacing the unified /v1/account/trades offset-based flow.

Bindings now expect the legacy trade payload: asset_id / market, nested maker orders on asset_id, and cursor pages via createCursorPageSchema. match_time and last_update use a new EpochLikeToIsoDateTimeStringSchema so epoch-seconds strings (and millisecond values) normalize to ISO datetimes; builder matchTime shares that schema. Tests cover second-granularity timestamp strings.

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

@cesarenaldi cesarenaldi merged commit 86301fd into main Jun 5, 2026
8 checks passed
@cesarenaldi cesarenaldi deleted the fix/account-trades-legacy-timestamps branch June 5, 2026 08:29
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.

bindings: ClobTradeSchema match_time and last_update use EpochMilliseconds but /data/trades REST API sends epoch-seconds strings

1 participant