Polymarket_data.ClientSourceData API client for positions, trades, activity, and leaderboards.
include module type of TypesHealth check response
val pp_health_response :
Ppx_deriving_runtime.Format.formatter ->
health_response ->
Ppx_deriving_runtime.unitStructured error type for all API errors (alias to Polymarket_http.Client.error)
Pretty printer for errors
type position = {proxy_wallet : Polymarket_common.Primitives.Address.t;asset : string;condition_id : Polymarket_common.Primitives.Hash64.t;size : float;avg_price : float;initial_value : float;current_value : float;cash_pnl : float;percent_pnl : float;total_bought : float;realized_pnl : float;percent_realized_pnl : float;cur_price : float;redeemable : bool;mergeable : bool;title : string;slug : string;icon : string;event_slug : string;outcome : string;outcome_index : int;opposite_outcome : string;opposite_asset : string;end_date : string;negative_risk : bool;event_id : string;}Position in a market
val pp_position :
Ppx_deriving_runtime.Format.formatter ->
position ->
Ppx_deriving_runtime.unittype closed_position = {proxy_wallet : Polymarket_common.Primitives.Address.t;asset : string;condition_id : Polymarket_common.Primitives.Hash64.t;avg_price : float;total_bought : float;realized_pnl : float;cur_price : float;timestamp : int64;title : string;slug : string;icon : string;event_slug : string;outcome : string;outcome_index : int;opposite_outcome : string;opposite_asset : string;end_date : string;}Closed position in a market
val pp_closed_position :
Ppx_deriving_runtime.Format.formatter ->
closed_position ->
Ppx_deriving_runtime.unittype trade = {proxy_wallet : Polymarket_common.Primitives.Address.t;side : Side.t;asset : string;condition_id : Polymarket_common.Primitives.Hash64.t;size : float;price : float;timestamp : int64;title : string;slug : string;icon : string;event_slug : string;outcome : string;outcome_index : int;name : string;pseudonym : string;bio : string;profile_image : string;profile_image_optimized : string;transaction_hash : string;}Trade record
type activity = {proxy_wallet : Polymarket_common.Primitives.Address.t;timestamp : int64;condition_id : Polymarket_common.Primitives.Hash64.t;activity_type : Activity_type.t;size : float;usdc_size : float;transaction_hash : string;price : float;asset : string;side : Side.t;outcome_index : int;title : string;slug : string;icon : string;event_slug : string;outcome : string;name : string;pseudonym : string;bio : string;profile_image : string;profile_image_optimized : string;}Activity record
val pp_activity :
Ppx_deriving_runtime.Format.formatter ->
activity ->
Ppx_deriving_runtime.unittype holder = {proxy_wallet : Polymarket_common.Primitives.Address.t;bio : string;asset : string;pseudonym : string;amount : float;display_username_public : bool;outcome_index : int;name : string;profile_image : string;profile_image_optimized : string;}Holder of a position
Meta holder with token and list of holders
val pp_meta_holder :
Ppx_deriving_runtime.Format.formatter ->
meta_holder ->
Ppx_deriving_runtime.unitTraded record
Revision entry
val pp_revision_entry :
Ppx_deriving_runtime.Format.formatter ->
revision_entry ->
Ppx_deriving_runtime.unittype revision_payload = {question_id : Polymarket_common.Primitives.Hash64.t;revisions : revision_entry list;}Revision payload
val pp_revision_payload :
Ppx_deriving_runtime.Format.formatter ->
revision_payload ->
Ppx_deriving_runtime.unitval equal_revision_payload :
revision_payload ->
revision_payload ->
Ppx_deriving_runtime.boolValue record
Open interest for a market
val pp_open_interest :
Ppx_deriving_runtime.Format.formatter ->
open_interest ->
Ppx_deriving_runtime.unittype market_volume = {market : Polymarket_common.Primitives.Hash64.t option;value : float option;}Market volume
val pp_market_volume :
Ppx_deriving_runtime.Format.formatter ->
market_volume ->
Ppx_deriving_runtime.unitLive volume
val pp_live_volume :
Ppx_deriving_runtime.Format.formatter ->
live_volume ->
Ppx_deriving_runtime.unittype leaderboard_entry = {rank : string;builder : string;volume : float;active_users : int;verified : bool;builder_logo : string;}Leaderboard entry for builders
val pp_leaderboard_entry :
Ppx_deriving_runtime.Format.formatter ->
leaderboard_entry ->
Ppx_deriving_runtime.unitval equal_leaderboard_entry :
leaderboard_entry ->
leaderboard_entry ->
Ppx_deriving_runtime.booltype builder_volume_entry = {dt : Polymarket_common.Primitives.Timestamp.t;builder : string;builder_logo : string;verified : bool;volume : float;active_users : int;rank : string;}Builder volume entry
val yojson_of_builder_volume_entry :
builder_volume_entry ->
Ppx_yojson_conv_lib.Yojson.Safe.tval builder_volume_entry_of_yojson :
Ppx_yojson_conv_lib.Yojson.Safe.t ->
builder_volume_entryval pp_builder_volume_entry :
Ppx_deriving_runtime.Format.formatter ->
builder_volume_entry ->
Ppx_deriving_runtime.unitval equal_builder_volume_entry :
builder_volume_entry ->
builder_volume_entry ->
Ppx_deriving_runtime.booltype trader_leaderboard_entry = {rank : string;proxy_wallet : Polymarket_common.Primitives.Address.t;user_name : string;vol : float;pnl : float;profile_image : string;x_username : string;verified_badge : bool;}Trader leaderboard entry
val yojson_of_trader_leaderboard_entry :
trader_leaderboard_entry ->
Ppx_yojson_conv_lib.Yojson.Safe.tval trader_leaderboard_entry_of_yojson :
Ppx_yojson_conv_lib.Yojson.Safe.t ->
trader_leaderboard_entryval pp_trader_leaderboard_entry :
Ppx_deriving_runtime.Format.formatter ->
trader_leaderboard_entry ->
Ppx_deriving_runtime.unitval equal_trader_leaderboard_entry :
trader_leaderboard_entry ->
trader_leaderboard_entry ->
Ppx_deriving_runtime.boolThe client type (alias for HTTP client)
Default base URL: https://data-api.polymarket.com
val create :
?base_url:string ->
sw:Eio.Switch.t ->
net:'a Eio.Net.t ->
rate_limiter:Polymarket_rate_limiter.Rate_limiter.t ->
unit ->
tCreate a Data API client.
Check if the API is healthy.
val get_positions :
t ->
user:Polymarket_common.Primitives.Address.t ->
?market:Polymarket_common.Primitives.Hash64.t list ->
?event_id:int list ->
?size_threshold:float ->
?redeemable:bool ->
?mergeable:bool ->
?limit:int ->
?offset:int ->
?sort_by:Position_sort_by.t ->
?sort_direction:Sort_direction.t ->
?title:string ->
unit ->
(position list, Polymarket_http.Client.error) resultGet current positions for a user.
val get_closed_positions :
t ->
user:Polymarket_common.Primitives.Address.t ->
?market:Polymarket_common.Primitives.Hash64.t list ->
?event_id:int list ->
?title:string ->
?sort_by:Closed_position_sort_by.t ->
?sort_direction:Sort_direction.t ->
?limit:int ->
?offset:int ->
unit ->
(closed_position list, Polymarket_http.Client.error) resultGet closed positions for a user.
val get_trades :
t ->
?user:Polymarket_common.Primitives.Address.t ->
?market:Polymarket_common.Primitives.Hash64.t list ->
?event_id:int list ->
?side:Side.t ->
?filter_type:Filter_type.t ->
?filter_amount:float ->
?taker_only:bool ->
?limit:int ->
?offset:int ->
unit ->
(trade list, Polymarket_http.Client.error) resultGet trades for a user or markets.
val get_activity :
t ->
user:Polymarket_common.Primitives.Address.t ->
?market:Polymarket_common.Primitives.Hash64.t list ->
?event_id:int list ->
?activity_types:Activity_type.t list ->
?side:Side.t ->
?start_time:int ->
?end_time:int ->
?sort_by:Activity_sort_by.t ->
?sort_direction:Sort_direction.t ->
?limit:int ->
?offset:int ->
unit ->
(activity list, Polymarket_http.Client.error) resultGet user activity (on-chain).
val get_holders :
t ->
market:Polymarket_common.Primitives.Hash64.t list ->
?min_balance:int ->
?limit:int ->
unit ->
(meta_holder list, Polymarket_http.Client.error) resultGet top holders for markets.
val get_traded :
t ->
user:Polymarket_common.Primitives.Address.t ->
unit ->
(traded, Polymarket_http.Client.error) resultGet total markets a user has traded.
val get_value :
t ->
user:Polymarket_common.Primitives.Address.t ->
?market:Polymarket_common.Primitives.Hash64.t list ->
unit ->
(value list, Polymarket_http.Client.error) resultGet total value of a user's positions.
val get_open_interest :
t ->
?market:Polymarket_common.Primitives.Hash64.t list ->
unit ->
(open_interest list, Polymarket_http.Client.error) resultGet open interest for markets.
val get_live_volume :
t ->
id:int ->
unit ->
(live_volume list, Polymarket_http.Client.error) resultGet live volume for an event.
val get_builder_leaderboard :
t ->
?time_period:Time_period.t ->
?limit:int ->
?offset:int ->
unit ->
(leaderboard_entry list, Polymarket_http.Client.error) resultGet aggregated builder leaderboard.
val get_builder_volume :
t ->
?time_period:Time_period.t ->
unit ->
(builder_volume_entry list, Polymarket_http.Client.error) resultGet daily builder volume time-series.
val get_trader_leaderboard :
t ->
?category:Leaderboard_category.t ->
?time_period:Time_period.t ->
?order_by:Leaderboard_order_by.t ->
?user:Polymarket_common.Primitives.Address.t ->
?user_name:string ->
?limit:int ->
?offset:int ->
unit ->
(trader_leaderboard_entry list, Polymarket_http.Client.error) resultGet trader leaderboard rankings.