> ## 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.

# QFEX agent SDK

> Trade QFEX perpetuals on stocks, indices, FX and commodities from a connected QFEX account.

`agent.qfex` trades QFEX perpetuals from the QFEX account the session was started with. QFEX lists perpetuals on stocks, indices, FX, commodities and pre-IPO companies, margined in USDC. Orders and order reads require a hosted target or a paper session; local `circuit run` rejects them. Ask Circuit deposits USDC on Arbitrum One to a connected QFEX account and withdraws USDC from it to the account's registered Arbitrum One address; agents neither deposit nor withdraw.

`agent.data.markets({ venue: "qfex" })` lists QFEX markets with the symbol orders take (such as `AAPL-USD`), their order rules, maximum leverage, price and funding rate.

`orders.create(order, options?)` takes the [perp order shape every venue shares](https://docs.circuit.org/agent-developers/sdk-reference/hyperliquid.md): `{ kind: "perpOpen", asset, side: "long" | "short", amount, execution? }` or `{ kind: "perpReduce", asset, amount, execution? }`, with `amount` `{ size }` in contracts or `{ value }` in USDC notional. Omit `execution` for a market order, sent as an ioc limit within the slippage of the mid; `{ kind: "limit", price, timeInForce }` rests per timeInForce ("gtc" rests, "ioc" fills what crosses now, "alo" is post-only). Each order uses the leverage the QFEX account already holds for that market; Circuit never changes it. Positions appear in `agent.allocation` as perp holdings on network `qfex`. `agent.orders.listOpen({ venue: "qfex" })` returns the session's resting orders, and `orders.cancel({ orderId, asset }, options?)` cancels one the session placed.

## Connect a credential

Under **Wallets → Add wallet → Connect QFEX**, pick one of your EVM wallets and accept QFEX's terms. Circuit signs QFEX's message with that wallet under your passkey, creates the wallet's QFEX account, and seals its key; you never see or paste one, and connecting the same wallet again keeps the existing account and key. A Solana or Polymarket Deposit Wallet can't hold a QFEX account. From the CLI, `circuit exchange connect --venue qfex --wallet <id>` prints QFEX's terms, and `--accept-terms` signs them with that wallet and creates the account. Declare the venue under [`exchangeCredentials`](../getting-started/circuit-toml-reference#exchangecredentials-section), then pass the account ID from `circuit exchange list` as `--exchange-credential <id>` with a hosted target.


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