-
Notifications
You must be signed in to change notification settings - Fork 32
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 #14 from Polymarket/fix/order-history
Fix: order history
- Loading branch information
Showing
6 changed files
with
100 additions
and
3 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,23 @@ | ||
import os | ||
|
||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import ApiCreds | ||
from dotenv import load_dotenv | ||
from pprint import pprint | ||
|
||
|
||
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_order_history(tokenID="16678291189211314787145083999015737376658799626183230671758641503291735614088") | ||
pprint(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,22 @@ | ||
import os | ||
|
||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import ApiCreds | ||
from dotenv import load_dotenv | ||
from pprint import pprint | ||
|
||
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_trade_history(tokenID="16678291189211314787145083999015737376658799626183230671758641503291735614088") | ||
pprint(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,32 @@ | ||
import os | ||
|
||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import ApiCreds, LimitOrderArgs, MarketOrderArgs | ||
from dotenv import load_dotenv | ||
from pprint import pprint | ||
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) | ||
|
||
# Create and sign a market order, using 100 USDC size to buy as many tokens as possible | ||
# Note: Size in market buy is the COLLATERAL size used to initiate the buy | ||
# While in a market sell, size is the amount of YES/NO tokens used to initiate the sell | ||
order_args = MarketOrderArgs( | ||
size=100.0, | ||
side=BUY, | ||
token_id="16678291189211314787145083999015737376658799626183230671758641503291735614088" | ||
) | ||
mkt_order = client.create_market_order(order_args) | ||
resp = client.post_order(mkt_order) | ||
pprint(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
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.11", | ||
version="0.0.12", | ||
author="Jonathan Amenechi", | ||
author_email="[email protected]", | ||
description="Python client for the Polymarket CLOB", | ||
|