Polyscript SDK — write Polymarket strategies in Python (stub for IDE / type hints; real execution via Polyscript Editor or Desktop)
Project description
Polyscript
Python SDK for Polymarket — write trading strategies as decorator-based scripts.
import polyscript as bot
@bot.on_start
async def boot():
print(f"wallet = {bot.account.address()}")
bal = await bot.account.balance()
print(f"balance = {bal.usdc} USDC")
@bot.tick(every="2s")
async def t():
mid = await bot.market.midpoint("0xabc...")
if mid < 0.50:
await bot.order.place(
asset_id="0xabc...", side="buy",
size="10", price="0.45",
)
@bot.on_fill
async def f(fill):
print(f"filled {fill.size} @ {fill.price}")
Install
pip install polyscript
This package is a stub — provides type hints, dataclasses, and decorator registration for IDE support. To actually run strategies you need:
- Polyscript Editor — desktop app for writing + running scripts locally
- Polyscript Desktop — production host for automated trading
Both bundle the Rust SDK (the actual Polymarket integration). The stub package lets you author scripts with full IDE / type checker support before running them in the host app.
If you try to call an SDK method without a host, you'll see:
ImportError: polyscript._native not bundled — install and use Polyscript Editor or Polyscript Desktop ...
What's included
- Decorators:
@bot.on_start,@bot.on_stop,@bot.tick(every=...),@bot.background,@bot.on_fill,@bot.on_order,@bot.on_market_resolved,@bot.on_market_opened - Namespaces:
bot.account,bot.market,bot.markets,bot.order,bot.position,bot.bridge,bot.relayer,bot.stream - Models:
Balance,Book,BookLevel,Order,OrderStatus,Position,Side,Fill— frozen dataclasses with computed properties
Docs
Project details
Release history Release notifications | RSS feed
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 polyscript-0.1.1.tar.gz.
File metadata
- Download URL: polyscript-0.1.1.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b257ebecb0857fdada3669c722df07ab03a2fa1c2cb8926c2a250ac2c757bd1a
|
|
| MD5 |
0141f38b96c157f58efbc87b49279ffe
|
|
| BLAKE2b-256 |
88bd7eed2666473a5299f0d2576cb7f88b055286b995cc0290a7a10365666467
|
File details
Details for the file polyscript-0.1.1-py3-none-any.whl.
File metadata
- Download URL: polyscript-0.1.1-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5433ad247f7e5bb86bf274928bdb8fa3a7120dd3368b07a3a422e501d3e0601e
|
|
| MD5 |
dd9eb466206eb40f4e26880b4c56e107
|
|
| BLAKE2b-256 |
cd17cb4d80da44399b15e18354c15cca07f32e2df36efdf3381dd1aece6187d5
|