Skip to content

Markets, Events & Tokens

Polymarket’s data model has four core entities that polygolem surfaces across the Gamma and CLOB clients. Understanding the shape — and the relationship between Gamma’s view and CLOB’s view of the same market — is the single most important thing for anyone using this SDK.

The four entities

EntityLives inWhat it represents
EventGammaA theme or topic. Groups one or more related markets.
MarketGamma + CLOBA single tradable proposition, with one or more outcomes.
ConditionConditional Tokens Framework (CTF) on-chainThe settlement primitive. Identified by a conditionID.
Outcome / TokenCTF on-chainEach possible result is a separate ERC-1155 token under the condition.

A concrete example

Take the market “Will Bitcoin be above $70,000 at 5 PM UTC?”.

  • Event (Gamma): "Bitcoin price intraday" — groups multiple BTC markets across different strikes and times.
  • Market (Gamma): "Will Bitcoin be above $70,000 at 5 PM UTC?" — a single Yes/No proposition.
  • Condition (CTF): one conditionID, e.g. 0xbd31dc8a.... This is the on-chain settlement key.
  • Outcomes / Tokens: two ERC-1155 token IDs under the condition:
    • tokenID_yes — pays $1 if BTC ≥ $70k at settlement, else $0
    • tokenID_no — pays $1 if BTC < $70k at settlement, else $0

The two outcome tokens are complementary: their prices on a working market sum to ~$1 minus the bid-ask spread. Buying one Yes token and one No token at issuance equals buying $1 of redemption certainty, which is exactly how new shares are minted via the CTF.

Yes/No vs multi-outcome

Most Polymarket markets are binary (Yes/No, two tokens). Some — like a presidential primary — are multi-outcome:

  • Outcomes: ["Trump", "Biden", "Other"]
  • Tokens: three ERC-1155 token IDs, one per outcome
  • Sum constraint: prices still sum to ~$1, but split across three lines

For multi-outcome neg-risk markets, the constraint is enforced by the neg-risk adapter contract rather than the bare CTF.

Gamma view vs CLOB view

The same market shows up in two places, with different fields:

AspectGammaCLOB
IdentifiermarketID (Gamma row PK), slugconditionID, tokenID
Best forDiscovery, search, metadataOrder book, fees, tick size, trades
ContainsQuestion, description, outcomes, end date, imageBid/ask depth, last trade, fee rate
AuthNone (read-only)None for L0; key+wallet for L1/L2

polygolem discover enrich --id <conditionID> joins both views into a single JSON document — see Market Discovery.

Token IDs are the trading primitive

Every CLOB endpoint that touches market data takes a token ID (ERC-1155 asset ID), not a condition ID:

Terminal window
polygolem orderbook get --token-id 71321045679...
polygolem orderbook tick-size --token-id 71321045679...
polygolem clob create-order --token-id 71321045679... --side BUY ...

The token ID is the integer encoding of the position in the CTF.

How polygolem maps it

polygolem command / packageOperates onNotes
discover search / discover marketGamma — markets, eventsReturns Gamma fields.
discover enrichGamma + CLOBJoins by conditionID.
orderbook * / pkg/orderbook / pkg/clobCLOB — by tokenID or conditionIDRead-only L0.
clob create-orderCLOB — by tokenIDAuthenticated L2.
pkg/marketresolver.ResolveTokenIDsGamma → both tokenIDsHigh-level resolver.

Reference