feat: add Polymarket trading support via Turbine API proxy#34
Open
feat: add Polymarket trading support via Turbine API proxy#34
Conversation
- Add PolymarketClient in turbine_client/polymarket.py with full API coverage: authenticate, derive_api_key, get_markets, get_orderbook, create_order, cancel_order, get_open_orders, get_positions - All requests routed through Turbine with ?polymarket=true query param - Authenticated requests use X-Polymarket-* headers (per-request, never stored) - Add optional dependency: polymarket = ["py-clob-client>=0.18.0"] - Export PolymarketClient from turbine_client/__init__.py - Add examples/polymarket_bot.py with market scanning, order placement, position tracking, graceful shutdown - Add tests/test_polymarket.py with 23 unit tests covering headers, params, order payloads, auth flow, error handling, URL construction
- polymarket_auth.py: sign_clob_auth_message() and get_polymarket_credentials() handle the full EIP-712 auth flow so users don't need to manually obtain keys - create-polymarket-bot skill: Claude Code skill for generating Polymarket bots - Updated __init__.py exports
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
PolymarketClientto the SDK so users can trade on Polymarket through Turbine's API proxy. Companion to turbine-clob PR #281.How it works
?polymarket=truequery paramX-Polymarket-*headers per-requestpy_clob_client— Turbine never sees private keysWhat's included
turbine_client/polymarket.py—PolymarketClientclass (auth, markets, orderbook, orders, positions)examples/polymarket_bot.py— Complete example bot with market scanning, order placement, position trackingtests/test_polymarket.py— 23 unit tests, all passingpyproject.toml—py-clob-clientas optional[polymarket]extraturbine_client/__init__.py— Export addedTesting
Depends on: ojo-network/turbine-clob#281