package polymarket

  1. Overview
  2. Docs
OCaml client library for the Polymarket prediction market API

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.2.0.tar.gz
md5=4eb4c5d2f63ff081c9713d90be5a51b2
sha512=0e3de0c9b40683e09ab8f9f966a44784ef1b9b482c3eefef84104a7e8042c92f1d79893ee9588b24fa3d0decaed7f365509f4d1c23c66ce8328efb64e721f276

doc/polymarket.clob/Polymarket_clob/Client/L1/index.html

Module Client.L1Source

L1-Authenticated Client

Provides L1 (wallet-based) authentication for creating and deriving API keys, plus all public endpoints. L1 authentication uses EIP-712 signatures from the wallet's private key.

Sourcetype t = l1

L1-authenticated client with private key for wallet operations.

Sourceval 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 -> unit -> t

Create a new L1-authenticated CLOB client.

  • parameter sw

    The Eio switch for resource management

  • parameter net

    The Eio network interface

  • parameter rate_limiter

    Shared rate limiter for enforcing API limits

  • parameter private_key

    The wallet's private key for signing

Sourceval address : t -> string

Get the Ethereum address derived from the private key.

L1 Authentication Endpoints

Sourceval create_api_key : t -> nonce:int -> (Auth.api_key_response, Polymarket_http.Client.error) result

Create a new API key using L1 wallet authentication. Returns the API key, secret, and passphrase.

Sourceval derive_api_key : t -> nonce:int -> (l2 * Auth.api_key_response, Polymarket_http.Client.error) result

Derive API key from wallet and automatically upgrade to L2 client. Returns both the L2 client and the raw response (for credential storage).

Order Book

Sourceval get_order_book : t -> token_id:string -> unit -> (Types.order_book_summary, Polymarket_http.Client.error) result
Sourceval get_order_books : t -> token_ids:string list -> unit -> (Types.order_book_summary list, Polymarket_http.Client.error) result

Pricing

Sourceval get_price : t -> token_id:string -> side:Polymarket_clob.Types.Side.t -> unit -> (Types.price_response, Polymarket_http.Client.error) result
Sourceval get_midpoint : t -> token_id:string -> unit -> (Types.midpoint_response, Polymarket_http.Client.error) result
Sourceval get_prices : t -> requests:(string * Polymarket_clob.Types.Side.t) list -> unit -> (Types.prices_response, Polymarket_http.Client.error) result
Sourceval get_spreads : t -> token_ids:string list -> unit -> (Types.spreads_response, Polymarket_http.Client.error) result

Timeseries

Sourceval 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