Module Rfq.Types

RFQ API types for Polymarket.

These types correspond to the Polymarket RFQ (Request for Quote) API at https://clob.polymarket.com/rfq.

Primitives Module Alias

module P : sig ... end

Abstract primitive types with built-in validation.

Enum Modules

module User_type = Clob.Types.Signature_type

Reuse Signature_type from CLOB as User_type. EOA = 0, POLY_PROXY = 1, POLY_GNOSIS_SAFE = 2

module Side : sig ... end
module State_filter : sig ... end

State filter for GET requests.

module Request_state : sig ... end

Request lifecycle states.

module Quote_state : sig ... end

Quote lifecycle states.

module Sort_by : sig ... end

Sort field for requests and quotes.

module Sort_dir = P.Sort_dir

Sort direction.

Request Types

type create_request_body = {
  1. asset_in : P.U256.t;
  2. asset_out : P.U256.t;
  3. amount_in : string;
  4. amount_out : string;
  5. user_type : User_type.t;
}

Request body for creating an RFQ request.

val create_request_body_of_yojson : Yojson.Safe.t -> create_request_body
val yojson_of_create_request_body : create_request_body -> Yojson.Safe.t
val pp_create_request_body : Stdlib.Format.formatter -> create_request_body -> unit
val show_create_request_body : create_request_body -> string
val equal_create_request_body : create_request_body -> create_request_body -> bool
type create_request_response = {
  1. request_id : P.Request_id.t;
  2. expiry : int;
}

Response from creating an RFQ request.

val create_request_response_of_yojson : Yojson.Safe.t -> create_request_response
val yojson_of_create_request_response : create_request_response -> Yojson.Safe.t
val pp_create_request_response : Stdlib.Format.formatter -> create_request_response -> unit
val show_create_request_response : create_request_response -> string
val equal_create_request_response : create_request_response -> create_request_response -> bool
type cancel_request_body = {
  1. request_id : P.Request_id.t;
}

Request body for canceling an RFQ request.

val cancel_request_body_of_yojson : Yojson.Safe.t -> cancel_request_body
val yojson_of_cancel_request_body : cancel_request_body -> Yojson.Safe.t
val pp_cancel_request_body : Stdlib.Format.formatter -> cancel_request_body -> unit
val show_cancel_request_body : cancel_request_body -> string
val equal_cancel_request_body : cancel_request_body -> cancel_request_body -> bool
type rfq_request = {
  1. request_id : P.Request_id.t;
  2. user : P.Address.t;
  3. proxy : P.Address.t;
  4. market : P.Hash64.t;
  5. token : P.U256.t;
  6. complement : P.U256.t;
  7. side : Side.t;
  8. size_in : P.Decimal.t;
  9. size_out : P.Decimal.t;
  10. price : P.Decimal.t;
  11. expiry : int;
}

A single RFQ request in the list response.

val rfq_request_of_yojson : Yojson.Safe.t -> rfq_request
val yojson_of_rfq_request : rfq_request -> Yojson.Safe.t
val pp_rfq_request : Stdlib.Format.formatter -> rfq_request -> unit
val show_rfq_request : rfq_request -> string
val equal_rfq_request : rfq_request -> rfq_request -> bool
type get_requests_response = {
  1. data : rfq_request list;
  2. next_cursor : string;
  3. limit : int;
  4. count : int;
}

Response from getting RFQ requests.

val get_requests_response_of_yojson : Yojson.Safe.t -> get_requests_response
val yojson_of_get_requests_response : get_requests_response -> Yojson.Safe.t
val pp_get_requests_response : Stdlib.Format.formatter -> get_requests_response -> unit
val show_get_requests_response : get_requests_response -> string
val equal_get_requests_response : get_requests_response -> get_requests_response -> bool

Quote Types

type create_quote_body = {
  1. request_id : P.Request_id.t;
  2. asset_in : P.U256.t;
  3. asset_out : P.U256.t;
  4. amount_in : string;
  5. amount_out : string;
  6. user_type : User_type.t;
}

Request body for creating an RFQ quote.

val create_quote_body_of_yojson : Yojson.Safe.t -> create_quote_body
val yojson_of_create_quote_body : create_quote_body -> Yojson.Safe.t
val pp_create_quote_body : Stdlib.Format.formatter -> create_quote_body -> unit
val show_create_quote_body : create_quote_body -> string
val equal_create_quote_body : create_quote_body -> create_quote_body -> bool
type create_quote_response = {
  1. quote_id : P.Quote_id.t;
}

Response from creating an RFQ quote.

val create_quote_response_of_yojson : Yojson.Safe.t -> create_quote_response
val yojson_of_create_quote_response : create_quote_response -> Yojson.Safe.t
val pp_create_quote_response : Stdlib.Format.formatter -> create_quote_response -> unit
val show_create_quote_response : create_quote_response -> string
val equal_create_quote_response : create_quote_response -> create_quote_response -> bool
type cancel_quote_body = {
  1. quote_id : P.Quote_id.t;
}

Request body for canceling an RFQ quote.

val cancel_quote_body_of_yojson : Yojson.Safe.t -> cancel_quote_body
val yojson_of_cancel_quote_body : cancel_quote_body -> Yojson.Safe.t
val pp_cancel_quote_body : Stdlib.Format.formatter -> cancel_quote_body -> unit
val show_cancel_quote_body : cancel_quote_body -> string
val equal_cancel_quote_body : cancel_quote_body -> cancel_quote_body -> bool
type rfq_quote = {
  1. quote_id : P.Quote_id.t;
  2. request_id : P.Request_id.t;
  3. user : P.Address.t;
  4. proxy : P.Address.t;
  5. market : P.Hash64.t;
  6. token : P.U256.t;
  7. complement : P.U256.t;
  8. side : Side.t;
  9. size_in : P.Decimal.t;
  10. size_out : P.Decimal.t;
  11. price : P.Decimal.t;
}

A single RFQ quote in the list response.

val rfq_quote_of_yojson : Yojson.Safe.t -> rfq_quote
val yojson_of_rfq_quote : rfq_quote -> Yojson.Safe.t
val pp_rfq_quote : Stdlib.Format.formatter -> rfq_quote -> unit
val show_rfq_quote : rfq_quote -> string
val equal_rfq_quote : rfq_quote -> rfq_quote -> bool
type get_quotes_response = {
  1. data : rfq_quote list;
  2. next_cursor : string;
  3. limit : int;
  4. count : int;
}

Response from getting RFQ quotes.

val get_quotes_response_of_yojson : Yojson.Safe.t -> get_quotes_response
val yojson_of_get_quotes_response : get_quotes_response -> Yojson.Safe.t
val pp_get_quotes_response : Stdlib.Format.formatter -> get_quotes_response -> unit
val show_get_quotes_response : get_quotes_response -> string
val equal_get_quotes_response : get_quotes_response -> get_quotes_response -> bool

Execution Types

type accept_quote_body = {
  1. request_id : P.Request_id.t;
  2. quote_id : P.Quote_id.t;
  3. maker_amount : string;
  4. taker_amount : string;
  5. token_id : P.U256.t;
  6. maker : P.Address.t;
  7. signer : P.Address.t;
  8. taker : P.Address.t;
  9. nonce : string;
  10. expiration : int;
  11. side : Side.t;
  12. fee_rate_bps : string;
  13. signature : P.Signature.t;
  14. salt : string;
  15. owner : string;
}

Request body for accepting a quote (creates an order).

val accept_quote_body_of_yojson : Yojson.Safe.t -> accept_quote_body
val yojson_of_accept_quote_body : accept_quote_body -> Yojson.Safe.t
val pp_accept_quote_body : Stdlib.Format.formatter -> accept_quote_body -> unit
val show_accept_quote_body : accept_quote_body -> string
val equal_accept_quote_body : accept_quote_body -> accept_quote_body -> bool
type approve_order_body = accept_quote_body

Request body for approving an order (same as accept_quote_body).

val approve_order_body_of_yojson : Yojson.Safe.t -> approve_order_body
val yojson_of_approve_order_body : approve_order_body -> Yojson.Safe.t
val pp_approve_order_body : Stdlib.Format.formatter -> approve_order_body -> unit
val show_approve_order_body : approve_order_body -> string
val equal_approve_order_body : approve_order_body -> approve_order_body -> bool
type approve_order_response = {
  1. trade_ids : P.Trade_id.t list;
}

Response from approving an order.

val approve_order_response_of_yojson : Yojson.Safe.t -> approve_order_response
val yojson_of_approve_order_response : approve_order_response -> Yojson.Safe.t
val pp_approve_order_response : Stdlib.Format.formatter -> approve_order_response -> unit
val show_approve_order_response : approve_order_response -> string
val equal_approve_order_response : approve_order_response -> approve_order_response -> bool

Error Type

Structured error type for all API errors.

val error_to_string : error -> string

Convert error to human-readable string.

val pp_error : Stdlib.Format.formatter -> error -> unit

Pretty printer for errors.

Field Lists for Extra Field Detection

val yojson_fields_of_create_request_response : string list
val yojson_fields_of_rfq_request : string list
val yojson_fields_of_get_requests_response : string list
val yojson_fields_of_create_quote_response : string list
val yojson_fields_of_rfq_quote : string list
val yojson_fields_of_get_quotes_response : string list
val yojson_fields_of_approve_order_response : string list