Skip to content

feat(data): add typed Data API client - #39

Merged
SebastianBoehler merged 6 commits into
SebastianBoehler:mainfrom
yluoc:fuller-data-API
Oct 18, 2026
Merged

SebastianBoehler merged 6 commits into
SebastianBoehler:mainfrom
yluoc:fuller-data-API

Conversation

@yluoc

@yluoc yluoc commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds DataClient, a typed client for the Data API v2 (#8). It covers:

  • trades and wallet activity
  • positions, portfolio value, user stats, PnL series, user volume, and accounting snapshot download
  • market holders, open interest, live event volume, price history, and resolutions
  • trader leaderboard, trader standings, and biggest winners (combo entries kept with kind == "combo")

Lists page by server cursor through Paginator<T>. Amounts are double, and every row keeps its raw JSON. Argument checks follow py-sdk, and invalid input fails with InvalidArgument before any request is sent. The JSON field readers, query builder, and paging helpers moved out of the Gamma client so both clients share them. Gamma behavior is unchanged.

Verification

Commands run and their actual results:

  • scripts/ci_local.sh --title "feat(data): add typed Data API client": title, release, debug, sanitizers, fuzz, and clang passed. Quality failed on formatting in five portfolio files. After style(data): format portfolio sources with clang-format 21, --jobs quality passed.
  • The eight new Data test executables pass in the release, debug, sanitizer, and Clang builds.

Checks not run and the reason (or none):

  • Linux jobs ran with GCC 12, because GCC 11 is not installed locally.
  • macOS jobs cannot run locally.

Compatibility and evidence

Public API, binary compatibility, or release implications (or none):

Additive only. New headers are data_client.hpp, data_types.hpp, data_portfolio_types.hpp, data_analytics_types.hpp, data_leaderboard_types.hpp, and data_requests.hpp. Existing public headers are unchanged, and the shared helpers are internal.

For protocol changes: official docs links and the Python SDK commit or fixture source.

Endpoints, parameters, validation rules, and models follow py-sdk commit 72297f05d6d8. Fixtures are recorded data-api.polymarket.com responses from 2026-10-17. Wallets, names, pseudonyms, avatars, handles, and transaction hashes are replaced with synthetic values, including the wallet embedded in the positions cursor.

For live checks: distinguish observed outcomes from local fixture coverage.

Observed live with read-only GETs:

  • the {data, pagination} envelope
  • the limit > 1000 rejection
  • the activity kinds
  • data: null for unknown standings
  • the GLOBAL open interest row
  • ISO and epoch resolution times
  • the oracle's 69 "no price" value
  • zip snapshot bytes

Biggest winners returned no combo rows, so combo handling is covered only by synthetic rows built from the py-sdk model.

@SebastianBoehler

Copy link
Copy Markdown
Owner

LGTM, thanks!

@SebastianBoehler
SebastianBoehler merged commit a626d53 into SebastianBoehler:main Oct 18, 2026
8 checks passed
@yluoc
yluoc deleted the fuller-data-API branch October 18, 2026 00:41
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.

2 participants