> For the complete documentation index, see [llms.txt](https://quant-fun.gitbook.io/quant.fun-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quant-fun.gitbook.io/quant.fun-docs/for-funds-quant.fun-trades-api/about-api-execution.md).

# About API Execution

The [QuantFun Client API](https://api.quant.fun) is the trading execution layer for quant strategies running on Hyperliquid. It exposes a small set of authenticated REST endpoints that allow strategy services to:

* Submit rebalancing instructions — specify target portfolio allocations (market, direction, size, leverage) and the API will calculate the required delta trades and execute them on Hyperliquid on behalf of the vault.
* Query vault state — retrieve live equity, open positions, pending withdrawals, and account health.
* Track execution status — each submission returns a transaction ID that can be polled for completion.

#### Key Concepts

Vaults — Each vault is an isolated trading account on Hyperliquid. Clients simply send a vaultName (e.g. my-fund-mainnet) to identify the vault in every request.

Portfolio Allocation — Positions are specified as a fraction of vault equity combined with a leverage multiplier. For example, portfolioAllocation: 0.5 with leverage: 4 targets a notional position of 2× equity (50% of equity used as margin at 4× leverage).

Delta Trading — The API computes the difference between the current position and the target, then trades only the delta. Sending the same allocation twice is safe — if the position is already correct (within small tolerance) it is skipped.

Maker-first Execution — Orders are first attempted as post-only (ALO) limit orders, minimising taker fees.

Async Execution — Trade submission returns immediately with a transactionId. Execution runs in the background. Poll the transaction status endpoint to confirm completion.

Authentication — All requests must be authenticated via a JWT Bearer token obtained from the Cognito OAuth2 token endpoint (<https://auth.quant.fun/oauth2/token>) using the client's vault-specific access keys.
