Skip to main content

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

polymarket_trade_executor-0.1.3.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polymarket_trade_executor-0.1.3-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file polymarket_trade_executor-0.1.3.tar.gz.

File metadata

File hashes

Hashes for polymarket_trade_executor-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f670661e522efffd7bf1766f34c75bba5ecd093d1d668b5d95274800310ffbef
MD5 2403a2080e7a208ea509132d1c5ce960
BLAKE2b-256 1135f10b48849cf8738041bb73be0e7fd26cbe59c1f0017de7f3d5fe84384cac

See more details on using hashes here.

File details

Details for the file polymarket_trade_executor-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for polymarket_trade_executor-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f83268468b7440149e002c3a4392c15947185be90cfe4b6c0a94f059fd676d1c
MD5 9e0211d48a56216bfac1276a1875f517
BLAKE2b-256 55e2dd1b3bb760223837d9d17701535cec1b22b7a7498977a7db7d2cd2e569db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page