Skip to main content
Every option works with both perps.NewClient and options.NewClient:

Pacing

Rate limits (Perpetuals, Options) are per account, and shared with everything else using it. A pacer keeps the metered calls under the account’s budgets from the client’s side, so they wait a little instead of coming back as 429s. It is off unless installed with rails.WithPacer. Each product has a pacer preset to its published budgets, and WithLimitsFromToken picks those of your account’s type (creds is your rails.Credentials):
WithLimits sets your own ceilings per class of operation; the classes and preset budgets are on pkg.go.dev (perps, options). A call that would exceed a ceiling waits until it fits, within its context; if the context ends first, nothing was sent. When the exchange rate-limits a call anyway, the pacer holds that class back for the wait it named. With WithFailFast, a call that would have to wait is refused instead, with rails.ErrNotSent wrapping rails.ErrPaced.
The budgets are per account, and the built-in pacer counts only its own client’s calls. It keeps you under the limits only while one process is the only thing using the account. With several processes, or anything else on the account, give each a share of the budget with WithLimits, or implement the rails.Pacer interface over a store they share; otherwise the exchange still refuses calls over its limits.

Instrumentation

rails.Hooks is a struct of optional functions, called as the SDK observes each thing. Set the ones you want:
ConnInfo.ConnID stays the same across the reconnects of one connection, and ReqInfo names the command, its market and its clientRequestId. Hooks run on the goroutine that made the observation and must not block.