> ## Documentation Index
> Fetch the complete documentation index at: https://docs.circuit.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Derive trading agent SDK

> Circuit SDK reference for Derive agents: perp, option and spot orders, risk universes, deposits, withdrawals and vault requests.

Derive settles on Ethereum. A Derive account is the wallet's set of subaccounts, one per risk universe: `PRIME` trades BTC and ETH, `MIDCAP` HYPE, `ALT` the other altcoins and `RWA` XAUT. Collateral is named `UNIVERSE.ASSET` on network `derive`, such as `PRIME.USDC` or `ALT.SOL`, and margins only the universe that holds it. Every order and fund move acts from the wallet's oldest subaccount in its universe; holdings count every subaccount.

`agent.derive.orders.create` takes the [Hyperliquid order proposals](https://docs.circuit.org/agent-developers/sdk-reference/hyperliquid.md) `perpOpen`, `perpReduce`, `spotBuy` and `spotSell`, plus `optionBuy` and `optionSell`. A perp `asset` is the base currency, such as `ETH` for `ETH-PERP`; a spot `asset` is the pair, such as `WSTETH-USDC`; an option `asset` is the instrument, such as `ETH-20261225-4000-C`, with `amount: { size }` in contracts and an optional limit price that is the premium per contract in USDC. List perps and spot pairs with [`data.markets({ venue: "derive" })`](./data). `derive.options.list({ currency })` lists the live option chain for an underlying such as `ETH`, each with expiry, strike, call or put and size steps; add `expiry: "YYYY-MM-DD"` to quote one expiry's mark, book, implied volatility and greeks. Derive groups no orders, so `perpOpen` takes no `takeProfit` or `stopLoss`: place a `takeProfit` or `stopLoss` order separately. Preparation rounds sizes down to the instrument's amount step and prices to its tick, refuses sizes below the instrument minimum with `BELOW_MINIMUM`, and signs a fee cap of three times the taker fee. Results follow the [Hyperliquid order results](https://docs.circuit.org/agent-developers/sdk-reference/hyperliquid.md), with `orderId` the order's signed action nonce. `derive.orders.listOpen()` returns the session's resting orders and `derive.orders.cancel({ orderId })` cancels one, or every resting order with `"all"`.

A [swap](https://docs.circuit.org/agent-developers/sdk-reference/swap.md) into Derive collateral deposits it: Ethereum tokens go straight to Derive's ActionManager, creating the universe's subaccount on the first deposit, and other sources bridge to Ethereum first. Derive credits only deposits worth at least its minimum, about $5, and Circuit refuses smaller ones because Derive keeps them. A swap between two universes' collateral, such as `PRIME.USDC` to `ALT.USDC`, moves it between subaccounts, and a swap to the Ethereum token withdraws it. A [send](https://docs.circuit.org/agent-developers/sdk-reference/transfers.md) of Derive collateral moves it to another wallet's subaccount in the same universe, and pays Derive's subaccount fee, about $1 in the sent asset, when the recipient has no subaccount there yet. Before the first order, Circuit registers a read-only session key derived from the wallet's signature, through a reviewed `accountSetup` with `venue: "derive"`; it can never trade, transfer or withdraw. `derive.vaults.list()` lists Derive's vaults with their deposit asset, NAV and share price, and `derive.vaults.request({ kind: "deposit", vault, amount })`, `{ kind: "withdraw", vault, shares }` and `{ kind: "cancel", vault }` queue a vault request that the vault's curator settles later; settled shares appear in holdings at the vault's share price.

Perp holdings use `kind: "perp"` with the same fields as Hyperliquid, margined in the universe's USDC; option and spot holdings follow the wallet's indexed Derive balances.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.