Skip to content

Instantly share code, notes, and snippets.

@poly-rodr
Created April 16, 2024 23:37
Show Gist options
  • Save poly-rodr/f6530175c27e91a1b079c001262218d0 to your computer and use it in GitHub Desktop.
Save poly-rodr/f6530175c27e91a1b079c001262218d0 to your computer and use it in GitHub Desktop.
How to initialize the Clob Client using your magic PK
# 1- Create a Polymarket account using magic (email)
# 2- Send some USDC to your Polymarket address
# 3- Navigate any market to approve the allowances
# 4- Create the clob client like this
client = ClobClient(
host, # the polymarket host
key=key, # your private key exported from magic/polymarket
chain_id=chain_id, # 137
creds=creds, # your api creds (you can leave them empty if you havent generated/derivated them yet)
signature_type=1, # this type of config requires this signature type
funder="{YOUR POLYMARKET FUNDER ADDRESS WHERE YOU SENT THE USDC}") # this is your polymarket public address (where you send the usdc)
)
# 4- Derivate your api key
# Example: https://github.com/Polymarket/py-clob-client/blob/main/examples/derive_api_key.py
# NOTE: Please do not create a new PK if you want to see the same orders/trades in the Polymarket site and in your code implementation
client.derive_api_key()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment