Trade executor for Polymarket CLOB API - supports orders, split, merge, redeem
Project description
Polymarket Trade Executor
Trade execution library for Polymarket CLOB API.
Installation
pip install polymarket-trade-executor
For merge/split/redeem (gasless transactions):
pip install polymarket-trade-executor[relayer]
Quick Start
import asyncio
from polymarket_trade_executor import TradeExecutor, OrderSide
async def main():
executor = TradeExecutor(
host="https://clob.polymarket.com",
private_key="0x...",
funder="0x...", # optional
# For merge/split/redeem (optional)
builder_api_key="xxx",
builder_secret="xxx",
builder_passphrase="xxx",
)
# Get balance
balance = await executor.get_balance()
print(f"Balance: ${balance:.2f}")
# Place market order
result = await executor.place_market_order(
asset_id="token_id_here",
side=OrderSide.BUY,
amount=10.0,
)
if result:
print(f"Order: {result.order_id} - {result.size_matched} tokens @ ${result.price}")
asyncio.run(main())
Features
| Feature | Requires Builder API |
|---|---|
place_order / place_market_order |
❌ |
post_orders (batch) |
❌ |
get_balance / get_token_balance |
❌ |
buy_market / sell_all (with retry) |
❌ |
split_positions |
✅ |
merge_positions / merge_all |
✅ |
redeem_positions |
✅ |
Simulation Mode
from polymarket_trade_executor import SimulateTradeExecutor
executor = SimulateTradeExecutor(starting_balance=1000.0)
# Same API as TradeExecutor, no real API calls
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polymarket_trade_executor-0.1.1.tar.gz.
File metadata
- Download URL: polymarket_trade_executor-0.1.1.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22e499419be5fc4b2246ba2e5e308ae02bd320d566cb00a8bba9c3440189fccc
|
|
| MD5 |
c4910533d1c3e94abd7ad6fd815f2ccb
|
|
| BLAKE2b-256 |
19e19b3fda624ef6eb487916981f5f733c2be52b670f1a5b908b87604cea0fa2
|
File details
Details for the file polymarket_trade_executor-0.1.1-py3-none-any.whl.
File metadata
- Download URL: polymarket_trade_executor-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d18797cb5f089bcfeb53958405227bf02f00298f36dfe2b20752a98ab15b1b2
|
|
| MD5 |
fd759874177819eb5c00ba92892df3d5
|
|
| BLAKE2b-256 |
dd92ce7e674d9d7f5e50a0439c8b44c439c7502fbca172597c2eabc268953689
|