-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Polymarket/feat/more-endpoints
Feat: midpoint and get open orders endpoint
- Loading branch information
Showing
6 changed files
with
96 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
|
||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import ApiCreds | ||
from dotenv import load_dotenv | ||
|
||
from py_clob_client.orders.constants import BUY | ||
|
||
|
||
load_dotenv() | ||
|
||
def main(): | ||
host = "http://localhost:8080" | ||
key = os.getenv("PK") | ||
creds = ApiCreds(api_key=os.getenv("CLOB_API_KEY"), api_secret=os.getenv("CLOB_SECRET"), api_passphrase=os.getenv("CLOB_PASS_PHRASE")) | ||
chain_id = 80001 | ||
client = ClobClient(host, key=key, chain_id=chain_id, creds=creds) | ||
|
||
resp = client.get_midpoint("16678291189211314787145083999015737376658799626183230671758641503291735614088") | ||
# {'mid': '0.55'} | ||
print(resp) | ||
print("Done!") | ||
|
||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
|
||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import ApiCreds, LimitOrderArgs | ||
from dotenv import load_dotenv | ||
|
||
from py_clob_client.orders.constants import BUY | ||
|
||
|
||
load_dotenv() | ||
|
||
def main(): | ||
host = "http://localhost:8080" | ||
key = os.getenv("PK") | ||
creds = ApiCreds(api_key=os.getenv("CLOB_API_KEY"), api_secret=os.getenv("CLOB_SECRET"), api_passphrase=os.getenv("CLOB_PASS_PHRASE")) | ||
chain_id = 80001 | ||
client = ClobClient(host, key=key, chain_id=chain_id, creds=creds) | ||
|
||
resp = client.get_open_orders(tokenID="16678291189211314787145083999015737376658799626183230671758641503291735614088") | ||
print(resp) | ||
print("Done!") | ||
|
||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
POST_ORDER = "/order" | ||
CANCEL = "/order" | ||
CANCEL_ALL = "/cancel-all" | ||
MID_POINT="/midpoint" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import requests | ||
import json | ||
|
||
from ..exceptions import PolyApiException | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name="py_clob_client", | ||
version="0.0.3", | ||
version="0.0.4", | ||
author="Jonathan Amenechi", | ||
author_email="[email protected]", | ||
description="Python client for the Polymarket CLOB", | ||
|