From 66fdd86c30db5b7edf04ffa4d32d68aefd8c873d Mon Sep 17 00:00:00 2001 From: Rodrigo <95635797+poly-rodr@users.noreply.github.com> Date: Mon, 3 Jul 2023 17:43:52 -0300 Subject: [PATCH] adding sampling endpoints --- examples/get_markets.py | 2 ++ py_clob_client/client.py | 20 ++++++++++++++++++++ py_clob_client/endpoints.py | 2 ++ 3 files changed, 24 insertions(+) diff --git a/examples/get_markets.py b/examples/get_markets.py index d8d9b1c..1ca0a24 100644 --- a/examples/get_markets.py +++ b/examples/get_markets.py @@ -21,6 +21,8 @@ def main(): print(client.get_markets()) print(client.get_simplified_markets()) + print(client.get_sampling_markets()) + print(client.get_sampling_simplified_markets()) print(client.get_market("condition_id")) print("Done!") diff --git a/py_clob_client/client.py b/py_clob_client/client.py index 10367d8..8352455 100644 --- a/py_clob_client/client.py +++ b/py_clob_client/client.py @@ -33,6 +33,8 @@ GET_SIMPLIFIED_MARKETS, GET_MARKETS, GET_MARKET, + GET_SAMPLING_SIMPLIFIED_MARKETS, + GET_SAMPLING_MARKETS, ) from .clob_types import ( ApiCreds, @@ -484,6 +486,24 @@ def are_orders_scoring(self, params: OrdersScoringParams): ) return get(url, headers=headers) + def get_sampling_markets(self, next_cursor="MA=="): + """ + Get the current sampling markets + """ + return get( + "{}{}?next_cursor={}".format(self.host, GET_SAMPLING_MARKETS, next_cursor) + ) + + def get_sampling_simplified_markets(self, next_cursor="MA=="): + """ + Get the current sampling simplified markets + """ + return get( + "{}{}?next_cursor={}".format( + self.host, GET_SAMPLING_SIMPLIFIED_MARKETS, next_cursor + ) + ) + def get_markets(self, next_cursor="MA=="): """ Get the current markets diff --git a/py_clob_client/endpoints.py b/py_clob_client/endpoints.py index 514b927..2d735ba 100644 --- a/py_clob_client/endpoints.py +++ b/py_clob_client/endpoints.py @@ -21,6 +21,8 @@ IS_ORDER_SCORING = "/order-scoring" ARE_ORDERS_SCORING = "/orders-scoring" GET_TICK_SIZE = "/tick-size" +GET_SAMPLING_SIMPLIFIED_MARKETS = "/sampling-simplified-markets" +GET_SAMPLING_MARKETS = "/sampling-markets" GET_SIMPLIFIED_MARKETS = "/simplified-markets" GET_MARKETS = "/markets" GET_MARKET = "/markets/"