V2 API endpoints
QuantDesk’s backend gateway exposes a V2 namespace for aggregated on-chain state and social surfaces. Field-level request and response shapes live in Swagger (/api/docs/); this page explains what each route is for and how to use it safely.
Base path
Legacy
/api/v1 routes are deprecated for new integrations.
Authentication
Portfolio (unified state)
These routes return portfolio state aggregated by the backend gateway (indexed from on-chainPortfolioAccount data). For lowest latency, parse the account buffer directly via RPC.
GET /api/v2/portfolio
Returns the full unified portfolio: balances, positions, and open orders in one payload.
GET /api/v2/portfolio/positions
Positions slice only — useful when you already cache balances elsewhere.
GET /api/v2/portfolio/orders
Open orders slice only — pairs well with the orderbook route for depth context.
[!TIP]
For sub-millisecond on-chain reads, parse the PortfolioAccount buffer directly. See Parsing the PortfolioAccount buffer.
Markets (crankless orderbook)
GET /api/v2/markets/orderbook/:market
Returns global BST depth for a market symbol (for example SOL-PERP).
The gateway tries Redis first for sub-millisecond delivery, then falls back to the
market_orderbooks table if the cache is cold.
Markets (registry SSOT)
Epic 14 adds registry-driven market discovery. Symbols, oracle feeds, leverage caps, and session rules come from one SSOT — not scattered env keys.
See Perpetual market coverage.
Backtesting
Exposes the strategy simulation and backtesting lifecycle under/api/v2/backtest/* routes.
X stream
Epic 16 social ingest — separate from news and market data.
See X stream and social alerts.
Data plane routes
Epic 15 adds backend-facing market data routes backed by the authoritative hub tables.
Use these routes for UI hydration, operational tooling, and reproducible dataset workflows. For live UI refresh, pair
GET /market-stats with the websocket event documented in WebSockets overview.
Social (flex cards and leaderboard)
GET /api/v2/leaderboard
Ranks active Quant Vault leaders by realized P&L from market_maker_vaults.
Query parameters:
vault_address, leader, total_pnl, strategy, and is_active.
When a vault leader has a published flex card, the row may also include:
badges — rank alone is not verification.
Flex cards
Publish and read gate-verified backtest proof cards.
Publish body (conceptual)
Failed gate →
403 DEPLOY_GATE_FAILED. Success → 201 with card payload including badges[].
Referrals
POST /api/v2/referrals/validate
Checks whether assigning a referrer would create a circular loop before you submit an on-chain SetReferrer transaction.
Related
- API overview — integration funnel and resilience posture
- Building on QuantDesk —
place_order_v2on-chain tutorial - Errors and rate limits — V2 hardened program errors
- Unified portfolio architecture — why one PDA matters