package polymarket
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
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/src/polymarket.rfq/types.ml.html
Source file types.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210(** RFQ API types for Polymarket. These types correspond to the Polymarket RFQ (Request for Quote) API at https://clob.polymarket.com/rfq. *) open Ppx_yojson_conv_lib.Yojson_conv.Primitives (** {1 Primitive Types} *) type address = string [@@deriving yojson, show, eq] (** Ethereum address (0x-prefixed, 40 hex chars). *) type token_id = string [@@deriving yojson, show, eq] (** ERC1155 token ID or "0" for USDC. *) type request_id = string [@@deriving yojson, show, eq] (** UUID for an RFQ request. *) type quote_id = string [@@deriving yojson, show, eq] (** UUID for an RFQ quote. *) type trade_id = string [@@deriving yojson, show, eq] (** UUID for a trade. *) type condition_id = string [@@deriving yojson, show, eq] (** Market condition ID. *) (** {1 Enum Modules} *) module User_type = Polymarket_clob.Types.Signature_type (** Reuse Signature_type from CLOB as User_type. EOA = 0, POLY_PROXY = 1, POLY_GNOSIS_SAFE = 2 *) module Side = Polymarket_common.Primitives.Side (** State filter for GET requests. *) module State_filter = struct type t = Active | Inactive [@@deriving enum] end (** Request lifecycle states. *) module Request_state = struct type t = | Accepting_quotes [@value "STATE_ACCEPTING_QUOTES"] | Quote_accepted [@value "STATE_QUOTE_ACCEPTED"] | Maker_order_approved [@value "STATE_MAKER_ORDER_APPROVED"] | Completed [@value "STATE_COMPLETED"] | User_canceled [@value "STATE_USER_CANCELED"] | Internal_canceled [@value "STATE_INTERNAL_CANCELED"] | Request_expired [@value "STATE_REQUEST_EXPIRED"] | Request_execution_failed [@value "STATE_REQUEST_EXECUTION_FAILED"] [@@deriving enum] end (** Quote lifecycle states. *) module Quote_state = struct type t = | Request_quoted [@value "STATE_REQUEST_QUOTED"] | Request_accepted_quote [@value "STATE_REQUEST_ACCEPTED_QUOTE"] | Maker_approved [@value "STATE_MAKER_APPROVED"] | Completed [@value "STATE_COMPLETED"] | Maker_canceled [@value "STATE_MAKER_CANCELED"] | Request_canceled [@value "STATE_REQUEST_CANCELED"] | Request_expired [@value "STATE_REQUEST_EXPIRED"] | Execution_failed [@value "STATE_EXECUTION_FAILED"] | Maker_rejected_canceled [@value "STATE_MAKER_REJECTED_CANCELED"] | Maker_rejected_expired [@value "STATE_MAKER_REJECTED_EXPIRED"] [@@deriving enum] end (** Sort field for requests and quotes. *) module Sort_by = struct type t = Price | Expiry | Size | Created [@@deriving enum] end (** Sort direction. *) module Sort_dir = struct type t = Asc | Desc [@@deriving enum] end (** {1 Request Types} *) type create_request_body = { asset_in : token_id; [@key "assetIn"] asset_out : token_id; [@key "assetOut"] amount_in : string; [@key "amountIn"] amount_out : string; [@key "amountOut"] user_type : User_type.t; [@key "userType"] } [@@deriving yojson, show, eq] (** Request body for creating an RFQ request. *) type create_request_response = { request_id : request_id; [@key "requestId"] expiry : int; } [@@yojson.allow_extra_fields] [@@deriving yojson, show, eq, yojson_fields] (** Response from creating an RFQ request. *) type cancel_request_body = { request_id : request_id [@key "requestId"] } [@@deriving yojson, show, eq] (** Request body for canceling an RFQ request. *) type rfq_request = { request_id : request_id; [@key "requestId"] user : address; proxy : address; market : condition_id; token : token_id; complement : token_id; side : Side.t; size_in : float; [@key "sizeIn"] size_out : float; [@key "sizeOut"] price : float; expiry : int; } [@@yojson.allow_extra_fields] [@@deriving yojson, show, eq, yojson_fields] (** A single RFQ request in the list response. *) type get_requests_response = { data : rfq_request list; next_cursor : string; [@key "next_cursor"] limit : int; count : int; } [@@yojson.allow_extra_fields] [@@deriving yojson, show, eq, yojson_fields] (** Response from getting RFQ requests. *) (** {1 Quote Types} *) type create_quote_body = { request_id : request_id; [@key "requestId"] asset_in : token_id; [@key "assetIn"] asset_out : token_id; [@key "assetOut"] amount_in : string; [@key "amountIn"] amount_out : string; [@key "amountOut"] user_type : User_type.t; [@key "userType"] } [@@deriving yojson, show, eq] (** Request body for creating an RFQ quote. *) type create_quote_response = { quote_id : quote_id [@key "quoteId"] } [@@yojson.allow_extra_fields] [@@deriving yojson, show, eq, yojson_fields] (** Response from creating an RFQ quote. *) type cancel_quote_body = { quote_id : quote_id [@key "quoteId"] } [@@deriving yojson, show, eq] (** Request body for canceling an RFQ quote. *) type rfq_quote = { quote_id : quote_id; [@key "quoteId"] request_id : request_id; [@key "requestId"] user : address; proxy : address; market : condition_id; token : token_id; complement : token_id; side : Side.t; size_in : float; [@key "sizeIn"] size_out : float; [@key "sizeOut"] price : float; } [@@yojson.allow_extra_fields] [@@deriving yojson, show, eq, yojson_fields] (** A single RFQ quote in the list response. *) type get_quotes_response = { data : rfq_quote list; next_cursor : string; [@key "next_cursor"] limit : int; count : int; } [@@yojson.allow_extra_fields] [@@deriving yojson, show, eq, yojson_fields] (** Response from getting RFQ quotes. *) (** {1 Execution Types} *) type accept_quote_body = { request_id : request_id; [@key "requestId"] quote_id : quote_id; [@key "quoteId"] maker_amount : string; [@key "makerAmount"] taker_amount : string; [@key "takerAmount"] token_id : token_id; [@key "tokenId"] maker : address; signer : address; taker : address; nonce : string; expiration : int; side : Side.t; fee_rate_bps : string; [@key "feeRateBps"] signature : string; salt : string; owner : string; } [@@deriving yojson, show, eq] (** Request body for accepting a quote (creates an order). *) type approve_order_body = accept_quote_body [@@deriving yojson, show, eq] (** Request body for approving an order (same as accept_quote_body). *) type approve_order_response = { trade_ids : trade_id list [@key "tradeIds"] } [@@yojson.allow_extra_fields] [@@deriving yojson, show, eq, yojson_fields] (** Response from approving an order. *) (** {1 Error Type} *) type error = Polymarket_http.Client.error (** Structured error type for all API errors. *) let error_to_string = Polymarket_http.Client.error_to_string let pp_error = Polymarket_http.Client.pp_error
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>