Skip to content

[WIP] fix: add funder and signature_type to examples#238

Open
vikions wants to merge 2 commits intoPolymarket:mainfrom
vikions:fix/update-examples-add-funder-signature-type
Open

[WIP] fix: add funder and signature_type to examples#238
vikions wants to merge 2 commits intoPolymarket:mainfrom
vikions:fix/update-examples-add-funder-signature-type

Conversation

@vikions
Copy link

@vikions vikions commented Jan 5, 2026

Overview

Examples order.py and market_buy_order.py are missing funder and signature_type parameters, causing errors for most users. This PR updates examples to match README documentation.

Description

The current examples don't include critical parameters that are documented in README:

  • Added funder parameter (address holding funds on Polymarket)
  • Added signature_type parameter (0=EOA, 1=Magic, 2=Proxy)
  • Updated .env.example with new variables and explanations
  • Changed examples from AMOY testnet to POLYGON mainnet to match README

Real-world experience:
While building Opipolix Bot (a Polymarket/Opiniona trading bot), we experienced invalid signature and not enough balance / allowance errors when following the examples. The bot only started working after adding funder and signature_type parameters — exactly as documented in README but missing from examples.

Our working implementation:

signature_type = 2 if self.funder_address else 0

self.client = ClobClient(
    host=CLOB_URL,
    key=self.private_key,
    chain_id=CHAIN_ID,
    signature_type=signature_type,
    funder=self.funder_address,
)

Related issues: #109, #198, #187

Testing instructions

No changes to test runner. Examples can be tested manually with valid credentials.

Types of changes

  • Bug fix/behavior correction

Notes

README was updated ~3 months ago with correct parameters, but examples (~8 months old) were not updated to match.

Status

  • Prefix PR title with [WIP] if necessary (changes not yet made).
  • Add tests to cover changes as needed.
  • Update documentation/changelog as needed.
  • Verify all tests run correctly in CI and pass.
  • Ready for review/merge.

Note

Examples updated to match current client usage and mainnet defaults

  • Add funder and signature_type to ClobClient initialization in order.py and market_buy_order.py; remove manual ApiCreds wiring and instead create_or_derive_api_creds() + set_api_creds()
  • Switch network constant from AMOY to POLYGON; default host remains https://clob.polymarket.com
  • Adjust example order params/comments (e.g., price 0.50, clarify BUY amount is USDC; use OrderType.FOK for market buy)
  • Expand .env.example with FUNDER, SIGNATURE_TYPE, and clearer API URL/credential guidance

Written by Cursor Bugbot for commit c16cd82. This will update automatically on new commits. Configure here.

@vikions vikions requested a review from a team as a code owner January 5, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant