Skip to main content
The Go SDK is the client for the Perpetuals and Options APIs. Orders go over the WebSocket; reads go over HTTP. It takes care of the connection, session and token plumbing listed below, so your code deals with orders and streams.
This page covers the SDK itself. What an endpoint or stream does, and what its fields mean, is documented in each product’s guides and API reference, which apply to the SDK unchanged.

What the SDK Handles

  • Access tokens. The client exchanges your API key for an Access Token when it first needs one, caches it, and refreshes it before it expires.
  • Connections. It opens the WebSocket, keeps it alive with pings, and reconnects with backoff that stays within the exchange’s connection limits, including a soft ban.
  • Sessions. Each connection keeps its session across reconnects, so order events missed while it was down are replayed.
  • Orders. Every order command over the WebSocket waits for the exchange’s answer and reports how long the acknowledgment and the answer took. Each carries a clientRequestId; the SDK generates one for a request that doesn’t set its own.
  • Rate limits. The rate limits the exchange reports reach you as errors, with how long to wait. An optional pacer keeps calls under your account’s budget before they are sent.

Install

The SDK requires Go 1.25 or later and follows semantic versioning; every release is listed in the changelog. It has three packages:

Credentials and Environments

A client takes an API key and its secret. Everything else is an option:
The client connects to Production. To use the Sandbox, pass its environment, with creds the credentials above:
The examples in these docs leave the environment out.

Next Steps

Perpetuals quickstart

Place and cancel a perpetuals order in one short program.

Options quickstart

Find a contract, then place and cancel an order on it.