Kuest Docs

Clients & SDKs

Choose a client for market data, trading, or Deposit Wallet actions

Hilfe erhalten

Use an SDK when you want typed models, authentication helpers, and order signing. Use the REST and WebSocket APIs directly when your runtime is unsupported or you need lower-level control.

Download configured bundles

Open Settings → SDKs to download a bundle configured for your operator's environment.

Choose a client

ClientLanguagesBest for
Unified SDKTypeScript, PythonMarket data, CLOB orders, and Deposit Wallet relayer actions in one client
Separate CLOB and relayer clientsRustMarket data, trading, and Deposit Wallet actions with separate Rust packages
REST APIAnyRaw JSON access and unsupported runtimes
WebSocketAnyOrder-book, order, trade, and live-data updates
TaskUse
Discover events and market metadataGamma API
Read books, prices, spreads, and tick sizesUnified SDK, Rust CLOB client, or REST
Create credentials and place ordersSecure SDK client or Rust CLOB client
Deploy a Deposit Wallet or batch approvalsSDK relayer or Rust relayer client
Track live market changesMarket WebSocket
Track private order and trade changesUser WebSocket

Unified TypeScript and Python quickstart

For registry installs, the packages are @kuest/sdk (TypeScript) and kuest-sdk (Python, imported as market_sdk). Downloaded operator bundles use neutral package names: @market-sdk/client in the TypeScript workspace and market-sdk as the Python distribution. A bundle includes .sdk/site-config.json for its public builder attribution, market scope, and optional geoblock settings. Keep signing keys and API credentials outside that file. Supply approved service URLs and a Polygon RPC URL explicitly; the SDKs do not include live endpoint defaults.

These examples only read an order book. TypeScript users working from a downloaded bundle should run pnpm install --frozen-lockfile and pnpm build first. Python users can run python3 -m pip install -e . from the extracted bundle.

import { createPublicClient, forkEnvironmentConfig } from '@market-sdk/client'
import { loadSiteConfig } from '@market-sdk/client/node'

const environment = forkEnvironmentConfig({
  name: 'operator',
  clob: { rest: process.env.SDK_CLOB_URL! },
  gamma: { rest: process.env.SDK_GAMMA_URL! },
  data: { rest: process.env.SDK_DATA_URL! },
  relayer: { rest: process.env.SDK_RELAYER_URL! },
  rpc: process.env.SDK_RPC_URL!,
})
const client = createPublicClient({ environment, siteConfig: loadSiteConfig() })
const book = await client.fetchOrderBook({ assetId: process.env.SDK_TOKEN_ID! })
console.log(book)

If installed from npm instead, use @kuest/sdk and @kuest/sdk/node for these imports.

For trading, create a secure client with a signer and Deposit Wallet address. Orders use signature type 3 and require CLOB API credentials. Pass the downloaded siteConfig to the TypeScript secure client so its public builder_code and order_metadata enter the signed order. The Python bundle reads the same overlay from its extracted project. Neither bundle contains private keys or API secrets.

Keep signing server-side

Never place private keys, CLOB API secrets, relayer credentials, or builder credentials in browser-exposed code. The frontend should call a protected service when privileged signing is required.

Deposit Wallet relayer workflow

The unified TypeScript and Python SDKs include relayer methods. Rust uses its separate relayer client. These methods submit Deposit Wallet actions without requiring the end user to hold the network gas token.

Required configuration:

RELAYER_URL=<operator_relayer_url>
KUEST_BUILDER_API_KEY=...
KUEST_BUILDER_SECRET=...
KUEST_BUILDER_PASSPHRASE=...
PRIVATE_KEY=...

A typical workflow is:

  1. Derive the expected Deposit Wallet address.
  2. Check whether its contract is deployed.
  3. Deploy it when necessary.
  4. Build the calls, such as collateral approval and splitPosition.
  5. Sign the Deposit Wallet batch with a short deadline.
  6. Submit through the relayer and wait for the transaction receipt.

Configure the relayer and Polygon RPC endpoints explicitly. Builder credentials stay on the server and are separate from the order's public builder_code.

Market-maker workflow

A market-making service usually:

  1. discovers active markets through Gamma;
  2. checks CLOB token IDs, tick size, negative-risk status, and trading state;
  3. prepares outcome-token inventory;
  4. reads the order book and calculates fair value;
  5. posts non-crossing, post-only bid and ask ladders;
  6. cancels or replaces stale quotes as price, inventory, or risk limits change.

Protect against stale or crossed quotes

Confirm the best buy is below the best sell, cap inventory and notional exposure, and cancel quotes when your data stream is stale or the strategy loses connectivity.

Authentication and updates

  • CLOB trading uses Deposit Wallet orders with signature type 3.
  • Secure SDK clients use L2 CLOB credentials derived from a wallet signature.
  • Relayer requests use separate KUEST_BUILDER_* credentials.
  • Server time should be synchronized before signing authenticated requests.

Check for updates from the extracted bundle directory. Back up local changes before applying an update, then reinstall dependencies for the downloaded project:

./.sdk/update --check
./.sdk/update --latest

Next steps