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
Tools
| Tool | Use it for | Docs |
|---|---|---|
| REST API | Markets, order books, mark prices, funding history, fills, trader history | API |
| WebSocket | Streaming order books, trades and account updates | WebSocket |
| Rise SDK (TypeScript, Rust) | Building orders, deposits, withdrawals and margin calculations | Rise SDK |
| Vulcan CLI | Trading, streaming markets and running strategies from a terminal or an AI agent | CLI |
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
| Need | What Phoenix provides |
|---|---|
| Real-time price feeds | WebSocket streams for order books, trades and accounts; REST mark price per market |
| Exchange status | The exchange status endpoint, `GET /v1/view/exchange/status` |
| Cross and isolated margin | Both. Isolated positions use separate subaccounts with their own liquidation boundary |
| Liquidation behavior | Market liquidation can be partial: it must improve account health or fully close the position. See Liquidations |
| Oracle pricing | Mark price is the median of an adjusted oracle price, the Phoenix book price and a weighted median of external perp prices |
| Self-trade handling | Choose Abort, CancelProvide or DecrementTake per order; limit and IOC builders default to CancelProvide |
| Non-custodial settlement | Orders and fills settle on Solana; you sign with your own wallet |
Getting started
- 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.
- Install the Rise SDK (TypeScript or Rust) to build and sign transactions.
- Register a trader account, with or without a referral code. See Trader Onboarding.
- Start with read-only data (markets, order books, funding) before sending orders.
Common endpoints
| Task | Endpoint (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, history | Trader 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.