JavaScript / TypeScript SDK
Encrypted JavaScript and TypeScript client for the GoDark API. Package name: @godark/sdk.
Requirements: Node.js 18+
Status: Beta — contact GoDark for SDK access.
Installation
Public npm release is not yet available. Approved integrators receive distribution instructions directly.
When published:
npm install @godark/sdk
Quickstart
import { GodarkRestClient } from "@godark/sdk";
async function main(): Promise<void> {
const client = new GodarkRestClient({
apiKeyId: process.env.GDX_API_KEY_ID!,
apiSecret: process.env.GDX_API_SECRET!,
});
await client.connect();
await client.placeOrder("BTC-USDC-PERP", "BUY", {
quantity: 0.01,
type: "LIMIT",
price: 95000,
timeInForce: "GTC",
clientOrderId: "my-first-order",
});
await client.disconnect();
}
main().catch(console.error);
See Place Order for all request fields.
Clients
| Class | Description |
|---|---|
GodarkRestClient | REST-only encrypted trading |
GodarkClient | WebSocket trading + streams |
MarketDataClient | External venue feeds |
The package ships ESM, CJS, and TypeScript declarations (dist/index.js, dist/index.d.ts).
GodarkRestClient methods
| Method | Docs reference |
|---|---|
connect() / disconnect() | Authentication, Encryption |
placeOrder(...) | Place Order |
cancelOrder(...) | Cancel Order |
modifyOrder(...) | Modify Order |
getOrder(...) | Get Order |
GodarkClient (WebSocket)
| Capability | Docs reference |
|---|---|
placeOrder, cancelOrder, modifyOrder | WebSocket Trading |
| Order update stream | Orders Channel |
| Position update stream | Positions Channel |
Types
Exported types include OrderAck, OrderUpdate, PositionUpdate, Side, OrderType, TimeInForce, and typed error classes.
Bundled examples
Includes quickstart-docs.ts, full-trader-rest.ts, full-trader-example.ts, local_e2e.mjs, and market-data.ts.