SDKs

Official GoDark client libraries for programmatic trading. Each SDK implements the same public API documented in REST API and WebSocket API — including OAuth2 authentication, ECDH session setup, and AES-GCM encrypted order payloads.

SDK distribution is currently limited to approved integrators. Contact GoDark for access. Public package registries (PyPI, npm, crates.io, pkg.go.dev, Maven Central) will be announced when general availability opens.

Languages

LanguagePackage (planned)RequirementsStatus
PythongodarkPython 3.10+Beta
RustgodarkRust 2021, tokioBeta
JavaScript / TypeScript@godark/sdkNode.js 18+Beta
C++godark headersC++17Beta
Gogithub.com/gq-godark/gdx-go-sdkGo 1.22+Beta
Javaexchange.godark:godarkJDK 17+Beta

Choose a client

ClientTransportBest for
GodarkRestClientHTTPS (/api/v1/*)REST-only bots, simpler deployments, matches Place Order semantics
GodarkClientWebSocket (/ws/v1)Low-latency trading, multiplexed order + position streams
MarketDataClientWebSocket (/ws/gomarket)External venue reference data — not GoDark's internal order book

All trading clients handle auth token exchange, ECDH session setup, and order encryption automatically. See Authentication and Encryption & Transport for the underlying protocol.

Environment variables

VariableRequiredDescription
GDX_API_KEY_IDYesAPI key id from onboarding (client_id)
GDX_API_SECRETYesAPI secret (client_secret)
GDX_REST_URLNoREST base URL. Default: https://api.godarkdex.com
GDX_EDGE_URL / GODARK_EDGE_URLNoWebSocket host origin. SDK appends /ws/v1 automatically
GDX_PASSPHRASENoPassphrase if your key requires it (see Authentication)

Local development typically uses GDX_REST_URL=http://127.0.0.1:4000 and GDX_EDGE_URL=ws://127.0.0.1:4000.

Network endpoints

NetworkRESTWebSocket
Mainnethttps://api.godarkdex.com/api/v1wss://api.godarkdex.com/ws/v1
Testnethttps://api.godarkdex-testnet.com/api/v1wss://api.godarkdex-testnet.com/ws/v1
Localnethttp://127.0.0.1:4000/api/v1ws://127.0.0.1:4000/ws/v1

Pass either a bare host (https://api.godarkdex.com) or the full /api/v1 / /ws/v1 path — SDKs normalize both forms.

REST trading flow

Every SDK follows the same sequence for encrypted REST orders:

  1. POST /auth/token — exchange api_key_id + api_secret for a 15-minute bearer token
  2. POST /session/setup — ECDH key exchange; derive AES-256-GCM session key
  3. Encrypted POST /orders, DELETE /orders/{id}, PATCH /orders/{id} — protobuf payloads with GCM AAD

WebSocket clients perform the same auth + session setup over the multiplexed socket before order.place / order.cancel ops.

Error handling

All SDKs expose typed errors that map to Error Codes:

ErrorTypical cause
AuthenticationErrorInvalid or expired credentials (10001006)
SessionErrorECDH / session setup failure
EncryptionErrorEncrypt/decrypt or framing error
OrderErrorRisk rejection or trading error (14101413, 14001407)
TimeoutErrorAwait/poll exceeded deadline
ConnectionErrorNetwork or WebSocket disconnect