Skip to content

gamma MarketsRequest: add native active filter support #267

@morluto

Description

@morluto

Summary

gamma::types::request::MarketsRequest currently has no active field/builder method (at least in polymarket-client-sdk 0.4.2).

Because of this, consumers that expose an --active filter (like polymarket-cli) must fetch pages and apply active filtering client-side.

Why this matters

Without native active filtering in the request object:

  • API calls cannot express the full query intent (active + other filters) server-side.
  • Clients may return undersized results for page-limited requests unless they implement backfill/pagination loops.
  • Clients perform extra requests/work that should be avoidable if the backend supports active for markets.

In polymarket-cli, this required additional logic to backfill when --active is set so --limit semantics are preserved.

Current state (SDK)

MarketsRequest includes closed but not active:

  • polymarket-client-sdk/src/gamma/types/request.rs

Proposal

If the Gamma markets endpoint supports it, add native active support to MarketsRequest:

  • add pub active: Option<bool> to the request type
  • expose builder methods (.active(...) / .maybe_active(...))
  • ensure serialization/query mapping aligns with the API parameter name
  • document in README/examples for Gamma markets filtering

Consumer impact

This would let downstream clients issue precise server-side queries and avoid client-side backfill loops for active filtering.

Context

Opened from follow-up work in polymarket-cli PR:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions