Python SDK
Encrypted Python client for the GoDark API. Package name: godark.
Requirements: Python 3.10+
Status: Beta — contact GoDark for SDK access.
Installation
Public PyPI release is not yet available. Approved integrators receive distribution instructions directly.
When published:
pip install godark
Quickstart
Set credentials, then place a limit order over encrypted REST:
import asyncio
import os
from godark import GodarkRestClient
async def main() -> None:
async with GodarkRestClient(
api_key_id=os.environ["GDX_API_KEY_ID"],
api_secret=os.environ["GDX_API_SECRET"],
) as client:
ack = await client.place_order(
"BTC-USDC-PERP",
"BUY",
type="LIMIT",
quantity=0.01,
price=95000.0,
time_in_force="GTC",
client_order_id="my-first-order",
)
print("placed", ack.order_id)
asyncio.run(main())
See Place Order for all request fields.
Clients
| Class | Description |
|---|---|
GodarkRestClient | REST-only: auth → session setup → encrypted /orders |
GodarkClient | WebSocket trading + order/position streams on /ws/v1 |
MarketDataClient | External venue feeds on /ws/gomarket |
GodarkRestClient methods
| Method | Docs reference |
|---|---|
connect() / disconnect() | Authentication, Encryption |
place_order(...) | Place Order |
cancel_order(...) | Cancel Order |
cancel_order_by_client_id(...) | Cancel Order |
modify_order(...) | Modify Order |
get_order(...) | Get Order |
get_order_by_client_id(...) | Get Order |
await_terminal_status(...) | Poll until FILLED, CANCELLED, or REJECTED |
GodarkClient (WebSocket)
| Capability | Docs reference |
|---|---|
place_order, cancel_order, modify_order | WebSocket Trading |
| Order update callbacks | Orders Channel |
| Position update callbacks | Positions Channel |
Types and enums
Exported from godark: Side, OrderType, TimeInForce, OrderStatus, OrderAck, OrderUpdate, PositionUpdate, and error classes (AuthenticationError, SessionError, OrderError, etc.).
Bundled examples
The SDK ships runnable examples including quickstart_docs, full_trader_rest, full_trader_example, local_e2e, and market_data.