Skip to content

Instantly share code, notes, and snippets.

@Maxim-Mazurok
Created June 25, 2025 07:53
Show Gist options
  • Save Maxim-Mazurok/d2516fbc5a18741602102d6042163abd to your computer and use it in GitHub Desktop.
Save Maxim-Mazurok/d2516fbc5a18741602102d6042163abd to your computer and use it in GitHub Desktop.
python order - working
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import OrderArgs, PartialCreateOrderOptions, OrderType
from py_clob_client.constants import POLYGON
from py_clob_client.order_builder.constants import BUY
from math import floor
# === Config ===
host = "https://clob.polymarket.com"
private_key = "0000000000000000000000000000000000000000000000000000000000000000" # without 0x
funder = "0000000000000000000000000000000000000000" # from profile (not deposit address)
signature_type = 1 # POLY_PROXY
# === Main ===
def main():
client = ClobClient(
host=host,
key=private_key,
chain_id=POLYGON,
signature_type=signature_type,
funder=funder
)
creds = client.create_or_derive_api_creds()
print("API Key Derived:", creds)
client.set_api_creds(creds)
order = OrderArgs(
token_id="52843799572381181810558076423316491787675005787611777123737394981466193718404",
side='BUY',
size=floor(15),
price=0.01,
)
signed_order = client.create_order(
order,
PartialCreateOrderOptions(
tick_size="0.01",
neg_risk=False
)
)
result = client.post_order(signed_order, OrderType.GTC)
print(result)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment