pmxt icon indicating copy to clipboard operation
pmxt copied to clipboard

Polymarket CLOB `cancelAllOrders` and `cancelMarketOrders` spec endpoints not implemented in `PolymarketExchange` or either SDK

Open realfishsam opened this issue 5 months ago • 0 comments

Gap

The Polymarket CLOB API spec defines two bulk order-cancellation endpoints that are not implemented in PolymarketExchange (core) and have no wrapper in either SDK:

  • DELETE /cancel-all — cancels all open orders for the authenticated user across all markets
  • DELETE /cancel-market-orders — cancels all open orders for the authenticated user in a specific market (passed via request body)

The only path to these endpoints is callApi("CancelAllOrders") / callApi("CancelMarketOrders"), which requires callers to pass raw Polymarket auth headers manually and provides no type safety.

Core

Spec: core/specs/polymarket/PolymarketClobAPI.yaml

  • Line 807: DELETE /cancel-all (operationId CancelAllOrders)
  • Line 824: DELETE /cancel-market-orders (operationId CancelMarketOrders)

core/src/exchanges/polymarket/index.ts — PolymarketExchange has cancelOrder(orderId) at line 326 but no cancelAllOrders() or cancelMarketOrders() method. No related method exists anywhere in the polymarket exchange directory.

TypeScript SDK

Missing — no cancelAllOrders or cancelMarketOrders in sdks/typescript/pmxt/client.ts. The Polymarket SDK class exposes only cancelOrder(orderId) (inherited from Exchange).

Python SDK

Missing — no cancel_all_orders or cancel_market_orders in sdks/python/pmxt/client.py or sdks/python/pmxt/_exchanges.py.

Evidence

# Spec defines both endpoints
grep -n "cancel-all\|cancel-market" core/specs/polymarket/PolymarketClobAPI.yaml
# line 807: /cancel-all
# line 824: /cancel-market-orders

# Core exchange — no implementation
grep -rn "cancelAll\|cancelMarket" core/src/exchanges/polymarket/
# (no matches)

# Both SDKs — no wrapper
grep -rn "cancelAllOrders\|cancelMarketOrders\|cancel_all_orders\|cancel_market_orders" sdks/
# (no matches, excluding API_REFERENCE docs)

Impact

Polymarket users managing portfolios with many open orders (e.g., market makers, arbitrageurs, automated bots) must cancel each order individually via cancelOrder(orderId), requiring O(n) round-trips. This is slow, expensive in gas/fees, and failure-prone — if any cancellation fails mid-loop, the portfolio is left in a partially-cancelled state. cancel-all is specifically designed for fast emergency exits. Its absence is a meaningful operational safety gap for any Polymarket trading workflow.


Found by automated Core-to-SDK surface coverage audit

realfishsam avatar Jun 16 '26 16:06 realfishsam