About ten minutes on Polyester devnet: public reads, a live stream, then a place-and-cancel with an API key.
Create a client
from polyester import AsyncPolyester
async with AsyncPolyester(
api_key_id="ak_...",
api_private_key="...", # 64-char hex from key creation
default_account_id="...", # Profile โ Account ID
) as client:
...Python ships async (AsyncPolyester) and sync (Polyester) clients with the same service tree. Prefer async for bots with streams.
Wait for catalogs
Decimal order inputs need spot config scales. Wait before first write:
await client.wait_for_catalogs()See Catalog & precision.
Read public market data
import asyncio
from polyester import AsyncPolyester
async def main() -> None:
async with AsyncPolyester() as client:
overview = await client.market_overview.list(limit=5)
for market in overview.markets:
print(market.symbol, market.last_price)
asyncio.run(main())Stream public trades
subscription = await client.market_data.subscribe_trades(symbol="BTC-USDT")
async with subscription:
async for trade in subscription:
print(trade.price.ticks if trade.price else None)
breakSubscription queues are bounded. If your consumer falls behind, the SDK raises a realtime overflow error and faults the subscription, it does not silently drop updates. See Streaming.
Place and cancel a limit order
Your API key policy must allow Spot trading for BTC-USDT, and its maximum order size must cover
the order below. Spot orders spend trading balance. Manage the policy from the key's Permissions page in the Polyester app.
from uuid import uuid4
client_order_id = f"quickstart-{uuid4().hex[:20]}"
result = await client.orders.create(
symbol="BTC-USDT",
side="buy",
order_type="limit",
tif="gtc",
qty="0.001",
price="50000",
post_only=True,
client_order_id=client_order_id,
)
print(result.status, result.order_id) # status == "accepted" (admission ack)
await client.orders.cancel(client_order_id=client_order_id)Next: Authentication and Trading.