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

ClassDescription
GodarkRestClientREST-only: auth → session setup → encrypted /orders
GodarkClientWebSocket trading + order/position streams on /ws/v1
MarketDataClientExternal venue feeds on /ws/gomarket

GodarkRestClient methods

MethodDocs 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)

CapabilityDocs reference
place_order, cancel_order, modify_orderWebSocket Trading
Order update callbacksOrders Channel
Position update callbacksPositions 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.

See also