Configure AsyncPolyester / Polyester with an environment, API/WS URL overrides, credentials, default account/subaccount,
catalog hydration, timeouts, and wire format (binary Protobuf default).
Recommended constructor
from polyester import AsyncPolyester, POLYESTER_TESTNET_ENVIRONMENT
async with AsyncPolyester(
environment=POLYESTER_TESTNET_ENVIRONMENT,
api_key_id="ak_...",
api_private_key="...", # 64-char hex from key creation
default_account_id="...", # Profile → Account ID
# api_url=None, # overrides environment.api_url
# ws_url=None, # overrides environment.websocket_url
# default_sub_account_id=None,
# timeout=10.0,
# wire_format="binary", # or "json"
# hydrate_catalogs=True,
) as client:
await client.wait_for_catalogs()Python ships async (AsyncPolyester) and sync (Polyester) clients with the same service
tree. Prefer async for bots with streams. Unary ConnectRPC responses are limited to 4 MiB after
decompression.
Options
environment: Network preset: API, WS, RPC, chain ID. Default: passPOLYESTER_TESTNET_ENVIRONMENT.api_key_id/api_private_key: Required for private RPCs / private WS. Default: unset.api_url: ConnectRPC base. Default:environment.api_url.ws_url: Centrifugo WebSocket. Default:environment.websocket_url.default_account_id: Private channel scoping. Default: unset.default_sub_account_id: Default trading scope. Default: unset.timeout: HTTP timeout seconds. Default:10.0.wire_format:"binary"or"json". Default:"binary".hydrate_catalogs: Background spot + Zipper hydration attempt. Default:True.
Aliases
| Alias | Points to |
|---|---|
client.candles | client.market_data |
client.trading_withdraws | client.withdraw |
From environment
AsyncPolyester.from_env() / Polyester.from_env() load:
POLYESTER_ENV(set totestnet)POLYESTER_API_KEY_IDPOLYESTER_API_PRIVATE_KEYPOLYESTER_ACCOUNT_IDPOLYESTER_API_URL/POLYESTER_WS_URL(optionalapi_url/ws_urloverrides)
Keyword arguments passed to from_env(**overrides) take precedence over the process environment.
Prefer explicit credentials in production.
Catalog readiness
With
hydrate_catalogs=True, call await client.wait_for_catalogs() before
decimal order writes that need symbol scales. The wait fails if either required
catalog cannot be hydrated or validated.Retries are application-controlled
The SDK does not automatically retry unary calls, apart from the bounded
unavailable retry on
trigger reads and the polling in wait_batch_replace. Retry only transport and rate-limit failures
with backoff and stable idempotency keys. Reconcile mutation outcomes before retrying.Related
Related Topics
Address book Saved destinations and whitelist views. API keys List, get, subscribe, and generate local API key material (no create on API-key SDKs). Auth Auth service helpers including nested profile access. Balances Read ledger balances and history, see reserved amounts, and stream live balance updates. Candles Read and stream public spot OHLCV candles via market data (candles alias). Catalog Spot and Zipper catalog hydration, symbol lookups, and quantity scales used by decimal order writes. Chain helpers On-chain Funding → Trading and Funding withdraw helpers. Chain analytics Chain analytics read APIs. Deposit Create and list per-account chain deposit addresses for funding your Polyester account. Errors Python SDK error types, MFA auth codes, realtime overflow, and retry guidance. Fees Read effective spot fee rates, reserve rates, scheduled changes, and the fee breakdown with client.fees. Guard signer Guard signer approval helpers. Heatmap L2 order book heatmap reads. Internal transfers Move trading balances between Polyester accounts without touching a chain. Lifecycle Deposit/withdraw lifecycle flows and subscribe. Market overview List and subscribe to per-market stats with optional snapshot-then-stream merge. Order book Depth snapshots and a stateful live order book that reconstructs the book for you. Orders Place, modify, cancel, batch, and stream spot orders, with optional attached take-profit, stop-loss, and trailing-stop risk. Policies Realtime API-key and subaccount-policy updates. Profile Profile identity reads and subscribe helpers. Public trades Public trade tape reads and subscribe via market data. Realtime Shared Centrifugo WebSocket client, subscription contract, handshake-before-return, and fail-closed overflow. Social verification Social verification APIs (reference-only). Subaccounts Subaccount reads, members, invites, activity. User trades List and stream your private spot fills (not the public tape). Transfers Transfer history reads. Triggers Create, manage, pause/resume, and stream standalone automations that place a child order when a market condition fires. Withdrawals Trading withdraw intents to funding or external chain destinations (signed payload). Zipper Deposit/withdraw config and related Zipper reads.