Added

v1.13.0 - 2025-12-16

Added

  • New endpoint: PATCH /limit for editing existing limit orders

    • Purpose: Modify price and size of existing orders without canceling and resubmitting
    • Benefits: Atomic updates preserve queue position for unchanged price, reduced latency for order modifications
    • Authentication: Requires EIP-712 signature (one-click sessions not supported)

    Request example (options):

    const editRequest = {
      order_id: "abc123def456...",
      price: 2600.0,           // New price
      contracts: 2.0,          // New size for options
      signature: "0x...",
      signature_deadline: 1735689600
    };
    
    const response = await fetch('/limit', {
      method: 'PATCH',
      headers: {
        'x-apikey': API_KEY,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(editRequest)
    });

    Request example (perpetuals):

    const editRequest = {
      order_id: "abc123def456...",
      price: 98500.0,          // New price
      amount: 15000,           // New size for perpetuals
      signature: "0x...",
      signature_deadline: 1735689600
    };

    Constraints:

    • Order must exist and belong to the signing maker
    • Cannot edit orders during active MMP freeze
    • Must edit within the same market as original order
    • Size must meet minimum increment requirements

    Response: Returns the updated StoredLimitOrder with new values and edit_order event emitted on WebSocket

Changed

  • Correction: WebSocket trade events do not include order metadata

    Trade events contain execution data only. The following fields are not present on trade events:

    • user_id - Use order events for user tracking
    • order_size - Use order events for original order size
    • filled_amount - Use order events for cumulative fill tracking

    Trade event structure (actual):

    {
      "kind": "event",
      "type": "trade",
      "timestamp_ms": 1734355200000,
      "data": {
        "margin_account_id": "550e8400-e29b-41d4-a716-446655440000",
        "smart_account_address": "0x1234567890abcdef1234567890abcdef12345678",
        "trade_id": "1234567890abcdef1234567890abcdef",
        "order_id": "abcdef1234567890abcdef1234567890",
        "size": 1.5,
        "timestamp": 1734355200000,
        "direction": "buy",
        "index_price": 45000.5,
        "instrument_name": "BTC_USDC-31DEC25-100000-C",
        "average_price": 2500.0,
        "limit_price": 2500.0,
        "liquidation": false,
        "iv": 0.65,
        "taker_fee": 0.50,
        "maker_fee": 0.25,
        "systemic_risk_fee": 0.10,
        "liquidation_fee": 0.0,
        "realised_funding": 0.0
      }
    }

    Migration: For order lifecycle metadata including user_id, total order size, and cumulative filled_amount, subscribe to order events (post_order, update_order, cancel_order) via orderbook channels.

  • WebSocket order events now include user_id field

    Order events (post_order, cancel_order, update_order, edit_order) include the user_id field when provided during order submission:

    {
      "kind": "event",
      "type": "post_order",
      "data": {
        "instrument_name": "BTC_USDC-31DEC25-100000-C",
        "order_id": "abc123...",
        "user_id": "trader_001",
        "maker": "0x1234...",
        ...
      }
    }

    Benefits: Track orders across their full lifecycle using your custom identifiers

Fixed

  • POST /limit error messages now match backend validation exactly:
    • Added: "order size not divisible by minimum increment"
    • Fixed: "multiple markets provided" message formatting
  • PATCH /limit error messages aligned with ORDERBOOK_API_ERROR_MESSAGES constants