Skip to content

Polymarket

Polymarket is a prediction market platform. Bruin supports Polymarket as a public read-only source for Ingestr assets, including markets, events, prices, order books, trades, and public wallet activity.

No API key is required for the supported Polymarket tables.

Configuration

Step 1: Add a connection to the .bruin.yml file

For unfiltered tables, add a lowercase polymarket connection:

yaml
connections:
  polymarket:
    - name: polymarket

Polymarket filters are URI parameters in ingestr. Add the relevant fields to a connection when a source table requires filters or identifiers:

yaml
connections:
  polymarket:
    - name: polymarket_open_markets
      closed: "false"

    - name: polymarket_orderbook
      token_id: "<clob-token-id>"

    - name: polymarket_event_comments
      parent_entity_id: "<event-id>"
      parent_entity_type: "Event"

Use separate Polymarket connections for assets that need different table-specific URI parameters. Quote values such as booleans and numeric IDs to pass them to ingestr exactly as URI query values.

Bruin connection fields use snake_case. They are mapped to the URI parameters expected by ingestr, including taker_only to takerOnly, filter_type to filterType, filter_amount to filterAmount, and event_id to eventId.

Step 2: Create an asset file for data ingestion

Create an asset configuration file such as assets/polymarket_markets.yml:

yaml
name: public.polymarket_markets
type: ingestr

parameters:
  source_connection: polymarket_open_markets
  source_table: 'markets'

  destination: duckdb
  schema_naming: direct
  • name: The name of the asset.
  • type: Always ingestr for Polymarket.
  • source_connection: The Polymarket connection name defined in .bruin.yml.
  • source_table: The Polymarket table to ingest.
  • destination: The destination connection name.
  • schema_naming: direct is recommended for Polymarket tables because provider columns and keys can use camelCase.

Step 3: Run the asset

bash
bruin run assets/polymarket_markets.yml

Supported Connection Fields

The Polymarket connection can include these optional URI fields. Some source tables require one or more of them, as shown in the source table list.

Bruin fieldIngestr URI parameter
orderorder
ascendingascending
slugslug
closedclosed
livelive
activeactive
archivedarchived
featuredfeatured
tag_idtag_id
tag_slugtag_slug
series_idseries_id
include_chatinclude_chat
include_templateinclude_template
include_marketsinclude_markets
clob_token_idsclob_token_ids
condition_idscondition_ids
question_idsquestion_ids
related_tagsrelated_tags
include_taginclude_tag
rfq_enabledrfq_enabled
limitlimit
offsetoffset
parent_entity_idparent_entity_id
parent_entity_typeparent_entity_type
marketmarket
useruser
qq
events_statusevents_status
markets_statusmarkets_status
token_idtoken_id
sideside
intervalinterval
fidelityfidelity
taker_onlytakerOnly
filter_typefilterType
filter_amountfilterAmount
event_ideventId
typetype

Available Source Tables

TableRequired connection fieldsOptional connection fieldsPKInc KeyInc StrategyDetails
events-order, ascending, slug, closed, live, active, archived, featured, tag_id, tag_slug, series_id, include_chat, include_template, include_marketsidupdatedAtmergePolymarket events from Gamma keyset pagination.
markets-order, ascending, slug, closed, active, archived, clob_token_ids, condition_ids, question_ids, tag_id, related_tags, include_tag, rfq_enabledidupdatedAtmergePolymarket markets from Gamma keyset pagination.
tags-limit, offset, order, ascending, include_templateidupdatedAtmergeTags and categories.
series-limit, offset, order, ascending, closed, active, archivedidupdatedAtmergeEvent series metadata.
commentsparent_entity_id, parent_entity_typemarket, useridcreatedAtmergePublic comments. Event comments use parent_entity_type: "Event".
search-q, events_status, markets_status--replacePublic search results.
orderbooktoken_id-asset_id-mergeCLOB order book for one token.
pricetoken_id, side---replaceBest price for one token side, BUY or SELL.
midpointtoken_id---replaceCurrent midpoint price.
spreadtoken_id---replaceCurrent bid/ask spread.
last_trade_pricetoken_id---replaceLast trade price and side.
price_historymarketinterval, fidelityttmergeHistorical price points for a CLOB asset id.
trades-taker_only, filter_type, filter_amount, market, event_id, user, sidetransactionHashtimestampmergePublic trade history from the Data API.
positionsusermarket--replaceCurrent positions for a public wallet.
closed_positionsusermarket--replaceClosed positions for a public wallet.
activityusertypetransactionHashtimestampmergePublic wallet activity.

Notes

  • Polymarket has separate public Gamma, CLOB, and Data APIs. The ingestr connector maps each source_table to one read-only endpoint.
  • CLOB pricing and order book tables use CLOB token IDs, not Gamma market IDs. Ingest markets first and read token IDs from the market payload.
  • When using interval modifiers, only events, markets, and price_history push interval filters to the Polymarket API. For events and markets, intervals filter scheduled date ranges, not update times.
  • The official ingestr source returns selected stable columns plus a raw JSON column containing the full source payload.