Precision, Limits, and Fees
Read market specifications for exchange increments and account endpoints for your fee schedule and request budgets. The values in documentation examples illustrate those responses.
Use Decimal Arithmetic
Section titled “Use Decimal Arithmetic”Prices, quantities, balances, P&L, funding rates, fees, and leverage are JSON strings. Preserve them through storage and calculations with a decimal library or scaled integers. Counts, HTTP codes, and stream sequences are integers.
Keep every amount next to its unit. "0.060" BTC, "0.462" USDT, and "0.0001" as a fee rate describe different quantities. A negative fee represents a rebate; a negative funding rate changes the payment direction.
Validate quantity_step and the contract’s price_rule (fixed tick or significant figures), then check minimum size and exchange notional rules. For a split order, each child must satisfy its destination’s increments. Read Markets and Exchange Contracts for the normalized contract model.
Read Account Capacity
Section titled “Read Account Capacity”from rest_client import request
limits = request("GET", "/v1/account/limits?account_id=acct_example_main")print(limits["rest_requests_per_second"])print(limits["order_requests_per_second"])print(limits["websocket_connections"])The limit response also includes subscriptions per connection and maximum batch size. The contract caps a batch at 20 orders; an account may have a lower limit. Each batch item consumes one order-budget unit.
Use the response headers for remaining capacity and reset time. Reserve request budget for cancellations, risk reads, and recovery. Rate limiting is shared by processes using the same account, so coordinate their budgets. Requests and Retries defines the headers.
Separate Trading Fees from Funding
Section titled “Separate Trading Fees from Funding”GET /v1/account/fees returns maker, taker, and Trade8 rates by exchange contract. A maker rebate appears as a negative rate. The fill’s fee and fee_asset record the actual execution charge.
Funding is a separate transfer between positions at the exchange’s funding interval. Compare the rate with interval_hours and next_funding_at. Custody, settlement, transfer, and network charges follow the relevant account arrangement.
Client Limits
Section titled “Client Limits”Apply bounded queues to incoming WebSocket messages. Monitor processing lag, book freshness, and reconnect frequency. A slow consumer should resubscribe with fewer channels or increase processing capacity before resuming trading.
Give HTTP requests a timeout, then use the original client ID and idempotency key to reconcile mutations. Use account and exchange status to decide when a strategy can safely resume.