PolymarketClob.API.Orders (PolymarketClob v0.2.0)

Copy Markdown View Source

Private CLOB order management endpoint wrappers.

These functions post already-built signed order maps. They do not build orders, fetch market metadata, calculate tick sizes, or perform allowance writes.

Summary

Functions

Cancels all open orders via DELETE /cancel-all.

Cancels open orders for a market and/or asset via DELETE /cancel-market-orders.

Cancels one order by order ID via DELETE /order.

Cancels multiple orders by order ID via DELETE /orders.

Posts one already-built signed order to POST /order.

Posts already-built signed orders to POST /orders.

Types

result()

@type result() :: {:ok, term()} | {:error, PolymarketClob.Error.t()}

signed_order()

@type signed_order() :: map()

Functions

cancel_all(client, opts \\ [])

@spec cancel_all(
  PolymarketClob.Client.t(),
  keyword()
) :: result()

Cancels all open orders via DELETE /cancel-all.

cancel_market_orders(client, params, opts \\ [])

@spec cancel_market_orders(PolymarketClob.Client.t(), keyword() | map(), keyword()) ::
  result()

Cancels open orders for a market and/or asset via DELETE /cancel-market-orders.

Accepted params mirror the Python client: :market and :asset_id.

cancel_order(client, order_id, opts \\ [])

@spec cancel_order(PolymarketClob.Client.t(), String.t(), keyword()) :: result()

Cancels one order by order ID via DELETE /order.

cancel_orders(client, order_ids, opts \\ [])

@spec cancel_orders(PolymarketClob.Client.t(), [String.t()], keyword()) :: result()

Cancels multiple orders by order ID via DELETE /orders.

post_order(client, signed_order, opts \\ [])

@spec post_order(PolymarketClob.Client.t(), signed_order(), keyword()) :: result()

Posts one already-built signed order to POST /order.

post_orders(client, signed_orders, opts \\ [])

@spec post_orders(PolymarketClob.Client.t(), [signed_order()], keyword()) :: result()

Posts already-built signed orders to POST /orders.