Skip to main content
Version: latest

Polymarket

Config

class PolymarketDataClientConfig

Bases: LiveDataClientConfig

Configuration for PolymarketDataClient instances.

  • Parameters:
    • venue (Venue , default POLYMARKET_VENUE) – The venue for the client.
    • private_key (str , optional) – The Polymarket private key. If None then will source the POLYMARKET_PK environment variable.
    • signature_type (int , default 0 *(*EOA )) – The Polymarket signature type.
    • funder (str , optional) – The Polymarket USDC wallet address. If None then will source the POLYMARKET_FUNDER environment variable.
    • api_key (str , optional) – The Polymarket API public key. If None then will source the POLYMARKET_API_KEY environment variable.
    • api_secret (str , optional) – The Polymarket API public key. If None then will source the POLYMARKET_API_SECRET environment variable.
    • passphrase (str , optional) – The Polymarket API passphrase. If None then will source the POLYMARKET_PASSPHRASE environment variable.
    • base_url_http (str , optional) – The HTTP client custom endpoint override.
    • base_url_ws (str , optional) – The WebSocket client custom endpoint override.
    • ws_connection_delay_secs (PositiveInt , default 5) – The delay (seconds) prior to main websocket connection to allow initial subscriptions to arrive.
    • update_instruments_interval_mins (PositiveInt , default 60) – The interval (minutes) between updating Polymarket instruments.

venue : Venue

private_key : str | None

signature_type : int

funder : str | None

api_key : str | None

api_secret : str | None

passphrase : str | None

base_url_http : str | None

base_url_ws : str | None

ws_connection_delay_secs : Annotated[int, msgspec.Meta(gt=0)]

update_instrument_interval_mins : Annotated[int, msgspec.Meta(gt=0)]

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

handle_revised_bars : bool

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

instrument_provider : InstrumentProviderConfig

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

routing : RoutingConfig

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class PolymarketExecClientConfig

Bases: LiveExecClientConfig

Configuration for PolymarketExecutionClient instances.

  • Parameters:
    • venue (Venue , default POLYMARKET_VENUE) – The venue for the client.
    • private_key (str , optional) – The Polymarket private key. If None then will source the POLYMARKET_PK environment variable.
    • signature_type (int , default 0 *(*EOA )) – The Polymarket signature type.
    • funder (str , optional) – The Polymarket USDC wallet address. If None then will source the POLYMARKET_FUNDER environment variable.
    • api_key (str , optional) – The Polymarket API public key. If None then will source the POLYMARKET_API_KEY environment variable.
    • api_secret (str , optional) – The Polymarket API public key. If None then will source the POLYMARKET_API_SECRET environment variables.
    • passphrase (str , optional) – The Polymarket API passphrase. If None then will source the POLYMARKET_PASSPHRASE environment variable.
    • base_url_http (str , optional) – The HTTP client custom endpoint override.
    • base_url_ws (str , optional) – The WebSocket client custom endpoint override.
    • max_retries (PositiveInt , optional) – The maximum number of times a submit or cancel order request will be retried.
    • retry_delay (PositiveFloat , optional) – The delay (seconds) between retries.

venue : Venue

private_key : str | None

signature_type : int

funder : str | None

api_key : str | None

api_secret : str | None

passphrase : str | None

base_url_http : str | None

base_url_ws : str | None

max_retries : Annotated[int, msgspec.Meta(gt=0)] | None

retry_delay : Annotated[float, msgspec.Meta(gt=0.0)] | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

instrument_provider : InstrumentProviderConfig

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

routing : RoutingConfig

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Factories

Enums

class PolymarketSignatureType

Bases: Enum

EOA = 0

POLY_PROXY = 1

POLY_GNOSIS_SAFE = 2

class PolymarketOrderSide

Bases: Enum

BUY = 'BUY'

SELL = 'SELL'

class PolymarketLiquiditySide

Bases: Enum

MAKER = 'MAKER'

TAKER = 'TAKER'

class PolymarketOrderType

Bases: Enum

FOK = 'FOK'

GTC = 'GTC'

GTD = 'GTD'

class PolymarketEventType

Bases: Enum

PLACEMENT = 'PLACEMENT'

UPDATE = 'UPDATE'

CANCELLATION = 'CANCELLATION'

TRADE = 'TRADE'

class PolymarketOrderStatus

Bases: Enum

INVALID = 'INVALID'

LIVE = 'LIVE'

DELAYED = 'DELAYED'

MATCHED = 'MATCHED'

UNMATCHED = 'UNMATCHED'

CANCELED = 'CANCELED'

class PolymarketTradeStatus

Bases: Enum

MATCHED = 'MATCHED'

MINED = 'MINED'

CONFIRMED = 'CONFIRMED'

RETRYING = 'RETRYING'

FAILED = 'FAILED'

Providers

Data

Execution