SDKs

Official GoDark client libraries for programmatic trading. Each SDK implements the same public API documented in REST API and WebSocket API. Trading clients authenticate, run a Noise XK handshake, and send AES-GCM encrypted order payloads over WebSocket — see Authentication and Encryption & Transport. REST base URLs remain for auth and account APIs.

Get started

Clone a language examples repo locally. Each repo vendors the SDK (source, wheel, JAR, or static library) so you do not need a private package registry. Add your API key, secret, and passphrase, then run the samples — or point an LLM / coding agent at the cloned repo to build a strategy.

LanguageExamples repoClone
Pythongdx-python-sdk-examplesgit clone https://github.com/gq-godark/gdx-python-sdk-examples.git
Rustgdx-rust-sdk-examplesgit clone https://github.com/gq-godark/gdx-rust-sdk-examples.git
JavaScript / TypeScriptgdx-js-sdk-examplesgit clone https://github.com/gq-godark/gdx-js-sdk-examples.git
C++gdx-cpp-sdk-examplesgit clone https://github.com/gq-godark/gdx-cpp-sdk-examples.git
Gogdx-go-sdk-examplesgit clone https://github.com/gq-godark/gdx-go-sdk-examples.git
Javagdx-java-sdk-examplesgit clone https://github.com/gq-godark/gdx-java-sdk-examples.git

Public package registries (PyPI, npm, crates.io, pkg.go.dev, Maven Central) may be announced later. Until then, the examples repos are the supported way to get the SDKs.

Languages

LanguagePackageRequirementsStatus
PythongodarkPython 3.10+Beta
RustgodarkRust 2021, tokioBeta
JavaScript / TypeScript@godark/sdkNode.js 18+Beta
C++godark headersC++20Beta
Gogithub.com/gq-godark/gdx-go-sdkGo 1.22+Beta
Javavendored godark-*-all.jarJDK 17+Beta

Choose a client

ClientTransportBest for
GodarkClientWebSocket (/ws/v1)Encrypted trading: place / cancel / modify, mass quote, batch cancel, order + position streams
MarketDataClientWebSocket (/ws/gomarket)External venue reference data — not GoDark's internal order book

GodarkClient handles WS login, Noise XK session setup, and order encryption automatically. GodarkRestClient may still be exported for residual HTTP helpers (identity / balance); encrypted order place / cancel / modify is WebSocket-only.

Environment variables

Copy .env.example to .env in the cloned examples repo (Java: examples/.env). Required for public testnet:

VariableRequiredDescription
GODARK_API_KEY_IDYesAPI key id from API Key Management (client_id)
GODARK_API_SECRETYesAPI secret (client_secret)
GODARK_PASSPHRASEYesPassphrase for API key-pair auth
GODARK_EDGE_URLNoOverride edge / WebSocket origin (testnet preset is the default)

Resolution order for each setting: OS GODARK_*, then OS GDX_*, then .env GODARK_*, then .env GDX_*. The process environment always wins over .env in every language, including Java (examples/.env is only used when neither OS alias is set). Language pages use the same order; quickstart snippets show the canonical GODARK_* names.

Create a testnet key: app.godark-dex.com → fund via faucetSettings → API Key Management → Create API Key.

Network endpoints

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

GODARK_EDGE_URL is a WebSocket origin: wss://api.godark-dex.com or wss://…/ws/v1. Helpers append /ws/v1 if missing. They do not strip /api/v1 or rewrite httpswss. REST column URLs are for auth and account APIs, not GodarkClient input.

WebSocket trading flow

Every SDK follows the same sequence for encrypted orders:

  1. Connect to /ws/v1 with GODARK_API_KEY_ID, GODARK_API_SECRET, and GODARK_PASSPHRASE
  2. The SDK sends WebSocket login with that key pair, then runs a Noise XK handshake and derives the AES-256-GCM session key
  3. Subscribe to orders (book confirmation waits on private order updates)
  4. place_order / cancel_order / modify_order (and mass quote / batch cancel) over the multiplexed socket

See WebSocket Trading. Limit prices must stay near the oracle or the venue rejects — see Error Codes.

Error handling

All SDKs expose typed exceptions. WebSocket rejects carry a numeric error_code and a symbolic name — see Error Codes. Names below are the Python/C++/Go/JS/Rust spellings; Java uses GodarkException, SessionException, OrderRejectedException, and similar.

ErrorTypical cause
AuthenticationErrorInvalid credentials or failed WS login
SessionErrorNoise XK handshake or session setup failure
EncryptionErrorEncrypt/decrypt or framing error
OrderErrorVenue risk rejection or trading error (symbolic error_code when present)
TimeoutErrorAwait/poll exceeded deadline
ConnectionErrorNetwork or WebSocket disconnect