Trading Phoenix Perps With the API, SDK and CLI

Phoenix's markets, order books and accounts are all available programmatically, for bots, market makers and AI agents.

By Phoenix ResearchUpdated November 13, 2026

On this page
  1. Tools
  2. What you can build
  3. Stream Solana order book data
  4. What bot builders usually ask
  5. Getting started
  6. Common endpoints
  7. Order types available programmatically
  8. Building a bot responsibly

Tools

ToolUse it forDocs
REST APIMarkets, order books, mark prices, funding history, fills, trader historyAPI
WebSocketStreaming order books, trades and account updatesWebSocket
Rise SDK (TypeScript, Rust)Building orders, deposits, withdrawals and margin calculationsRise SDK
Vulcan CLITrading, streaming markets and running strategies from a terminal or an AI agentCLI

What you can build

  • Trading bots that place limit, post-only, IOC and take-profit/stop-loss orders
  • Market-making strategies, including spline liquidity, which quotes a shaped curve instead of one order per price level
  • Dashboards streaming the order book and funding for every market
  • Agent workflows that trade through the CLI

Stream Solana order book data

Every Phoenix market has a public order book on Solana. Take snapshots with the REST order book endpoint, or stream order book, trade and account updates over the WebSocket.

What bot builders usually ask

NeedWhat Phoenix provides
Real-time price feedsWebSocket streams for order books, trades and accounts; REST mark price per market
Exchange statusThe exchange status endpoint, `GET /v1/view/exchange/status`
Cross and isolated marginBoth. Isolated positions use separate subaccounts with their own liquidation boundary
Liquidation behaviorMarket liquidation can be partial: it must improve account health or fully close the position. See Liquidations
Oracle pricingMark price is the median of an adjusted oracle price, the Phoenix book price and a weighted median of external perp prices
Self-trade handlingChoose Abort, CancelProvide or DecrementTake per order; limit and IOC builders default to CancelProvide
Non-custodial settlementOrders and fills settle on Solana; you sign with your own wallet

Getting started

  1. Read the API overview and pick REST (`https://perp-api.phoenix.trade`) for snapshots or WebSocket (`wss://perp-api.phoenix.trade/v1/ws`) for streams.
  2. Install the Rise SDK (TypeScript or Rust) to build and sign transactions.
  3. Register a trader account, with or without a referral code. See Trader Onboarding.
  4. Start with read-only data (markets, order books, funding) before sending orders.

Common endpoints

TaskEndpoint (docs)
List markets and specs`GET /v1/view/exchange/markets`
Order book snapshot`GET /v1/view/orderbook/{symbol}`
Mark price`GET /v1/market/{symbol}/mark-price`
Funding history`GET /v1/funding/{symbol}/rates`
Funding overview`GET /v1/funding/overview`
Market fills`GET /v1/trades/{symbol}/fills`
Candles`GET /v1/candles/{symbol}`
Trader state, PnL, historyTrader endpoints in the API reference

Order types available programmatically

Market, IOC, FOK, limit, post-only, reduce-only and take-profit/stop-loss orders, plus isolated-margin variants and builders that return a liquidation estimate.

Building a bot responsibly

  • Handle network congestion: transactions can be delayed or fail when Solana is busy.
  • Respect rate limits on public endpoints.
  • Reduce-only orders can only shrink a position, so a bug in exit logic can't flip it to the other side.
  • Each market's minimum order size is in Market Parameters, and account health is available from the trader endpoints.

Questions

Is there a public endpoint for funding rates?

Yes. The API returns funding history per market and a funding overview across markets.

Can I backtest with Phoenix data?

Yes. The API serves candles, fills and market stats history for every market.

Which languages does the SDK support?

TypeScript and Rust.

Can AI agents trade on Phoenix?

Yes. The Vulcan CLI is built for both traders and AI agents.

Is the API free to use?

Most exchange, market and trader read endpoints are public. Routes that need a session use bearer tokens, and trading requires a registered trader account.

Do I need to run a Solana node?

No. You can use any Solana RPC provider to submit transactions.

How do I get historical trades?

Use the market fills endpoint, which returns fills with valid transaction signatures.

Can I attach a builder code to my orders?

Yes. Flight builder codes let apps, bots and agents add a builder fee on top of Phoenix's base fees, paid by the trader on routed orders. See Builder Codes.

What is LiteSVM testing?

The SDK docs include a LiteSVM testing guide for testing Phoenix program integrations locally.