-
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 #78 from Polymarket/feat/market-orders
Feat/market orders
- Loading branch information
Showing
28 changed files
with
1,208 additions
and
70 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
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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import BookParams | ||
|
||
|
||
def main(): | ||
host = "http://localhost:8080" | ||
client = ClobClient(host) | ||
|
||
resp = client.get_order_books( | ||
params=[ | ||
BookParams( | ||
token_id="71321045679252212594626385532706912750332728571942532289631379312455583992563" | ||
), | ||
BookParams( | ||
token_id="52114319501245915516055106046884209969926127482827954674443846427813813222426" | ||
), | ||
] | ||
) | ||
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import BookParams | ||
|
||
|
||
def main(): | ||
host = "http://localhost:8080" | ||
client = ClobClient(host) | ||
|
||
resp = client.get_price( | ||
"71321045679252212594626385532706912750332728571942532289631379312455583992563", | ||
"BUY", | ||
) | ||
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,33 @@ | ||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import BookParams | ||
|
||
|
||
def main(): | ||
host = "http://localhost:8080" | ||
client = ClobClient(host) | ||
|
||
resp = client.get_prices( | ||
params=[ | ||
BookParams( | ||
token_id="71321045679252212594626385532706912750332728571942532289631379312455583992563", | ||
side="BUY", | ||
), | ||
BookParams( | ||
token_id="71321045679252212594626385532706912750332728571942532289631379312455583992563", | ||
side="SELL", | ||
), | ||
BookParams( | ||
token_id="52114319501245915516055106046884209969926127482827954674443846427813813222426", | ||
side="BUY", | ||
), | ||
BookParams( | ||
token_id="52114319501245915516055106046884209969926127482827954674443846427813813222426", | ||
side="SELL", | ||
), | ||
] | ||
) | ||
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,30 @@ | ||
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.constants import AMOY | ||
|
||
|
||
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 = AMOY | ||
client = ClobClient(host, key=key, chain_id=chain_id, creds=creds) | ||
|
||
resp = client.get_spread( | ||
"71321045679252212594626385532706912750332728571942532289631379312455583992563" | ||
) | ||
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,23 @@ | ||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import BookParams | ||
|
||
|
||
def main(): | ||
host = "http://localhost:8080" | ||
client = ClobClient(host) | ||
|
||
resp = client.get_spreads( | ||
params=[ | ||
BookParams( | ||
token_id="71321045679252212594626385532706912750332728571942532289631379312455583992563" | ||
), | ||
BookParams( | ||
token_id="52114319501245915516055106046884209969926127482827954674443846427813813222426" | ||
), | ||
] | ||
) | ||
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os | ||
|
||
from py_clob_client.client import ClobClient | ||
from py_clob_client.clob_types import ApiCreds, MarketOrderArgs, OrderType | ||
from dotenv import load_dotenv | ||
from py_clob_client.constants import AMOY | ||
|
||
|
||
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 = AMOY | ||
client = ClobClient(host, key=key, chain_id=chain_id, creds=creds) | ||
|
||
# create a market buy order for the equivalent of 100 USDC at the market price | ||
order_args = MarketOrderArgs( | ||
token_id="71321045679252212594626385532706912750332728571942532289631379312455583992563", | ||
amount=100, | ||
) | ||
signed_order = client.create_market_order(order_args) | ||
resp = client.post_order(signed_order, orderType=OrderType.FOK) | ||
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
Oops, something went wrong.