Client.L2SourceProvides L2 (API key-based) authentication for order management, trades, and all other authenticated endpoints, plus L1 and public endpoints. L2 authentication uses HMAC-SHA256 signatures with the API credentials.
val create :
?base_url:string ->
sw:Eio.Switch.t ->
net:_ Eio.Net.t ->
rate_limiter:Polymarket_rate_limiter.Rate_limiter.t ->
private_key:Crypto.private_key ->
credentials:Auth.credentials ->
unit ->
tCreate a new L2-authenticated CLOB client.
Get the API credentials.
val create_api_key :
t ->
nonce:int ->
(Auth.api_key_response, Polymarket_http.Client.error) resultCreate a new API key using L1 wallet authentication.
Delete the current API key.
Get all API keys for this address.
val create_order :
t ->
order:Types.signed_order ->
owner:string ->
order_type:Types.Order_type.t ->
unit ->
(Types.create_order_response, Polymarket_http.Client.error) resultCreate a new order on the CLOB.
val create_orders :
t ->
orders:(Types.signed_order * string * Types.Order_type.t) list ->
unit ->
(Types.create_order_response list, Polymarket_http.Client.error) resultCreate multiple orders on the CLOB.
val get_order :
t ->
order_id:string ->
unit ->
(Types.open_order, Polymarket_http.Client.error) resultGet details of a specific order.
val get_orders :
t ->
?market:string ->
?asset_id:string ->
unit ->
(Types.open_order list, Polymarket_http.Client.error) resultGet all open orders, optionally filtered by market or asset.
val cancel_order :
t ->
order_id:string ->
unit ->
(Types.cancel_response, Polymarket_http.Client.error) resultCancel a specific order.
val cancel_orders :
t ->
order_ids:string list ->
unit ->
(Types.cancel_response, Polymarket_http.Client.error) resultCancel multiple orders.
Cancel all open orders.
val cancel_market_orders :
t ->
?market:string ->
?asset_id:string ->
unit ->
(Types.cancel_response, Polymarket_http.Client.error) resultCancel all orders for a market or asset.
val get_trades :
t ->
?id:string ->
?taker:string ->
?maker:string ->
?market:string ->
?before:string ->
?after:string ->
unit ->
(Types.clob_trade list, Polymarket_http.Client.error) resultGet trade history.
val get_order_book :
t ->
token_id:string ->
unit ->
(Types.order_book_summary, Polymarket_http.Client.error) resultval get_order_books :
t ->
token_ids:string list ->
unit ->
(Types.order_book_summary list, Polymarket_http.Client.error) resultval get_price :
t ->
token_id:string ->
side:Polymarket_clob.Types.Side.t ->
unit ->
(Types.price_response, Polymarket_http.Client.error) resultval get_midpoint :
t ->
token_id:string ->
unit ->
(Types.midpoint_response, Polymarket_http.Client.error) resultval get_prices :
t ->
requests:(string * Polymarket_clob.Types.Side.t) list ->
unit ->
(Types.prices_response, Polymarket_http.Client.error) resultval get_spreads :
t ->
token_ids:string list ->
unit ->
(Types.spreads_response, Polymarket_http.Client.error) resultval get_price_history :
t ->
market:string ->
?start_ts:int ->
?end_ts:int ->
?interval:Types.Interval.t ->
?fidelity:int ->
unit ->
(Types.price_history, Polymarket_http.Client.error) result