Skip to main content

Building on QuantDesk

This tutorial walks through the V2 crankless execution path using place_order_v2 — the atomic entry point for all trades on QuantDesk V2.
Complete the Developer quickstart first — you need gateway health and Swagger access. You also need a funded Solana wallet on your target cluster (devnet or mainnet).
Limit-order makers must claim a seat before placing orders. This spam-protection gate is enforced on-chain.
1

Initialize your portfolio

Every trader needs a PortfolioAccount PDA before placing orders. Pass subaccount_index (usually 0) and a referrer pubkey (PublicKey.default if none).
If this account already exists for the wallet + subaccount pair, skip to seat claim. Confirm via RPC or GET /api/v2/portfolio after indexing.
2

Claim a market seat

3

Place the order

If the user wallet holds less than ~0.005 SOL, the QuantDesk frontend routes the same instruction through a relayer that deducts fees from relayer_fee_balance on the portfolio.
4

Verify execution

  1. Fetch the transaction signature on your cluster explorer.
  2. Read portfolio state via RPC (portfolio parsing) or GET /api/v2/portfolio.
  3. Compare open orders against GET /api/v2/markets/orderbook/:market for depth context.

V2 execution model (30-second version)

In a single transaction, place_order_v2:
  1. Validates oracle health and portfolio policy (including scoped session keys).
  2. Attempts a JIT institutional fill window when configured.
  3. Matches against the on-chain BST slab (bids and asks red-black trees).
  4. Routes any remainder to the qLP backstop vault.
No off-chain keeper crank is required for core matching — see Reading the order book.

Side encoding

Always confirm against the exported IDL in your environment. Client SDKs may expose friendlier enums that map to these values.

Common program errors

Full HTTP and program error guidance: Errors and rate limits.

Next steps

Portfolio parsing

Decode portfolio bytes from RPC.

Order entry

Terminal UX context for order types.

Copy trading

Social vault mechanics.

Errors & rate limits

HTTP and program error reference.