Java SDK
Encrypted Java client for the GoDark API. Maven coordinates: exchange.godark:godark.
Requirements: JDK 17+
Status: Beta — contact GoDark for SDK access.
Installation
Public Maven Central release is not yet available. Approved integrators receive distribution instructions directly.
When published:
dependencies {
implementation("exchange.godark:godark:0.2.0")
}
Build from source at the SDK root (requires gdx-proto submodule):
./gradlew check
./gradlew shadowJar # build/libs/godark-<version>-all.jar
Quickstart
Set credentials, then place a limit order over encrypted REST:
import godark.GodarkRestClient;
import godark.Types;
public class Quickstart {
public static void main(String[] args) throws Exception {
GodarkRestClient client =
GodarkRestClient.builder()
.apiKeyId(System.getenv("GDX_API_KEY_ID"))
.apiSecret(System.getenv("GDX_API_SECRET"))
.passphrase(System.getenv("GDX_PASSPHRASE"))
.restBaseUrl(GodarkRestClient.resolveRestBaseUrl(System.getenv("GDX_REST_URL")))
.build();
client.connect();
try {
Types.OrderAck ack =
client.placeOrder(
"BTC-USDC-PERP",
"BUY",
"LIMIT",
0.01,
95000.0,
"GTC",
false,
null,
null,
"my-first-order");
System.out.println("placed " + ack.orderId());
} finally {
client.close();
}
}
}
See Place Order for all request fields.
Clients
| Class | Description |
|---|---|
GodarkRestClient | REST-only encrypted trading |
GodarkClient | WebSocket trading + streams |
MarketDataClient | External venue feeds on /ws/gomarket |
Build GodarkRestClient with GodarkRestClient.builder(): .apiKeyId(), .apiSecret(), .passphrase(), .restBaseUrl().
GodarkRestClient methods
| Method | Docs reference |
|---|---|
connect() / close() | Authentication, Encryption |
placeOrder(...) | Place Order |
cancelOrder(orderId, symbol) | Cancel Order |
cancelOrderByClientId(clientOrderId, symbol) | Cancel Order |
modifyOrder(...) | Modify Order |
getOrder(orderId) | Get Order |
getOrderByClientOrderId(clientOrderId) | Get Order |
getMe() / getMyBalance() | Account Info |
awaitTerminalStatus(orderId, timeoutSec, pollIntervalSec) | Poll until terminal order state |
GodarkClient (WebSocket)
| Capability | Docs reference |
|---|---|
placeOrder, cancelOrder, modifyOrder | WebSocket Trading |
| Order and position update handlers | Orders Channel, User Events |
Types and errors
Public API lives in the godark package: Enums, Types, Proto, and exception types (GodarkException, SessionException, OrderRejectedException, EncryptionException, etc.). See Error Codes.
Environment variables accept GDX_* or GODARK_* prefixes. Optional .env at the repository root is loaded by EnvFiles for local samples.
Bundled examples
Gradle tasks under the examples group:
| Task | Description |
|---|---|
runQuickstart | WebSocket: subscribe, place, cancel |
runRestQuickstart | REST: auth + one limit order |
runMarketDataSample | GoMarket orderbook frame |
runTraderFlowSample | WebSocket place, modify, cancel |
./gradlew tasks --group=examples
./gradlew runRestQuickstart