Skip to content

docs: clarify what customFeatureEnabled gates on MarketSubscription #65

@Nexory

Description

@Nexory

MarketSubscription in packages/client/src/actions/subscriptions.ts:47-51 exposes customFeatureEnabled?: boolean; without documenting what events the flag enables.

export type MarketSubscription = {
  topic: 'market';
  tokenIds: readonly string[];
  customFeatureEnabled?: boolean;
};

Reading the bindings reveals the answer in packages/bindings/src/subscriptions/clob.ts:537-543 — the events split into:

  • StandardMarketEventSchema: MarketBookEvent, MarketPriceChangeEvent, MarketLastTradePriceEvent, MarketTickSizeChangeEvent (delivered regardless of the flag)
  • CustomMarketEventSchema: MarketBestBidAskEvent, NewMarketEvent, MarketResolvedEvent (only delivered when customFeatureEnabled=true)

The naming Standard* vs Custom* already hints at the split, but a user reading MarketSubscription doesn't immediately know that setting the flag is required to receive top-of-book or market lifecycle events.

Suggested fix

Mirror the py-sdk fix from #43 (resolved by Polymarket/py-sdk#45). A short JSDoc on the field is enough:

export type MarketSubscription = {
  topic: 'market';
  /** Token ids whose market events should be delivered. */
  tokenIds: readonly string[];
  /**
   * When `true`, the server additionally emits `MarketBestBidAskEvent`,
   * `NewMarketEvent`, and `MarketResolvedEvent` (the `CustomMarketEvent` set).
   */
  customFeatureEnabled?: boolean;
};

Happy to send a small PR once external PRs are accepted.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions