Edit limit orders

Edit one or more existing limit orders on the orderbook. Can modify the size and/or price of options or perpetual futures orders.

Important: Editing creates a new order. The original order is cancelled and a new order is created with a new order_id (derived from the new signature). The old order_id is discarded. Internally this emits a CancelOrder event for the old order followed by a PostOrder event for the new order. Clients tracking orders by ID must update their references to the new order_id returned in the response.

Authentication:

  • Signature: Include signature and signature_deadline fields in each edit request (both required)
  • One-click sessions are NOT supported for editing orders

Important Constraints:

  • All orders being edited must belong to the same maker
  • All orders being edited must be for the same market (BTC, ETH, or ARB)
  • MMP (Market Maker Protection) must NOT be active for the maker/market pair
  • Orders currently being filled (inflight) cannot be edited
  • Post-only orders cannot be edited to a price that would cross the market (rejected with post only violation)
  • Non-post-only orders edited to a crossing price will trigger immediate matching against resting orders (IOC-style fill). The edited order's filled_amount resets to 0 and the new size is used for matching.
  • Wash trading: Edited orders that would cross the maker's own resting orders are rejected with wash trading violation
  • Self-crossing: If multiple edits in the same batch would cross each other, they are rejected with self crossing orders submitted
  • Minimum size requirements still apply after editing
  • Each order_id must be unique in the batch (no duplicate order ids)
  • Price Increment: New price must be divisible by the minimum price increment for the base asset (see GET /api/v1/exchange_infoorderConstraints.priceIncrements)
  • Size Increment: New size in contracts (canonical for both options and perpetuals; or the legacy amount for perpetuals) must meet the per-asset minimum and be a whole multiple of the size increment (see GET /api/v1/exchange_infoorderConstraints.options.sizeIncrements or orderConstraints.perpetuals.sizeIncrements)

EIP-712 Signature Example (TypeScript)

import { parseUnits } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';

// Domain parameters for EIP-712 signature
const EIP712Domain = {
  chainId: 421614, // Arbitrum Sepolia (use 42161 for Arbitrum One mainnet)
  name: 'Premia',
  verifyingContract: '0x...', // ClearingHouseProxy address from deployment
  version: '1'
};

// Type definition for editing limit orders
const UserEditOrder = [
  { name: 'deadline', type: 'uint256' },
  { name: 'size', type: 'uint256' },
  { name: 'price', type: 'uint256' },
  { name: 'orderId', type: 'string' }
];

// Example edit request (Options)
const optionsEdit = {
  order_id: 'abc123def456789012345678901234567',
  contracts: 2.5,  // New size
  price: 1100.0    // New price
};

// Example edit request (Perpetuals)
const perpsEdit = {
  order_id: 'abc123def456789012345678901234567',
  contracts: 0.3,  // New size in base contracts
  price: 46000     // New price
};

// Calculate deadline (30 seconds from now)
const deadline = Math.floor(Date.now() / 1000) + 30;

// Setup wallet
const account = privateKeyToAccount('0xYourPrivateKey');

// Choose which edit to use
const edit = optionsEdit; // or perpsEdit for perpetuals

// Sign the typed data
const signature = await account.signTypedData({
  domain: EIP712Domain,
  types: { UserEditOrder },
  primaryType: 'UserEditOrder',
  message: {
    deadline,
    size: parseUnits((edit.contracts ?? edit.amount).toString(), 6),
    price: parseUnits(edit.price.toString(), 6),
    orderId: edit.order_id
  }
});

// Final request payload
const requestPayload = [{
  ...edit,
  signature,
  signature_deadline: deadline
}];
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

Request to edit an existing options limit order. Requires EIP-712 signature using UserEditOrder type.

string
required
^[a-f0-9]{32}$

The unique identifier of the order to edit

double
required
≥ 0.000001

New number of option contracts

double
required
≥ 0.000001

New limit price

string
required
^0x[a-fA-F0-9]{130}$

EIP-712 signature using UserEditOrder type

int64
required
1704067200 to 2019686400

Signature deadline in Unix seconds

Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json