Skip to main content
WSS
What this stream gives you. Open one connection to wss://api.aries.com/v1/accounts/ws, authenticate, and the server will push updates whenever anything changes on your trading account - an order fills, a position is opened or closed, your buying power moves, news drops on a stock you hold, or a watchlist gets edited on another device. You get the same live picture a brokerage app would show, without polling.

Key Features

Order Status Updates

Real-time notifications when orders are placed, filled, partially filled, or cancelled. Track order lifecycle with millisecond latency.

Position Changes

Live updates when positions are opened, modified, or closed. Monitor both stock and option positions in real-time.

Balance Updates

Instant account balance updates including buying power, equity, cash movements, and margin changes.

P&L Candles

Real-time profit/loss candles at various intervals (15s, 1m, 5m, 15m, 1h, 1d, 1mo) for performance tracking.

Watchlist Updates

Live synchronization for the authenticated user’s watchlists. Each update carries the latest full watchlist state.

News Feed

Real-time news updates relevant to your portfolio and watchlist symbols.

Endpoint

Connect to the accounts WebSocket endpoint for all account-related streams (orders, positions, balances, P&L candles, watchlist updates, and news):Production: wss://api.aries.com/v1/accounts/wsMigration: If you were using wss://api.ariesfinancial.com/ws, update to the URL above.After connecting, authenticate within 5 seconds, then subscribe to the topics you need: account, pnl, watchlist, or news.

Authentication Required

Send a request message to POST /auth with your token in payload.body:Auth request example:
Authentication is required and must be completed within 5 seconds of connection. This WebSocket contains sensitive account information and requires a valid JWT token.
All connections must use WSS (WebSocket Secure) protocol. Each user receives only their own account updates, ensuring data privacy and security.

Session Management

Sessions expire after 65 minutes (3900000ms). The server:
  • Sends a refresh warning 5 minutes before expiration
  • Closes the connection when the session expires
  • Requires re-authentication after expiration

Security Best Practices

  • Always use WSS in production
  • Store JWT tokens securely
  • Implement automatic re-authentication on expiration warnings
  • Monitor connection status and implement reconnection logic
Each topic is a separate stream - subscribe only to what your app needs.

Subscribe request object

Every subscribe message uses the same top-level shape:

Account Updates (account)

One subscription covers everything that happens on a trading account:
  • Orders - order status changes as your orders move through the system (see the full status list below).
  • Positions - when a position is opened, increased, reduced, or closed, for both stocks and options.
  • Balance - buying power, equity, margin, and cash movements.
  • Account info - changes to the account record itself (type, options level, etc.).
Requires: accountId in params - the ID of the account you want to subscribe to.Initial snapshot: Right after you subscribe, the server sends a snapshot containing current account/balance fields, all open positions, legacy orders, and the new ordersV2 list, so you start with the full state.

P&L Candles (pnl)

A live time-series of your account’s profit-and-loss, broken into “candles” of a fixed length (just like price candles on a chart). Useful for plotting equity curves and intraday performance.Supported intervals - choose the candle length that matches your dashboard:Requires: accountId and startTime (an RFC3339 timestamp marking how far back to start the series) in params. interval is optional and defaults to 1m.

Watchlist Updates (watchlist)

Returns the authenticated user’s current watchlists immediately after you subscribe. After that, every watchlist event carries the latest full watchlist array, so your app can replace local watchlist state without reconstructing add or remove operations.Requires: Nothing extra. Send only payload.topic = "watchlist". The backend ties the subscription to your authenticated user, not to a specific account.

News Updates (news)

Pushes news articles in real time.Requires: payload.topic = "news".Optional params:
  • symbols - array of tickers to filter by, for example ["AAPL", "TSLA"]. Live news subscriptions are filtered by symbol.
  • topics - array of topic strings, for example ["earnings"]. The backend accepts this on subscribe and uses it when it fetches the initial news snapshot. Live push filtering is still symbol-based.

Ping/Pong Keepalive

Send periodic pings to keep the WebSocket connection alive and detect network issues:Recommendation: Send a ping every 30-60 seconds to maintain connection health.

Handling Disconnects

Always implement reconnection logic with exponential backoff:
  • Start with 1 second delay
  • Double the delay on each retry (2s, 4s, 8s)
  • Cap maximum delay at 60 seconds
  • Re-authenticate after reconnection

Connection States

Monitor the connection state and handle state transitions gracefully in your application.

Trading Applications

Real-time order status for trading platforms. Display live order fills, rejections, and modifications.

Portfolio Monitoring

Track position changes, P&L, and balance updates for portfolio management dashboards.

Risk Management

Monitor buying power, margin levels, and position sizes in real-time for risk control systems.

Order Notifications

Push notifications to mobile apps when orders are filled or positions change.

Performance Analytics

Real-time P&L candles for performance tracking and analytics dashboards.

News Alerts

Real-time news feed integration for trading signals and market sentiment analysis.

Connection Lifecycle

Subscription Flow

  1. Connect to WebSocket endpoint
  2. Authenticate within 5 seconds
  3. Subscribe to desired topics
  4. Receive the initial snapshot the server returns for the topic you subscribed to
  5. Stream real-time updates
  6. Unsubscribe when done
  7. Monitor session expiration warnings

Common Errors

Error Response Format

Always implement comprehensive error handling to gracefully handle network issues, authentication failures, and server errors.

Performance Optimization

  • Subscribe once per account to account topic to receive all account events
  • Use specific intervals for P&L candles based on your needs
  • Implement batching for handling high-frequency updates
  • Store state locally to avoid unnecessary re-subscriptions

Reliability

  • Monitor connection health with periodic pings (30-60 second intervals)
  • Implement exponential backoff for reconnections
  • Handle session expiration proactively using refresh warnings
  • Store subscription state to restore after reconnection

Security

  • Rotate tokens periodically
  • Use environment variables for connection URLs and tokens
  • Log authentication events for audit trails
  • Validate all incoming messages before processing

Development

  • Use development environment for testing
  • Test failure scenarios (disconnects, authentication failures, malformed messages)
  • Monitor bandwidth usage in production
  • Implement message queuing for high-volume scenarios

Authentication

Authenticate Connection

Authentication must be completed within 5 seconds of connection establishment.

Authentication Success Response

The expiresIn field indicates session duration in milliseconds (65 minutes = 3900000ms).
If authentication is not completed within 5 seconds, the server will close the connection with an authTimeout event.

Subscribing to Updates

Subscribe to Account Updates

Subscribe to all account-level updates including orders, positions, balance, and account information.

Account Updates

Subscribe to All Account Updates

Get orders, positions, balance, and account info for a specific account:

Response with Initial Snapshot

The server responds with a subscribed message containing current account state. Decimal values are serialized as JSON strings.
The initial snapshot includes merged account and balance fields, positions, legacy orders, and ordersV2. After this, you’ll receive real-time event messages as changes occur.

Subscribe to P&L Candles

Track profit/loss at specified intervals. startTime is required:

Supported Intervals

Subscribe to Watchlist Updates

Get notified when symbols are added, updated, or removed from watchlists:

Subscribe to News Updates

Receive real-time news. You can optionally filter by symbol:
Omit params entirely to receive all news without filtering.

Watchlist subscription response

The server confirms the watchlist subscription with the user’s current watchlists:
Watchlist and news subscriptions are user-level and don’t require an account ID. The watchlist topic returns the full current watchlist array on subscribe and on every later update.

Payload Data Types

Real-Time Update Messages

Once subscribed, the server pushes event messages as data changes.

Order Updates

Receive notifications when order status changes.

Order Filled

ordStatus Values

The order status field is ordStatus. These are the full set of states an order can be in over its lifetime:

Order field enums

Order event payloads contain several enum fields. Here’s the full vocabulary you’ll see across stocks and options: side - direction of the trade: type - order type, i.e. how the order is priced: timeInForce - how long the order stays alive: securityType / instrument - what asset class: putCall (options only): CALL or PUT. positionEffect (options only): OPEN (creates/increases a position) or CLOSE (reduces/closes one).

Position Updates

Receive notifications when positions change.

Long Stock Position

Position updates emit primary fields avgPrice, todayRealizedPnL, and securityType. The backend also emits backward-compatible aliases avgCost, realizedPL, and instrument.

Balance Updates

The account topic can also emit account.balance.apex. That event is a partial Apex-sourced balance update and currently carries accountId, fullyPaidUnsettledFunds, amountAvailableToWithdraw, and updatedAt. Clients should merge that payload into their latest balance state instead of treating it as a full balance snapshot.
Balance field reference - decimal values arrive as JSON strings to preserve precision:

Account-level enums

The account-info and account snapshot messages include a few enum fields. Here are the full sets of values you may see: accountType - how the account is funded and settled: accountClass - who owns the account: optionsLevel - what option strategies the account is approved for. Higher levels unlock more complex (and risky) strategies:

Account Info Updates

P&L Candle Updates

Watchlist Updates

Watchlist events do not send item-by-item patches. Each event contains the latest full watchlist array for the authenticated user.

News Updates

Unsubscribing from Updates

Stop receiving updates for specific topics.

Unsubscribe from Account Updates

Response

Connection Management

Ping/Pong Keepalive

Send periodic pings to maintain connection health and detect network issues. Ping Request:
Pong Response:
Recommendation: Send a ping every 30-60 seconds to keep the connection alive.

Session Expiration

Refresh Warning (5 minutes before expiration):
Session Expired:
When you receive a refreshAuth warning, you should re-authenticate or be prepared to reconnect. The connection will be closed when the session expires.

Error Handling

Error Response Format

All errors follow this format:

Common Error Scenarios

Authentication Timeout

Cause: Did not authenticate within 5 seconds of connection.Resolution: Send authentication request immediately after connecting.

Invalid Token

Cause: JWT token is invalid or expired.Resolution: Generate a new token and re-authenticate.

Missing Account ID

Cause: accountId not provided in params for account or pnl subscription.Resolution: Include accountId in payload.params.

Unknown Topic

Cause: Invalid topic specified.Resolution: Use valid topics: account, pnl, watchlist, news.

Best Practices

Reliable Connection Handling

Implement exponential backoff for reconnections:

Handle Session Expiration

Efficient Subscription Management

Subscribe once to account updates for all order, position, balance, and account changes:

Store State Locally

Keep local state to avoid unnecessary re-subscriptions:
Authentication Request
type:object

Sign in with an access token

Subscribe Request
type:object

Subscribe to real-time updates

Unsubscribe Request
type:object

Unsubscribe from updates

Ping
type:object

Keep-alive ping

Authentication Expired
type:object

Session has expired

Refresh Authentication Warning
type:object

Session expires soon, re-authentication recommended

Order Update
type:object

Real-time order update

Position Update
type:object

Real-time position update

Balance Update
type:object

Real-time balance update

Account Info Update
type:object

Real-time account information update

P&L Candle Update
type:object

Live profit and loss updates

Watchlist Update
type:object

Real-time watchlist updates

News Update
type:object

Real-time news updates

Error
type:object

Error response

Authentication Success
type:object

Authentication succeeded

Authentication Timeout
type:object

Authentication timed out

Subscribed
type:object

Subscription confirmed with snapshot

Unsubscription Confirmed
type:object

Server confirms unsubscription

Pong
type:object

Keep-alive pong response