API reference
Streams.
Every frame of the account stream and of market data, with every field, as the AsyncAPI document describes them. How to use them: the Streams guide.
Account stream
wss://api.phoenixperpsfunding.com/v1/streamwss://sandbox-api.phoenixperpsfunding.com/v1/stream
Orders, fills, positions, strategies and live risk of your accounts as they change: a snapshot of each account, then every event once, with resume.
What the server sends
type: hello
First, on every connection: the accounts your key reaches.
-
The frame.
One of
hello -
This connection.
-
The environment of the host you called.
One of
livesandbox -
How often a heartbeat comes.
-
Account numbers.
type: snapshot
An account as it stands, once per account you subscribe to: build your state from it.
-
The frame.
One of
snapshot -
The account number.
-
Its working orders.
Show 26 fields
-
The order.
-
Your own id for it, when it was placed through the API.
-
The account number.
-
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
The order's side; null for an order placed elsewhere before the API saw it.
One of
buysell -
The order's type.
One of
marketlimitstop_marketstop_limittake_markettake_limit -
unconfirmed: the engine has not confirmed its last state yet.
One of
pendingworkingfilledcanceledrejectedexpiredunconfirmed -
The size, in the base asset.
-
How much filled.
-
Its limit price.
-
Its trigger price.
-
The average fill price.
-
The fee its fill paid.
-
It may only reduce a position; null when not known (placed elsewhere).
-
How long it rests.
One of
gtcgtdiocfok -
A gtd order: when it expires (it ends expired then); null otherwise.
-
It may only rest, never fill at once; null when not known (placed elsewhere).
-
Where it was placed: this API, an AI assistant (the MCP server), a trading platform, a strategy, a TradingView alert, or the system (a liquidation).
One of
apimcpplatformstrategytradingviewsystem -
The strategy that placed it (source strategy).
-
Exits attached to it (orders placed through the API).
-
Why it was canceled.
One of
usercancel_allflattenclose_allposition_closedposition_reversedclose_assistocoreplacedstrategykey_loss_stoprisk_rulesystem_restartexternal -
When it was placed.
-
When it filled.
-
When it was canceled.
-
updated_atinteger, Unix ms or nullIts latest change.
-
-
Its open positions.
Show 18 fields
-
This position, while it stays open on the same side.
-
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
Long or short.
One of
longshort -
The size, in the base asset.
-
The average entry price.
-
The market price it is valued at.
-
Its value at that price.
-
Its open P&L.
-
Its leverage.
-
Its margin mode.
One of
isolatedcross -
The margin it took at entry.
-
Margin you added to it.
-
What it holds of the balance.
-
Show 3 fields
-
The price at which it is liquidated; null when there is none or it depends on several positions.
-
How far the market price is from it, in percent.
-
Cross margin on several markets: no single price, every one of them moves it.
-
-
Show 2 fields
-
The price at which this position alone would breach the daily loss limit.
-
The price at which it alone would breach the max drawdown.
-
-
Show 2 fields
-
Limit orders on the closing side.
-
Stop orders on the closing side.
-
-
At least one stop loss rests on it.
-
When it opened.
-
-
The live risk; null while the account is being opened.
Show 19 fields
-
When the oldest figure here was read.
-
Some figures are older than usual (the engine was busy).
-
The balance.
-
The balance plus the open P&L at the market price.
-
The open P&L.
-
The equity change since midnight New York, open positions included: what the daily loss rule counts.
-
The P&L closed today.
-
The fees paid today.
-
Trades closed today.
-
The margin your positions hold.
-
What is left of the balance for new positions.
-
Show 5 fields
-
The value of every open position.
-
The value of the long ones.
-
The value of the short ones.
-
Gross exposure over equity.
-
Per market, largest first.
Show 5 fields
-
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
The value held on it.
-
That value over equity.
-
The exposure cap of the market.
-
How much of the cap is used, counting your other accounts on the same rule, in percent.
-
-
-
A loss limit and the room left to it.
Show 10 fields
-
limitdecimal stringThe limit, in USD.
-
floordecimal stringThe equity at which it is breached.
-
roomdecimal stringHow much more the account may lose before it.
-
used_pctdecimal string or nullHow much of it is used, in percent.
-
resets_atinteger, Unix msDaily loss only: when it resets (midnight New York).
-
on_breachstringDaily loss only: what happens when it is reached.
One of
fail_accountflattenflatten_and_pause -
estimatedbooleanDaily loss only: the day's start is estimated (the engine does not publish it).
-
modestringMax drawdown only: how the reference moves.
One of
end_of_dayend_of_tradestaticintraday_equity -
at_leastbooleanMax drawdown only: the engine may hold a higher floor than shown (it follows equity highs).
-
The rule no longer applies this limit (its cut-off was reached).
-
-
A loss limit and the room left to it.
Show 10 fields
-
limitdecimal stringThe limit, in USD.
-
floordecimal stringThe equity at which it is breached.
-
roomdecimal stringHow much more the account may lose before it.
-
used_pctdecimal string or nullHow much of it is used, in percent.
-
resets_atinteger, Unix msDaily loss only: when it resets (midnight New York).
-
on_breachstringDaily loss only: what happens when it is reached.
One of
fail_accountflattenflatten_and_pause -
estimatedbooleanDaily loss only: the day's start is estimated (the engine does not publish it).
-
modestringMax drawdown only: how the reference moves.
One of
end_of_dayend_of_tradestaticintraday_equity -
at_leastbooleanMax drawdown only: the engine may hold a higher floor than shown (it follows equity highs).
-
The rule no longer applies this limit (its cut-off was reached).
-
-
Show 4 fields
-
The balance that reaches it.
-
Still to make.
-
How far, in percent.
-
Positions must be closed when it is reached.
-
-
Show 3 fields
-
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
Its liquidation price.
-
How far the price is from it, in percent.
-
-
When the trading day ends (midnight New York).
-
What needs your attention, most serious first.
-
-
errorstringWhy the account could not be read now (orders, positions and risk are then empty): read it again by REST.
type: snapshot_end
Every snapshot of a subscribe was sent.
-
The frame.
One of
snapshot_end -
Account numbers.
type: event
An event of an account you follow, once: as GET /v1/events answers it.
-
The frame.
One of
event -
Counts this connection's events, without a gap.
-
Show 6 fields
-
The event; pass it as after (GET /v1/events) or resume (the stream) to continue from it.
-
What happened (GET /v1/webhook-event-types says what each type means).
One of
order.createdorder.editedorder.filledorder.canceledorder.rejectedorder.expiredfill.createdposition.openedposition.changedposition.closedstrategy.createdstrategy.leg_placedstrategy.leg_modifiedstrategy.leg_filledstrategy.leg_canceledstrategy.leg_rejectedstrategy.orphan_repairedstrategy.slicestrategy.triggeredstrategy.endedtradingview.alert_executedtradingview.alert_refusedaccount.updatedaccount.passedaccount.failedaccount.payout_eligibleaccount.disabledaccount.removedkey.loss_stopkey.expiringsystem.restartedrisk.warningrisk.clearedalert.triggered -
The account number.
-
When it happened.
-
Where it came from: an order placed through this API or by an AI assistant (the MCP server), one placed on a trading platform, the engine itself (positions), a strategy of this API, or a TradingView alert.
One of
apimcpplatformenginestrategytradingview -
order or fill (the objects REST answers), with changes or close_reason when they apply. A position.* event carries position { market, side, size, average_price } as the engine reported it, and previous_size: read GET .../positions/{market} for its margin, P&L and liquidation.
-
-
replayedbooleanSent again after a resume.
type: risk
An account's risk changed (subscribed with risk).
-
The frame.
One of
risk -
The account number.
-
Show 19 fields
-
When the oldest figure here was read.
-
Some figures are older than usual (the engine was busy).
-
The balance.
-
The balance plus the open P&L at the market price.
-
The open P&L.
-
The equity change since midnight New York, open positions included: what the daily loss rule counts.
-
The P&L closed today.
-
The fees paid today.
-
Trades closed today.
-
The margin your positions hold.
-
What is left of the balance for new positions.
-
Show 5 fields
-
The value of every open position.
-
The value of the long ones.
-
The value of the short ones.
-
Gross exposure over equity.
-
Per market, largest first.
Show 5 fields
-
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
The value held on it.
-
That value over equity.
-
The exposure cap of the market.
-
How much of the cap is used, counting your other accounts on the same rule, in percent.
-
-
-
A loss limit and the room left to it.
Show 10 fields
-
limitdecimal stringThe limit, in USD.
-
floordecimal stringThe equity at which it is breached.
-
roomdecimal stringHow much more the account may lose before it.
-
used_pctdecimal string or nullHow much of it is used, in percent.
-
resets_atinteger, Unix msDaily loss only: when it resets (midnight New York).
-
on_breachstringDaily loss only: what happens when it is reached.
One of
fail_accountflattenflatten_and_pause -
estimatedbooleanDaily loss only: the day's start is estimated (the engine does not publish it).
-
modestringMax drawdown only: how the reference moves.
One of
end_of_dayend_of_tradestaticintraday_equity -
at_leastbooleanMax drawdown only: the engine may hold a higher floor than shown (it follows equity highs).
-
The rule no longer applies this limit (its cut-off was reached).
-
-
A loss limit and the room left to it.
Show 10 fields
-
limitdecimal stringThe limit, in USD.
-
floordecimal stringThe equity at which it is breached.
-
roomdecimal stringHow much more the account may lose before it.
-
used_pctdecimal string or nullHow much of it is used, in percent.
-
resets_atinteger, Unix msDaily loss only: when it resets (midnight New York).
-
on_breachstringDaily loss only: what happens when it is reached.
One of
fail_accountflattenflatten_and_pause -
estimatedbooleanDaily loss only: the day's start is estimated (the engine does not publish it).
-
modestringMax drawdown only: how the reference moves.
One of
end_of_dayend_of_tradestaticintraday_equity -
at_leastbooleanMax drawdown only: the engine may hold a higher floor than shown (it follows equity highs).
-
The rule no longer applies this limit (its cut-off was reached).
-
-
Show 4 fields
-
The balance that reaches it.
-
Still to make.
-
How far, in percent.
-
Positions must be closed when it is reached.
-
-
Show 3 fields
-
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
Its liquidation price.
-
How far the price is from it, in percent.
-
-
When the trading day ends (midnight New York).
-
What needs your attention, most serious first.
-
type: heartbeat
The connection is alive. Three missed: reconnect.
-
The frame.
One of
heartbeat -
The time on the server.
type: pong
The answer to a ping.
-
The frame.
One of
pong -
The time on the server.
type: unsubscribed
Those accounts are no longer followed.
-
The frame.
One of
unsubscribed -
Account numbers.
type: notice
Something to know about this connection, before the snapshot.
-
The frame.
One of
notice -
resume_gap: the resume could not be covered (an unknown event, or one older than the replay window): events after it may be missing here.
One of
resume_gap -
The resume asked: read GET /v1/events?after= it for what was missed.
type: error
A message of yours that could not be done. The connection stays open; the SDKs end the stream on it, since it would follow less than they asked.
-
The frame.
One of
error -
What went wrong.
One of
invalid_jsontoo_many_accountsaccount_not_found -
account_idstringThe account it is about.
-
detailsobjectMore about it.
What you send
op: subscribe
Follow accounts: a snapshot of each, then their events. Without accounts, every account your key reaches, and those opened later (each with its snapshot).
op: unsubscribe
Stop following accounts.
-
What you ask.
One of
unsubscribe -
Account numbers.
op: ping
Ask for a pong.
-
What you ask.
One of
ping
Market data
wss://stream.phoenixperpsfunding.com/v1/market-data
The connection for market data: subscribe to channels, list them, ping. Any key or app token of either environment.
What the server sends
type: hello
First, on every connection: what it offers, and its limits.
-
The frame.
One of
hello -
This connection.
-
How often a heartbeat comes.
-
The channels you can subscribe to.
-
The candle intervals.
-
Show 3 fields
-
Subscriptions one connection holds at most (a market on a channel; each candle interval counts).
-
Markets one subscribe names at most.
-
Messages a second you may send; beyond, the connection closes 4009.
-
type: subscribed
A subscribe was done: then the channel's current state, then snapshot_end.
type: snapshot_end
The current state of a subscribe was sent: live frames follow.
-
The frame.
One of
snapshot_end -
idintegerYour id for the request, echoed in its answers.
-
The channel.
One of
tickerbooktradescandlesstatsstatus
type: unsubscribed
An unsubscribe was done: what it ended, and what it named that was not followed.
-
The frame.
One of
unsubscribed -
idintegerYour id for the request, echoed in its answers.
-
The channel.
One of
tickerbooktradescandlesstatsstatus -
The markets no longer followed.
-
The markets named that were not followed.
-
intervalstringThe candle interval named (candles).
One of
1m3m5m15m30m1h2h4h6h12h1d1w1M
type: list
The answer to list.
-
The frame.
One of
list -
idintegerYour id for the request, echoed in its answers.
-
Your subscriptions.
type: heartbeat
The connection is alive.
-
The frame.
One of
heartbeat -
The time on the server.
type: pong
The answer to a ping.
-
The frame.
One of
pong -
idintegerYour id for the request, echoed in its answers.
-
The time on the server.
type: error
A message of yours that could not be done. The connection stays open.
What you send
op: subscribe
Follow markets on a channel. An option out of its range, or one the channel does not take, is refused with invalid_parameter.
-
What you ask.
One of
subscribe -
idintegerYour id for the request, echoed in its answers.
-
The channel.
One of
tickerbooktradescandlesstatsstatus -
symbolsarray of stringMarket ids, 1 to 50 (stats: ["*"] for every market; status: none).
-
interval_msintegerticker: the shortest time between frames (default 250).
One of
1002505001000 -
depthintegerbook: levels on each side (default 10).
One of
151020 -
historyintegertrades: recent trades sent first, 0 to 200 (default 20). candles: closed candles sent first, 0 to 500 (default 100), then the forming one.
-
intervalstringcandles: the interval.
One of
1m3m5m15m30m1h2h4h6h12h1d1w1M
op: unsubscribe
Stop following markets on a channel.
-
What you ask.
One of
unsubscribe -
idintegerYour id for the request, echoed in its answers.
-
The channel.
One of
tickerbooktradescandlesstatsstatus -
symbolsarray of stringThe markets to stop following; none, or an empty list, for every one of the channel (status: none).
-
intervalstringcandles: the interval to stop; none for every interval of those markets.
One of
1m3m5m15m30m1h2h4h6h12h1d1w1M
op: list
Ask for your subscriptions.
-
What you ask.
One of
list -
idintegerYour id for the request, echoed in its answers.
op: ping
Ask for a pong.
-
What you ask.
One of
ping -
idintegerYour id for the request, echoed in its answers.
Market data channels
ticker Ticker
The latest prices, at most once per interval_ms.
Subscribe with
-
interval_msintegerThe shortest time between frames (default 250).
One of
1002505001000
-
The frame.
One of
ticker -
A market id: the asset and USD; an option adds its venue or hours after a dot.
book Order book
The top of the book to the depth asked, whole every time (replace what you hold), at most every 250 ms.
Subscribe with
-
depthintegerLevels on each side (default 10).
One of
151020
-
The frame.
One of
book -
A market id: the asset and USD; an option adds its venue or hours after a dot.
trades Trades
Trades as they print, batched every 100 ms; first the history asked.
Subscribe with
-
historyintegerRecent trades sent first, 0 to 200 (default 20).
-
The frame.
One of
trades -
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
Trades, oldest first.
candles Candles
Candles: first the history asked, then the forming candle as it changes and each closed one.
Subscribe with
-
intervalstringThe candle interval (required).
One of
1m3m5m15m30m1h2h4h6h12h1d1w1M -
historyintegerClosed candles sent first, 0 to 500 (default 100); the forming one follows in a frame of its own.
-
The frame.
One of
candles -
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
The candle interval.
One of
1m3m5m15m30m1h2h4h6h12h1d1w1M -
Candles, oldest first.
Show 8 fields
-
When the candle starts.
-
The first price.
-
The highest.
-
The lowest.
-
The last.
-
The size traded.
-
false: still forming, it comes again as it changes.
-
revisedbooleanA closed candle sent again with its final figures.
-
stats Stats
24-hour figures and open interest, every 5 seconds (GET /v1/markets/stats answers the same for every market).
-
The frame.
One of
stats -
A market id: the asset and USD; an option adds its venue or hours after a dot.
-
Show 9 fields
-
The last trade.
-
The change over 24 hours.
-
That change in percent.
-
The highest in 24 hours.
-
The lowest in 24 hours.
-
The size traded in 24 hours.
-
The value traded in 24 hours, in USD.
-
The market's open interest: the size held open in positions.
-
That open interest in USD, at the last price.
-
status Market status
The price feed's state, when it changes.
-
The frame.
One of
status