Go is synchronous. Pass context.Context on every call. Cancel the context to stop waits and stream receives.
Process lifecycle
- Create one client per process (or per logical bot) and reuse it.
- Close / drop the client on shutdown so HTTP and WebSocket pools release cleanly
(Python context managers, Go
Close(), Rust drop). - Cancel work with async cancellation (Python task cancel),
context.Context(Go), or Tokio cancellation (Rust).
Configuration
Prefer explicit credentials from your secret store. Use from_env / FromEnv only for local
scripts.
Wait for catalogs before decimal writes. Disable catalog hydration only if you exclusively use pre-scaled integers and understand the tradeoff.
Wire format
Binary Protobuf is the default Connect codec. JSON wire formats are for debugging, not hot
paths. With WireFormat: "json", API-key signatures hash the ProtoJSON body bytes (matching connect.WithProtoJSON()), not binary protobuf. A body/signature mismatch fails auth.
See Client configuration.
Related Topics
Authentication Configure Ed25519 API keys, Account ID, and env-based wiring for bots. Market data Read candles, public trades, order books, and market overview, no credentials required. Trading Place, modify, cancel, and batch spot orders; use triggers with the Go SDK. Streaming Subscribe with Messages() channels, handshake-before-return, and fail-closed overflow. Accounts & balances Funding vs trading balances, holds, subaccounts, policies, and transfer history. Deposits & withdrawals Deposit addresses, trading withdraws, internal transfers, and funding flows. Error handling Classify Go SDK errors with errors.As, retry with idempotency keys, handle queue overflow. Production trading operations Operate, test, troubleshoot, and upgrade an automated Go trading system safely.