Skip to main content
All trading interactions happen via the exchange namespace.

Order Management

spectre_placeOrder

Place a new order. Parameters:
  • market (string): e.g., “BTC-USDC”
  • side (string): “BUY” or “SELL”
  • type (string): “LIMIT”, “MARKET”, “STOP_LIMIT”, “STOP_MARKET”
  • qty (float): Quantity of base asset.
  • price (float, optional): Limit price. Required for LIMIT orders.
  • trigger_price (float, optional): Trigger price. Required for STOP orders.
  • stealth_data (object, optional): Privacy metadata (see Privacy & Security).
Example Request:
Example Response:

spectre_modifyOrder

Atomically modify an existing order. This is faster than Cancel + Replace and maintains priority if the quantity is decreased. Parameters:
  • market (string)
  • order_id (string)
  • new_price (float, optional)
  • new_qty (float, optional)
Example Request:

spectre_cancelOrder

Cancel an open order. Parameters:
  • market (string)
  • order_id (string)

Market Data

spectre_getOrderbook

Get the current snapshot of the orderbook. Parameters:
  • market (string)
Returns:
  • bids: List of [price, qty] tuples.
  • asks: List of [price, qty] tuples.
  • timestamp: Engine timestamp.

Account Data

spectre_getPendingOrders

Get open orders for a specific market. Parameters:
  • market (string)
  • offset (int, default 0): Pagination offset.

spectre_getAllPendingOrders

Get open orders across ALL markets.

spectre_closePosition

Closes an open position. Parameters:
  • position_hash (string): The unique hash of the position to close.
  • type (string): “MARKET” or “LIMIT”.
  • price (float): Required if LIMIT.
  • signature (string): Standard authentication signature.