Polymarket¶
This page documents the Polymarket adapter module in nautilus_trader.adapters.polymarket.
- class PolymarketDataClientConfig¶
Bases:
objectConfiguration for the Polymarket data client.
filters and new_market_filter hold Arc<dyn InstrumentFilter> trait objects and are skipped during serialization; they default to empty/None and must be installed programmatically after deserialization.
- auto_load_debounce_ms¶
- auto_load_max_retries¶
- auto_load_missing_instruments¶
- auto_load_retry_delay_initial_secs¶
- auto_load_retry_delay_max_secs¶
- base_url_data_api¶
- base_url_gamma¶
- base_url_http¶
- base_url_rtds¶
- base_url_ws¶
- compute_effective_deltas¶
- drop_quotes_missing_side¶
- has_proxy_url¶
- http_timeout_secs¶
- instrument_config¶
- new_market_fetch_max_concurrency¶
- resolve_poll_enabled¶
- resolve_poll_grace_secs¶
- resolve_poll_interval_secs¶
- resolve_poll_max_wait_secs¶
- subscribe_new_markets¶
- transport_backend¶
- update_instruments_interval_mins¶
- ws_max_subscriptions¶
- ws_timeout_secs¶
- class PolymarketDataClientFactory¶
Bases:
objectFactory for creating Polymarket data clients.
- name()¶
- class PolymarketDataLoader¶
Bases:
object- condition_id¶
Returns the on-chain condition ID.
- static from_event_slug(slug, token_index=0, base_url_http=None, base_url_gamma=None, base_url_data_api=None, timeout_secs=10)¶
Creates one loader for every market in a Gamma event slug.
- static from_market_slug(slug, token_index=0, base_url_http=None, base_url_gamma=None, base_url_data_api=None, timeout_secs=10)¶
Creates one loader from a Gamma market slug.
- instrument¶
Returns the normalized binary option instrument.
- load_trades(start=None, end=None, limit=None)¶
Loads historical trades from the Rust Data API client.
- static query_event_by_slug(slug, base_url_gamma=None, timeout_secs=10)¶
Queries one Gamma event by slug.
- static query_events(filters=None, base_url_gamma=None, timeout_secs=10)¶
Lists Gamma events with validated filters and keyset pagination.
- static query_market_by_slug(slug, base_url_gamma=None, timeout_secs=10)¶
Queries one Gamma market by slug.
- static query_market_details(condition_id, base_url_http=None, timeout_secs=10)¶
Queries public CLOB market details by condition ID.
- static query_markets(filters=None, base_url_gamma=None, timeout_secs=10)¶
Lists Gamma markets with validated filters and keyset pagination.
- static query_search(query, events_status=None, events_tag=None, sort=None, ascending=None, limit_per_type=None, page=None, keep_closed_markets=None, base_url_gamma=None, timeout_secs=10)¶
Searches Gamma markets and events.
- static query_tags(base_url_gamma=None, timeout_secs=10)¶
Lists Gamma tags.
- resolution_metadata¶
Returns resolution-bearing metadata excluded from instrument.info.
- token_id¶
Returns the selected CLOB token ID.
- class PolymarketExecClientConfig¶
Bases:
objectConfiguration for the Polymarket execution client.
Debug is implemented manually to redact secrets, so it is not part of the derive list.
- account_id¶
- base_url_data_api¶
- base_url_http¶
- base_url_ws¶
- funder¶
- has_proxy_url¶
- heartbeat_enabled¶
- http_timeout_secs¶
- instrument_config¶
- max_retries¶
- retry_delay_initial_ms¶
- retry_delay_max_ms¶
- signature_type¶
- trader_id¶
- transport_backend¶
- class PolymarketExecutionClientFactory¶
Bases:
objectFactory for creating Polymarket execution clients.
- name()¶
- class PolymarketFeeModel¶
Bases:
FeeModelPolymarket fee model for binary-option backtests.
Taker fills pay the market’s fee-equivalent amount. Maker fills receive a per-fill approximation of the daily maker rebate by applying the market’s configured rebate rate to that fee-equivalent amount.
- get_commission(order, fill_quantity, fill_px, instrument)¶
- get_commission_with_context(order, fill_quantity, fill_px, instrument, _underlying_px=None)¶
- class PolymarketInstrumentProviderConfig¶
Bases:
objectConfiguration for the Polymarket instrument provider.
This mirrors the Python adapter’s instrument_config layering so scoped market bootstrap can migrate naturally to the Rust/pyO3 live path.
- event_slug_builder¶
- event_slugs¶
- filters¶
- load_all¶
- load_ids¶
- log_warnings¶
- market_slugs¶
- series_ids¶
- use_gamma_markets¶
- class PolymarketRtdsCryptoPrice¶
Bases:
objectPolymarket RTDS crypto price sample from the crypto_prices topic.
The adapter normalizes both live update frames and subscribe backfill snapshots into this per-tick custom data type.
- classmethod from_json(data)¶
Class method for JSON deserialization. Used by register_custom_data_class.
- message_timestamp_ms¶
- price_timestamp_ms¶
- symbol¶
- to_json()¶
Serializes to JSON string. Used by CustomData.to_json_bytes and PythonCustomDataWrapper.
- ts_event¶
- ts_init¶
- value¶
- class PolymarketRtdsEquityPrice¶
Bases:
objectPolymarket RTDS equity price sample from the equity_prices topic.
The adapter normalizes both live update frames and subscribe backfill snapshots into this per-tick custom data type.
- classmethod from_json(data)¶
Class method for JSON deserialization. Used by register_custom_data_class.
- full_accuracy_value¶
- is_carried_forward¶
- message_timestamp_ms¶
- price_timestamp_ms¶
- received_at_ms¶
- symbol¶
- to_json()¶
Serializes to JSON string. Used by CustomData.to_json_bytes and PythonCustomDataWrapper.
- ts_event¶
- ts_init¶
- value¶
- class PolymarketUpDownEventSlugConfig¶
Bases:
objectRust-backed event slug builder for Polymarket Up/Down markets.
Up/Down event slugs follow the pattern {asset}-updown-{interval_mins}m-{unix_timestamp}, where the timestamp is aligned to the start of the interval. The builder emits slugs for each configured asset and period.
- assets¶
- interval_mins¶
- periods¶
- start_offset_periods¶