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.rate_limiter/Polymarket_rate_limiter/State/index.html

Module Polymarket_rate_limiter.StateSource

State management for rate limiting.

This module manages GCRA states for all routes, providing thread-safe access. Call cleanup explicitly to remove stale entries.

Sourcetype t

State manager for all route limits

Sourcetype route_key = string

Unique key identifying a route (e.g., "api.example.com:GET:/orders")

Sourceval create : clock:_ Eio.Time.clock -> ?max_idle_time:float -> unit -> t

Create a state manager.

  • parameter clock

    Eio clock for timing

  • parameter max_idle_time

    Remove states unused for this long in seconds (default: 300.0)

Sourceval check_limits : t -> route_key:route_key -> limits:Types.limit_config list -> (unit, float) result

Check all limits for a route.

  • returns

    Ok () if all limits pass, Error max_retry_after if any limit is exceeded

Sourceval cleanup : t -> unit

Remove stale state entries (unused longer than max_idle_time)

Sourceval state_count : t -> int

Get the number of active state entries (for monitoring)

Sourceval reset : t -> unit

Clear all state (for testing)