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/client.ml.html
Source file client.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(** RFQ API client for Request for Quote trading. All RFQ endpoints require L2 authentication. *) module H = Polymarket_http.Client module B = Polymarket_http.Builder module J = Polymarket_http.Json module Auth = Polymarket_common.Auth module Crypto = Polymarket_common.Crypto open Types let default_base_url = "https://clob.polymarket.com" type t = { http : H.t; address : string; credentials : Auth.credentials } let create ?(base_url = default_base_url) ~sw ~net ~rate_limiter ~private_key ~credentials () = let http = H.create ~base_url ~sw ~net ~rate_limiter () in let address = Crypto.private_key_to_address private_key in { http; address; credentials } let address t = t.address let credentials t = t.credentials (** {1 Request Endpoints} *) let create_request t ~body () = B.new_post t.http "/rfq/request" |> B.with_body (J.body (yojson_of_create_request_body body)) |> B.with_l2_auth ~credentials:t.credentials ~address:t.address |> B.fetch_json ~expected_fields:yojson_fields_of_create_request_response ~context:"create_request_response" create_request_response_of_yojson let cancel_request t ~request_id () = B.new_delete_with_body t.http "/rfq/request" |> B.with_body (J.body (yojson_of_cancel_request_body { request_id })) |> B.with_l2_auth ~credentials:t.credentials ~address:t.address |> B.fetch_unit let get_requests t ?offset ?limit ?state ?request_ids ?markets ?size_min ?size_max ?size_usdc_min ?size_usdc_max ?price_min ?price_max ?sort_by ?sort_dir () = B.new_get t.http "/rfq/request" |> B.with_l2_auth ~credentials:t.credentials ~address:t.address |> B.query_add "offset" offset |> B.query_option "limit" string_of_int limit |> B.query_option "state" State_filter.to_string state |> B.query_each "requestIds" Fun.id request_ids |> B.query_each "markets" Fun.id markets |> B.query_option "sizeMin" string_of_float size_min |> B.query_option "sizeMax" string_of_float size_max |> B.query_option "sizeUsdcMin" string_of_float size_usdc_min |> B.query_option "sizeUsdcMax" string_of_float size_usdc_max |> B.query_option "priceMin" string_of_float price_min |> B.query_option "priceMax" string_of_float price_max |> B.query_option "sortBy" Sort_by.to_string sort_by |> B.query_option "sortDir" Sort_dir.to_string sort_dir |> B.fetch_json ~expected_fields:yojson_fields_of_get_requests_response ~context:"get_requests_response" get_requests_response_of_yojson (** {1 Quote Endpoints} *) let create_quote t ~body () = B.new_post t.http "/rfq/quote" |> B.with_body (J.body (yojson_of_create_quote_body body)) |> B.with_l2_auth ~credentials:t.credentials ~address:t.address |> B.fetch_json ~expected_fields:yojson_fields_of_create_quote_response ~context:"create_quote_response" create_quote_response_of_yojson let cancel_quote t ~quote_id () = B.new_delete_with_body t.http "/rfq/quote" |> B.with_body (J.body (yojson_of_cancel_quote_body { quote_id })) |> B.with_l2_auth ~credentials:t.credentials ~address:t.address |> B.fetch_unit let get_quotes t ?offset ?limit ?state ?quote_ids ?request_ids ?markets ?size_min ?size_max ?size_usdc_min ?size_usdc_max ?price_min ?price_max ?sort_by ?sort_dir () = B.new_get t.http "/rfq/quote" |> B.with_l2_auth ~credentials:t.credentials ~address:t.address |> B.query_add "offset" offset |> B.query_option "limit" string_of_int limit |> B.query_option "state" State_filter.to_string state |> B.query_each "quoteIds" Fun.id quote_ids |> B.query_each "requestIds" Fun.id request_ids |> B.query_each "markets" Fun.id markets |> B.query_option "sizeMin" string_of_float size_min |> B.query_option "sizeMax" string_of_float size_max |> B.query_option "sizeUsdcMin" string_of_float size_usdc_min |> B.query_option "sizeUsdcMax" string_of_float size_usdc_max |> B.query_option "priceMin" string_of_float price_min |> B.query_option "priceMax" string_of_float price_max |> B.query_option "sortBy" Sort_by.to_string sort_by |> B.query_option "sortDir" Sort_dir.to_string sort_dir |> B.fetch_json ~expected_fields:yojson_fields_of_get_quotes_response ~context:"get_quotes_response" get_quotes_response_of_yojson (** {1 Execution Endpoints} *) let accept_quote t ~body () = B.new_post t.http "/rfq/request/accept" |> B.with_body (J.body (yojson_of_accept_quote_body body)) |> B.with_l2_auth ~credentials:t.credentials ~address:t.address |> B.fetch_unit let approve_order t ~body () = B.new_post t.http "/rfq/quote/approve" |> B.with_body (J.body (yojson_of_approve_order_body body)) |> B.with_l2_auth ~credentials:t.credentials ~address:t.address |> B.fetch_json ~expected_fields:yojson_fields_of_approve_order_response ~context:"approve_order_response" approve_order_response_of_yojson
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>