WebSocket Account Data Streaming
This API is presently in Beta. It is only available to Tradier Brokerage account holders and should only be used in production applications with caution.
Stream account updates using WebSocket streaming. You will receive a different payload depending on the account event that occurred — details about each event’s fields are in Streaming Account Events. You can continually update the data in your stream by resending this request payload using your existing sessionid.
Note: in order to stream data, you must first create a streaming session via Create Account Session. Upon receiving a sessionid, you have up to 5 minutes to connect to a streaming endpoint before the session expires.
Once connected and streaming data, to make modifications to your current streaming connection, simply resend your request payload using the existing sessionid. If your sessionid has expired, you’ll need a new one.
While we do not publish exact limits, we monitor for abuse. It is not permitted to open more than one session at a time.
Note that WebSocket streaming uses a different host: wss://ws.tradier.com
wss://ws.tradier.com/v1/accounts/eventsIf you’re developing with a paper trading account, use wss://sandbox-ws.tradier.com instead (account data only — there is no market data streaming in the sandbox environment).
Request Payload
events | array | Yes | ["order"] |
sessionid | string | Yes | "9D1C7018CFEB6F8ECF8CAA58B33" |
excludeAccounts | array | No | ["6YA00001", "6YA00002"] |
The account-scoping field on this payload is excludeAccounts — an exclude list, not an include list. By default the stream covers all accounts associated with the session's token; list account numbers here only if you want to exclude them from the stream. (An earlier draft of this page incorrectly documented an accounts include-list field — that was never correct; this section reflects the real payload shape.)
Code Example (Python)
import asyncio
import websockets
async def connect_and_consume():
uri = "wss://ws.tradier.com/v1/accounts/events"
async with websockets.connect(uri) as websocket:
payload = '{"events": ["order"], "sessionid": "SESSION_ID", "excludeAccounts": []}'
await websocket.send(payload)
while True:
response = await websocket.recv()
print(f"< {response}")
asyncio.run(connect_and_consume())
Return Examples
{"id": 1107075, "event": "order", "status": "open", "type": "limit", "price": 10.0, "stop_price": 0.0, "avg_fill_price": 0.0, "executed_quantity": 0.0, "last_fill_quantity": 0.0, "remaining_quantity": 2.0, "transaction_date": "2021-08-09T20:05:35.277Z", "create_date": "2021-08-09T20:05:35.277Z", "account": "6YA"}
{"id": 1107075, "event": "order", "status": "pending", "type": "limit", "price": 10.0, "stop_price": 0.0, "avg_fill_price": 0.0, "executed_quantity": 0.0, "last_fill_quantity": 0.0, "remaining_quantity": 2.0, "transaction_date": "2021-08-09T20:05:35.277Z", "create_date": "2021-08-09T20:05:35.277Z", "account": "6YA"}
{"id": 1107075, "event": "order", "status": "filled", "type": "limit", "price": 10.0, "stop_price": 0.0, "avg_fill_price": 10.0, "executed_quantity": 2.0, "last_fill_quantity": 0.0, "remaining_quantity": 0.0, "transaction_date": "2021-08-09T20:05:35.277Z", "create_date": "2021-08-09T20:05:35.277Z", "account": "6YA"}
On this page
- WebSocket Account Data Streaming