Skip to content

Commit

Permalink
adding sampling endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
poly-rodr committed Jul 3, 2023
1 parent 8e9b7de commit 66fdd86
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/get_markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand Down
20 changes: 20 additions & 0 deletions py_clob_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
GET_SIMPLIFIED_MARKETS,
GET_MARKETS,
GET_MARKET,
GET_SAMPLING_SIMPLIFIED_MARKETS,
GET_SAMPLING_MARKETS,
)
from .clob_types import (
ApiCreds,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions py_clob_client/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/"

0 comments on commit 66fdd86

Please sign in to comment.