Order Methods

LP-9002 JSON-RPC order management methods

Order Methods

Methods for placing, cancelling, and querying orders. All order methods require authentication.

lx_placeOrder

Submit a new order to the matching engine.

Parameters

NameTypeRequiredDescription
marketstringYesTrading pair (e.g., "BTC-USDT")
sidestringYesOrder side: "buy" or "sell"
typestringYesOrder type: "limit", "market", "stop_limit", "stop_market"
pricestringConditionalLimit price (required for limit/stop_limit orders)
quantitystringYesOrder quantity in base asset
stopPricestringConditionalTrigger price (required for stop orders)
timeInForcestringNoTime in force: "GTC", "IOC", "FOK", "GTD" (default: "GTC")
postOnlybooleanNoReject if would take liquidity (default: false)
reduceOnlybooleanNoOnly reduce position (default: false)
clientOrderIdstringNoClient-specified order ID (max 36 chars)
expiresAtintegerConditionalExpiration timestamp (required for GTD)

Order Types

TypeDescriptionRequired Fields
limitLimit order at specified priceprice, quantity
marketMarket order at best available pricequantity
stop_limitStop-limit orderprice, quantity, stopPrice
stop_marketStop-market orderquantity, stopPrice

Time in Force

ValueDescription
GTCGood Till Cancelled - remains until filled or cancelled
IOCImmediate Or Cancel - fill what's possible, cancel rest
FOKFill Or Kill - fill entirely or reject completely
GTDGood Till Date - expires at specified timestamp

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_placeOrder",
  "params": {
    "market": "BTC-USDT",
    "side": "buy",
    "type": "limit",
    "price": "42000.00",
    "quantity": "0.5",
    "timeInForce": "GTC",
    "postOnly": true,
    "clientOrderId": "my-order-001"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000",
    "clientOrderId": "my-order-001",
    "market": "BTC-USDT",
    "side": "buy",
    "type": "limit",
    "price": "42000.00",
    "quantity": "0.5",
    "filledQuantity": "0",
    "remainingQuantity": "0.5",
    "status": "open",
    "timeInForce": "GTC",
    "postOnly": true,
    "reduceOnly": false,
    "createdAt": 1702300000000,
    "updatedAt": 1702300000000
  }
}

Order Status Values

StatusDescription
pendingOrder received, awaiting processing
openOrder active in order book
partially_filledPartially executed
filledCompletely executed
cancelledCancelled by user or system
rejectedRejected (insufficient funds, etc.)
expiredExpired (GTD orders)

curl Example

curl -X POST https://api.lux.network/rpc \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -H "X-API-Timestamp: 1702300000000" \
  -H "X-API-Signature: signature_here" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "lx_placeOrder",
    "params": {
      "market": "BTC-USDT",
      "side": "buy",
      "type": "limit",
      "price": "42000.00",
      "quantity": "0.5",
      "timeInForce": "GTC"
    }
  }'

Errors

CodeMessageCause
-32001Market not foundInvalid market symbol
-32002Insufficient balanceNot enough funds
-32010Invalid pricePrice validation failed
-32011Invalid quantityQuantity below minimum
-32012Invalid sideSide must be "buy" or "sell"
-32013Invalid order typeUnsupported order type
-32014Invalid time in forceUnsupported TIF value
-32030Market suspendedTrading is halted

Rate Limit

  • Limit: 50 requests per second
  • Burst: 100 requests

lx_cancelOrder

Cancel an existing open order.

Parameters

NameTypeRequiredDescription
orderIdstringConditionalOrder ID to cancel
clientOrderIdstringConditionalClient order ID to cancel
marketstringNoMarket filter (required with clientOrderId)

One of orderId or clientOrderId must be provided.

Request (by Order ID)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_cancelOrder",
  "params": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000"
  }
}

Request (by Client Order ID)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_cancelOrder",
  "params": {
    "clientOrderId": "my-order-001",
    "market": "BTC-USDT"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000",
    "clientOrderId": "my-order-001",
    "market": "BTC-USDT",
    "side": "buy",
    "type": "limit",
    "price": "42000.00",
    "quantity": "0.5",
    "filledQuantity": "0.1",
    "remainingQuantity": "0.4",
    "status": "cancelled",
    "cancelledAt": 1702300500000
  }
}

curl Example

curl -X POST https://api.lux.network/rpc \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -H "X-API-Timestamp: 1702300000000" \
  -H "X-API-Signature: signature_here" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "lx_cancelOrder",
    "params": {
      "orderId": "550e8400-e29b-41d4-a716-446655440000"
    }
  }'

Errors

CodeMessageCause
-32000Order not foundOrder ID does not exist
-32004Order already cancelledCannot cancel twice
-32005Order already filledCannot cancel filled order
-32023Permission deniedNot your order

Rate Limit

  • Limit: 50 requests per second
  • Burst: 100 requests

lx_cancelAllOrders

Cancel all open orders, optionally filtered by market or side.

Parameters

NameTypeRequiredDescription
marketstringNoCancel only orders for this market
sidestringNoCancel only "buy" or "sell" orders

Request (Cancel All)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_cancelAllOrders",
  "params": {}
}

Request (Cancel by Market)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_cancelAllOrders",
  "params": {
    "market": "BTC-USDT"
  }
}

Request (Cancel by Side)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_cancelAllOrders",
  "params": {
    "market": "BTC-USDT",
    "side": "buy"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "cancelledCount": 5,
    "cancelledOrders": [
      "550e8400-e29b-41d4-a716-446655440000",
      "550e8400-e29b-41d4-a716-446655440001",
      "550e8400-e29b-41d4-a716-446655440002",
      "550e8400-e29b-41d4-a716-446655440003",
      "550e8400-e29b-41d4-a716-446655440004"
    ],
    "failedCount": 0,
    "failedOrders": []
  }
}

curl Example

curl -X POST https://api.lux.network/rpc \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -H "X-API-Timestamp: 1702300000000" \
  -H "X-API-Signature: signature_here" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "lx_cancelAllOrders",
    "params": {
      "market": "BTC-USDT"
    }
  }'

Rate Limit

  • Limit: 10 requests per second
  • Note: This is a heavy operation

lx_getOrder

Get details of a specific order.

Parameters

NameTypeRequiredDescription
orderIdstringConditionalOrder ID
clientOrderIdstringConditionalClient order ID
marketstringNoMarket (required with clientOrderId)

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_getOrder",
  "params": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000",
    "clientOrderId": "my-order-001",
    "market": "BTC-USDT",
    "side": "buy",
    "type": "limit",
    "price": "42000.00",
    "avgPrice": "41998.50",
    "quantity": "0.5",
    "filledQuantity": "0.3",
    "remainingQuantity": "0.2",
    "filledValue": "12599.55",
    "fee": "6.30",
    "feeAsset": "USDT",
    "status": "partially_filled",
    "timeInForce": "GTC",
    "postOnly": true,
    "reduceOnly": false,
    "createdAt": 1702300000000,
    "updatedAt": 1702300500000,
    "fills": [
      {
        "tradeId": "660e8400-e29b-41d4-a716-446655440100",
        "price": "41998.50",
        "quantity": "0.3",
        "fee": "6.30",
        "feeAsset": "USDT",
        "timestamp": 1702300500000,
        "role": "maker"
      }
    ]
  }
}

Fill Object

FieldTypeDescription
tradeIdstringTrade identifier
pricestringExecution price
quantitystringFilled quantity
feestringFee amount
feeAssetstringFee currency
timestampintegerExecution timestamp (ms)
rolestring"maker" or "taker"

curl Example

curl -X POST https://api.lux.network/rpc \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -H "X-API-Timestamp: 1702300000000" \
  -H "X-API-Signature: signature_here" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "lx_getOrder",
    "params": {
      "orderId": "550e8400-e29b-41d4-a716-446655440000"
    }
  }'

Errors

CodeMessageCause
-32000Order not foundOrder ID does not exist
-32023Permission deniedNot your order

Rate Limit

  • Limit: 50 requests per second

lx_getOrders

Get list of orders with filtering and pagination.

Parameters

NameTypeRequiredDescription
marketstringNoFilter by market
statusstring | arrayNoFilter by status(es)
sidestringNoFilter by "buy" or "sell"
typestringNoFilter by order type
startTimeintegerNoStart timestamp (ms)
endTimeintegerNoEnd timestamp (ms)
limitintegerNoMax results (default: 100, max: 500)
offsetintegerNoPagination offset (default: 0)
orderBystringNoSort: "createdAt" or "updatedAt"
orderDirstringNoDirection: "asc" or "desc" (default)

Request (Open Orders)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_getOrders",
  "params": {
    "status": ["open", "partially_filled"],
    "market": "BTC-USDT",
    "limit": 50
  }
}

Request (Order History)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_getOrders",
  "params": {
    "status": ["filled", "cancelled"],
    "startTime": 1702200000000,
    "endTime": 1702300000000,
    "limit": 100,
    "orderDir": "desc"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "orders": [
      {
        "orderId": "550e8400-e29b-41d4-a716-446655440000",
        "clientOrderId": "my-order-001",
        "market": "BTC-USDT",
        "side": "buy",
        "type": "limit",
        "price": "42000.00",
        "quantity": "0.5",
        "filledQuantity": "0",
        "remainingQuantity": "0.5",
        "status": "open",
        "timeInForce": "GTC",
        "createdAt": 1702300000000,
        "updatedAt": 1702300000000
      },
      {
        "orderId": "550e8400-e29b-41d4-a716-446655440001",
        "market": "BTC-USDT",
        "side": "sell",
        "type": "limit",
        "price": "43000.00",
        "quantity": "0.25",
        "filledQuantity": "0.1",
        "remainingQuantity": "0.15",
        "status": "partially_filled",
        "timeInForce": "GTC",
        "createdAt": 1702299000000,
        "updatedAt": 1702300500000
      }
    ],
    "total": 25,
    "limit": 50,
    "offset": 0,
    "hasMore": false
  }
}

curl Example

curl -X POST https://api.lux.network/rpc \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -H "X-API-Timestamp: 1702300000000" \
  -H "X-API-Signature: signature_here" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "lx_getOrders",
    "params": {
      "status": ["open", "partially_filled"],
      "limit": 100
    }
  }'

Rate Limit

  • Limit: 20 requests per second

lx_amendOrder

Modify an existing open order (price and/or quantity).

Parameters

NameTypeRequiredDescription
orderIdstringConditionalOrder ID to amend
clientOrderIdstringConditionalClient order ID to amend
marketstringNoMarket (required with clientOrderId)
pricestringNoNew price
quantitystringNoNew quantity

At least one of price or quantity must be provided.

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "lx_amendOrder",
  "params": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000",
    "price": "42500.00",
    "quantity": "0.6"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000",
    "clientOrderId": "my-order-001",
    "market": "BTC-USDT",
    "side": "buy",
    "type": "limit",
    "price": "42500.00",
    "quantity": "0.6",
    "filledQuantity": "0",
    "remainingQuantity": "0.6",
    "status": "open",
    "timeInForce": "GTC",
    "createdAt": 1702300000000,
    "updatedAt": 1702300600000,
    "amendments": 1
  }
}

curl Example

curl -X POST https://api.lux.network/rpc \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -H "X-API-Timestamp: 1702300000000" \
  -H "X-API-Signature: signature_here" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "lx_amendOrder",
    "params": {
      "orderId": "550e8400-e29b-41d4-a716-446655440000",
      "price": "42500.00"
    }
  }'

Errors

CodeMessageCause
-32000Order not foundOrder does not exist
-32003Invalid orderCannot amend (filled/cancelled)
-32010Invalid pricePrice validation failed
-32011Invalid quantityQuantity validation failed
-32023Permission deniedNot your order

Rate Limit

  • Limit: 50 requests per second
  • Note: Counts against order placement limits

OpenRPC Schema Reference

{
  "name": "lx_placeOrder",
  "summary": "Place a new order",
  "params": [
    {
      "name": "market",
      "required": true,
      "schema": {"type": "string", "pattern": "^[A-Z]+-[A-Z]+$"}
    },
    {
      "name": "side",
      "required": true,
      "schema": {"type": "string", "enum": ["buy", "sell"]}
    },
    {
      "name": "type",
      "required": true,
      "schema": {"type": "string", "enum": ["limit", "market", "stop_limit", "stop_market"]}
    },
    {
      "name": "price",
      "required": false,
      "schema": {"type": "string", "pattern": "^[0-9]+\\.?[0-9]*$"}
    },
    {
      "name": "quantity",
      "required": true,
      "schema": {"type": "string", "pattern": "^[0-9]+\\.?[0-9]*$"}
    },
    {
      "name": "timeInForce",
      "required": false,
      "schema": {"type": "string", "enum": ["GTC", "IOC", "FOK", "GTD"], "default": "GTC"}
    },
    {
      "name": "postOnly",
      "required": false,
      "schema": {"type": "boolean", "default": false}
    },
    {
      "name": "clientOrderId",
      "required": false,
      "schema": {"type": "string", "maxLength": 36}
    }
  ],
  "result": {
    "name": "OrderResult",
    "schema": {
      "type": "object",
      "properties": {
        "orderId": {"type": "string", "format": "uuid"},
        "status": {"type": "string"},
        "createdAt": {"type": "integer"}
      }
    }
  }
}