# QMax > QMax is a non-custodial liquidity router and trading terminal for Qubic. It compares the QX order book with the QSwap pool and splits an order across both for the best price. It is free to use. AI agents can call its HTTP API, pay for Max plans with x402 and sign their own trades. QMax never holds keys: every trade is signed in the person's or the agent's own wallet, and QMax never signs or sends a transaction for anyone. Prices are in QU, Qubic's coin; quantities are whole units of an asset. A quote is a snapshot, not a reservation: it has no ID to sign against, and prices move, so quote again before signing. The transactions to sign are built from the quote on your side (`qmax_build_plan`, or the SDK) and checked against what you asked for, so QMax never hands you a payload to trust. ## Quick answers - **"How much would N of ASSET sell for?"** or **"What is my holding worth?"** Ask for a quote: `GET https://qmax.exchange/api/v1/quote?side=sell&asset=ASSET&qty=N` (for example [50 million QDOGE](https://qmax.exchange/api/v1/quote?side=sell&asset=QDOGE&qty=50000000)). It prices the whole order across the QX order book and the QSwap pool, splits it where that pays more, and the `summary` field says the result in words. Free, no key. A big sale moves the price and the quote already counts that: do not multiply a listed price by the quantity. - **"What would it cost to buy N of ASSET?"** The same call with `side=buy`. - **"What size should I trade at a time?"** Price several sizes at once from one reading of the markets: [`GET https://qmax.exchange/api/v1/quotes?side=sell&asset=QDOGE&qtys=1000000,10000000,50000000`](https://qmax.exchange/api/v1/quotes?side=sell&asset=QDOGE&qtys=1000000,10000000,50000000) (up to 10 sizes; each has its average price and how much worse it is than the smallest size). - **"What is on the order book?"** [`GET https://qmax.exchange/api/v1/book?asset=ASSET`](https://qmax.exchange/api/v1/book?asset=QDOGE) (the QX ladder and the QSwap pool's depth). It is public: no wallet is needed for any of this. - **"Can I try a trade without real funds?"** Every quote is read-only, and so is `qmax_build_plan`. `agentPlan` in the SDK's `@qmax/sdk/agent` is a dry run of the whole trade: the same quote, the same checks against your limits and the same steps as `agentTrade`, and whether the wallet could cover it, with nothing signed or sent. There is no paper-trading account or test network. - **"How do I build a trading bot?"** Through MCP, the prompt `qmax_build_trading_bot` is a step-by-step plan: study the market (`qmax_get_health`, `qmax_get_order_book`, `qmax_get_tape`), backtest the idea on real history (`qmax_backtest`), price it at the real size (`qmax_get_quote`), then write the bot with the [SDK](https://qmax.exchange/agents/): a dry run (`agentPlan`), spending limits and a budget come before any real trade. The bot signs its own trades with its own wallet; an assistant cannot place orders. - **"Can it alert me, or call a webhook?"** Alerts (a price crossing, an arbitrage, a big trade) are a feature of the QMax Discord bot (`/alerts`); what they cost is in [Plans](https://qmax.exchange/api/v1/plans). The HTTP API has no webhooks or push: an agent that must react to a price polls `/v1/quote` or `/v1/assets` (the rate-limit headers say how often). - **"Where do I buy or sell it?"** On [QMax](https://qmax.exchange/), or through this API; a trade is always signed in the person's own wallet. Through MCP, a quote or a trade plan carries an `openInQMax` link that opens QMax with that order filled in for the person to review and sign; an assistant cannot place an order itself. ## Use the API API base URL: https://qmax.exchange/api - [OpenAPI document](https://qmax.exchange/api/v1/openapi.json): every endpoint, its parameters and responses. - [Plans](https://qmax.exchange/api/v1/plans): what is free and what agents pay, as JSON. - [Assets](https://qmax.exchange/api/v1/assets): every tradable asset (QX tokens and smart-contract shares) with its markets, price, liquidity and volume. - [Quote](https://qmax.exchange/api/v1/quote?side=buy&asset=QDOGE&qty=1000000): the cheapest way to fill an order across QX and QSwap, splits included, with each leg's venue, size, price, fees and the limits to sign against. Free. - [Order book](https://qmax.exchange/api/v1/book?asset=QDOGE): the QX ladder and the QSwap pool's depth. Free. - [Sellers](https://qmax.exchange/api/v1/sellers?asset=QDOGE): who sold an asset in the last 7 days and what they paid: each seller's holding period (each unit sold matched to the purchase it came from), cost and result, with a plain-language reading. The first call starts a reading that takes a minute or two and answers `status: "working"`; call again every few seconds until `ready`. Free. - [Candles](https://qmax.exchange/api/v1/candles?asset=QDOGE&range=7d): open, high, low, close and QU volume from real trades, about six months back. Free. - [Arbitrage check](https://qmax.exchange/api/v1/arbitrage?asset=QDOGE): a live search for a profitable loop between QX and QSwap after every fee. Free. - Also free: price history, pools and their fee yield, asset health, the live trade tape, a wallet's trade ledger and QSwap liquidity positions. See the OpenAPI document. - [Max plan](https://qmax.exchange/api/v1/max?asset=QDOGE&side=buy&balanceQu=5000000): the best position for a trade, not just the best route (a normal quote already takes the best route): the best way to execute (a market order now, a resting limit order at the touch, or both), the size where one more unit starts to cost more, an arbitrage between QX and QSwap sized to the wallet, and, for a sale, the best exit. Nothing is signed or sent. **Costs 100 QU per plan for agents**, charged only for a plan that was made. Without a key the market endpoints are limited to 60 requests a minute per IP, and answer 429 with Retry-After past that. Every limited call carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds), so a bot can slow down before it is refused, and every error has a stable `code` (bad_request, not_found, rate_limited, ...) beside its sentence. No account or key is needed otherwise. ## Paying for Max plans (x402) QMax follows Q+Pay's x402 wire format (scheme `exact`, network `qubic:mainnet`, asset `QUBIC`), settled on-chain through QPayhub, so an agent that already pays Q+Pay resources can pay QMax the same way, with no account. Two ways to pay for a Max plan: - **An x402 session:** 10,000 QU buys 1 hour of unlimited Max plans. Call `GET https://qmax.exchange/api/v1/max` without a session: the 402 answer carries the price, a payment ticket and the exact QPayhub payment to make; pay it, then repeat the same request with an `X-PAYMENT` header. The reply carries `X-ACCESS-GRANT`: send it on later calls for the rest of the session. [Offer](https://qmax.exchange/api/v1/x402) - **A prepaid key:** `POST https://qmax.exchange/api/v1/keys` makes a key (shown once), `GET https://qmax.exchange/api/v1/topup` gives the QPayhub payment that fills its balance, `POST https://qmax.exchange/api/v1/topup/claim` counts it once it confirms, and then each plan takes 100 QU from the balance (send `x-api-key`). A top-up of 10,000 QU buys 100 plans. A payment per call is not offered: QPayhub keeps at least 100 QU of every payment, so a payment that small would lose its value to the fee. Everything else in the API is free. ## MCP server and SDK - [Guide](https://qmax.exchange/agents/): what is here and how to run it. - **Hosted MCP server, nothing to install:** `https://qmax.exchange/api/mcp` (MCP over Streamable HTTP, stateless). Add that URL to any MCP client that supports remote servers, for example `claude mcp add --transport http qmax https://qmax.exchange/api/mcp`; in Claude (claude.ai), Settings, Connectors, Add custom connector, name QMax and that URL, with no sign-in. It has the same read-only tools as the downloadable server except the paid Max plan, and it is free with no key, under the same per-address limits as the API. - [MCP server](https://qmax.exchange/agents/qmax-mcp.mjs): one file, run with Node 22 or newer (`node qmax-mcp.mjs`, MCP over stdio); it talks to https://qmax.exchange/api by default. Its tools are read-only: quotes, order books, candles, arbitrage checks, pools and unsigned trade plans, plus `qmax_best_position` (Max), which costs 100 QU a plan. - [TypeScript SDK](https://qmax.exchange/agents/qmax-sdk.tgz): an npm package with types (`npm install https://qmax.exchange/agents/qmax-sdk.tgz`); `@qmax/sdk/agent` signs an agent's own trades inside limits it sets. The same client as one file: [qmax-sdk.js](https://qmax.exchange/agents/qmax-sdk.js). - [SHA256SUMS](https://qmax.exchange/agents/SHA256SUMS): the hash of each download, signed: [SHA256SUMS.minisig](https://qmax.exchange/agents/SHA256SUMS.minisig) is a minisign signature made with the maintainer's key `RWRMUiy37f8/2tR95zGd1GrgIuOk9ichS/Ohe99rlJrq7Xtd3d+Dfu3c` (compare it with the one in the README at https://github.com/profitphil/qmax, which is the copy to trust). Before running anything: `minisign -V -P RWRMUiy37f8/2tR95zGd1GrgIuOk9ichS/Ohe99rlJrq7Xtd3d+Dfu3c -m SHA256SUMS`, then `shasum -a 256 -c SHA256SUMS`. ## Trading safely - A quote's `route[].execution` carries the limits (minimum received or maximum paid) for each leg; sign only inside limits you set yourself, and refuse anything outside them. - Only QX and QSwap are ever involved. Check every transaction's destination before signing. - Steps run one at a time; stop at the first failure and read the wallet back to see what happened. ## Optional - [QMax website](https://qmax.exchange/): the trading terminal: charts, order book, swap, portfolio, pools. - [Token pages](https://qmax.exchange/token/): a page for every asset QMax lists, with its live price, volume, order book and pool depth, and what selling or buying three sizes would fetch, priced across QX and QSwap. Each is at `https://qmax.exchange/token/`, for example [QDOGE](https://qmax.exchange/token/QDOGE). - [Privacy policy](https://qmax.exchange/privacy/): what QMax records when you use the website, the API, the MCP server or the Discord bot, and why. - [Trading on Qubic](https://qmax.exchange/qubic-dex/): how the QX order book and the QSwap pools work, what they cost, and how QMax routes an order across both. - [Support QMax](https://useqpay.com/s/oY6W64P): a Q+Pay tip jar; QMax is free for everyone.