depth
Trading

Place and manage orders

Set your bounds, submit an encrypted order, and confirm the result.

On this page

Open a position

This example requests 20 USDC of long exposure and allocates 5 USDC of additional margin. The wallet must already have a funded Depth balance. Save a unique client nonce before signing so you can resume an interrupted request.

Submit a long
const operation = await depth.trade.submit({
  clientNonce: savedNonce,
  marketId: "SOL-USD",
  direction: "long",
  notional: 20_000_000n,
  margin: 5_000_000n,
  slippageBps: 50,
  maxFee: 20_000n,
  validForSeconds: 60,
});

const { orderId } = await operation.confirm();
const fill = await operation.privateResult();

Slippage is bounded against the oracle reference. maxFee is a USDC amount cap, not a fee rate. Use exactly one of slippageBps or worstPriceE8, and one of validForSeconds or expiresAt.

Match and settle

Arcium compares eligible encrypted quotes and selects the best price within the order’s limits. Maker capacity, margin, oracle bounds, fees, and expiry must all pass. The keeper advances matching and settlement callbacks.

A submitted transaction is not a fill. confirm() succeeds only for a finalized filled order; privateResult() returns the authorized execution details.

Manage exposure

Reduce a position
const reduction = await depth.trade.reduce({
  marketId: "SOL-USD",
  amount: "50%",
  slippageBps: 50,
  maxFee: 20_000n,
  validForSeconds: 60,
});
await reduction.confirm();
Close the remaining position
const closing = await depth.trade.close({
  marketId: "SOL-USD",
  slippageBps: 50,
  maxFee: 20_000n,
  validForSeconds: 60,
});
await closing.confirm();

Use reverse() with a new direction and notional to close the old exposure and open the requested opposite exposure. Reductions and closures still need eligible maker liquidity.

After settlement

Documentation
8 results